Fedora Linux Support Community & Resources Center
  #1  
Old 9th October 2009, 06:16 AM
KirkD Offline
Registered User
 
Join Date: Oct 2007
Posts: 384
linuxfedorafirefox
Auto start a program on start up?

I just installed TuxGuitar - very cool - and to get the sound to work I had to install Timidity++ as well. Before I start TuxGuitar I have to execute:

timidity -iA -Os

in a terminal window first, which is kind of a pain to do every time I run TuxGuitar.

How do I get this line to execute on startup such that timidity is running when I start up? I tried adding that line to rc.local - no luck.

-Kirk
Reply With Quote
  #2  
Old 9th October 2009, 06:24 AM
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,291
linuxopera
You can:
> place an auto-launcher file in folder ~/.config/autostart/ to (surprise!) auto-start timidity (with the options that you listed) when you log into the desktop; the file might be named 'timidity-auto.desktop', and contain, for example:
Code:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=timidity-auto
Exec=timidity -iA -Os
Terminal=true
NotShowIn=
Comment[en_US]=Input Method starter
X-GNOME-Autostart-enabled=false
> alias (in ~/.bashrc) tuxguitar to execute the timidity (with options) first; perhaps:
alias tg='timidity -iA -Os; tuxguitar'

V

P.S. Note that if Timidity should only be running when needed for tuxguitar, then the alias is better, if auto-starting Timidity upon desktop login may interfere with other A/V operations.

Last edited by Hlingler; 9th October 2009 at 06:30 AM.
Reply With Quote
  #3  
Old 9th October 2009, 04:14 PM
KirkD Offline
Registered User
 
Join Date: Oct 2007
Posts: 384
windows_xp_2003firefox
TuxGuitar + Timidity

Hlinger,

Thank you for the tips! I like the alias idea best for the very reasons you mentioned, and will probably approach it this way. How do I get access to the command line used by the Fedora program launcher GUI? When I go to the Fedora Button -> Multimedia -> TuxGuitar, where do I adjust the command line used to start TG? I searched a bit last night in hopes that I could just prefix with the timidity line, but I didn't find it.

-Kirk
Reply With Quote
  #4  
Old 9th October 2009, 04:21 PM
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,291
linuxopera
Umm... I don't know ? I have F11-LXDE, which uses the OpenBox Window Manager, and I don't know how to edit GNOME desktop launchers. You have actually found a third option: altering the desktop launcher itself (only applies to the user logged into desktop). OR: you could edit (as root user) the tuxguitar system launcher (somewhere in folder /usr/share/applications/...) to contain the command line ('Exec=...') as shown above. That'll make it so for all users. I'd go with:
Code:
Exec=timidity -iA -Os; tuxguitar
V

Last edited by Hlingler; 9th October 2009 at 04:23 PM.
Reply With Quote
  #5  
Old 9th October 2009, 04:23 PM
KirkD Offline
Registered User
 
Join Date: Oct 2007
Posts: 384
windows_xp_2003firefox
Third option

Glad to see I found that third option on my own. 8^)

I'm actually using KDE, but I doubt that changes things much. I'll dig around a little further and see what I can find. Hmmm....
Reply With Quote
  #6  
Old 9th October 2009, 04:34 PM
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,291
linuxopera
KDE4 ? Try right-clicking on the menu entry for tuxguitar.

What this essentially does is: copies the system launcher file from folder /usr/share/applications/... into your personal ~/.kde4/... folder, then applies whatever edits you make. You can manually do the same thing by... well, copying the system launcher to the correct folder in your HOME directory (I think: ~/.kde4/share/applnk/ maybe ???), and making the edits. You may need to logout/in to apply the changes to your personal desktop menus.

V
Reply With Quote
  #7  
Old 9th October 2009, 04:45 PM
KirkD Offline
Registered User
 
Join Date: Oct 2007
Posts: 384
windows_xp_2003firefox
Yep, KDE4. I tried the right-click option on TuxGuitar and it didn't give me any option to change anything. I only had options to execute the program or move its location.

I'm away from the system right now, but I'll do a bit more investigation once I have it back in front of me.
Reply With Quote
  #8  
Old 10th October 2009, 06:31 AM
KirkD Offline
Registered User
 
Join Date: Oct 2007
Posts: 384
linuxfedorafirefox
I found the KDE Menu Editor which gives me access to all the Program Launcher details. From here I changed

tuxguitar %f (the default value I found)

to

timidity -iA -Os; tuxguitar %f

It seems that timidity launches but tuxguitar never comes up. So, I added an ampersand as such:

timidity -iA -Os &; tuxguitar %f

but no luck.

Essentially I need to have the alias option Hilinger suggested attached to the Program Launcher icon for TG. Any ideas??

-Kirk
Reply With Quote
  #9  
Old 10th October 2009, 06:35 AM
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,291
linuxopera
Hmm... try:
timidity -iA -Os && tuxguitar %f

in the launcher editor. Or: create the alias, then edit the launcher to execute the alias (Exec=tg).

V
Reply With Quote
  #10  
Old 10th October 2009, 06:40 AM
KirkD Offline
Registered User
 
Join Date: Oct 2007
Posts: 384
linuxfedorafirefox
Update:

I changed the line I mentioned above to:

timidity -iA -Os & tuxguitar %f

which simply removes the ';' after the ampersand. Seems odd, but it works. Now when I fire of TuxGuitar from the Program Launcher, timidity starts, TuxGuitar starts, and TG selects the appropriate timidity port automagically.

Next question - how do I ensure that timidity is killed when TG is closed? Timitidy doesn't seem to interfere with other audio - I tested Audacity, YouTube, and Banshee - but for future reference, how could I go about killing timidity on TG exit?


Hlinger - looks like we crossed in the ether. 8^) Thanks for the tip. Any idea how to kill timidity when TG gets closed??

Last edited by KirkD; 10th October 2009 at 06:45 AM.
Reply With Quote
  #11  
Old 10th October 2009, 06:52 AM
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,291
linuxopera
Must brush up on my command syntax - that single ampersand seems odd indeed... .
Quote:
Any idea how to kill timidity when TG gets closed??
No, not easily (that I know of - but hey, I'm not batting too well here): you would have to write a whole new shell script to run the two, with a call to pkill timidity upon tuxguitar close. But since it does not create problems... .

V

P.S. I see your concern (I think): each time you start (and close) tuxguitar, you have yet another instance of timidity running in the background.

Last edited by Hlingler; 10th October 2009 at 06:59 AM.
Reply With Quote
  #12  
Old 10th October 2009, 07:04 AM
KirkD Offline
Registered User
 
Join Date: Oct 2007
Posts: 384
linuxfedorafirefox
Quote:
Originally Posted by Hlingler View Post
Must brush up on my command syntax - that single ampersand seems odd indeed... .No, not easily (that I know of - but hey, I'm not batting too well here): you would have to write a whole new shell script to run the two, with a call to pkill timidity upon tuxguitar close. But since it does not create problems... .

V

P.S. I see your concern (I think): each time you start (and close) tuxguitar, you have yet another instance of timidity running in the background.
Exactly! I can probably deal with only one instance and keeping it in mind, but it gets a little sloppy. Maybe I'll brush up on my syntax too and see if I can come up with a crazy piped line on the order of:

timidity -iA -Os & tuxguitar; kill -9 | ps -A | grep timidity

Essentially when TG stops, get a process list, grep out timidity, pull out the PID, and send it to kill -9. I'm reasonably sure I can build such a line, but it seems a teeny bit of a hack. 8^)

BTW - what should the double ampersand do versus the single that I'm using? (Heading to bed, so I'll check in tomorrow morning. Thanks for all your help now and in the past!!)
Reply With Quote
  #13  
Old 10th October 2009, 07:08 AM
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,291
linuxopera
Double ampersand means "if the first command succeeds, then and only then...". Incidentally: I mentioned pkill, because using it does not require that you know the PID.

Perhaps something like this might work:
timidity -iA -Os & tuxguitar; pkill timidity

Not exactly sure if that would be feasible from a desktop launcher though. Note also that, if that actually does work, then pkill would terminate ALL open instances of timidity, with prejudice.

V

Last edited by Hlingler; 10th October 2009 at 07:13 AM.
Reply With Quote
  #14  
Old 12th October 2009, 05:29 AM
KirkD Offline
Registered User
 
Join Date: Oct 2007
Posts: 384
linuxfedorafirefox
That did the trick! Thanks, again!!
Reply With Quote
Reply

Tags
auto, program, start

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
auto start a program in gnome Chen Using Fedora 15 15th August 2008 12:22 PM
i want AWN to start up auto? $Linux Using Fedora 2 10th February 2008 12:04 AM
Auto-Reboot + Auto-Start Certain Apps P4rD0nM3 Using Fedora 1 25th January 2008 06:03 PM
Can't get program to auto start after login j3ffr3yc Using Fedora 3 24th August 2004 10:01 PM


Current GMT-time: 14:46 (Tuesday, 29-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat