GUI wrapper for timidity -ig with Firefox

Peter Garrett peter.garrett at optusnet.com.au
Fri Sep 7 01:53:57 BST 2007


On Thu, Sep 06, 2007 at 04:53:51PM +1000, Andre Mangan wrote:
> Hello to all Ubuntu users,
> 
> For general information:
> 
> After much research, testing and fiddling about, I have added System Monitor
> to my top panel and in order to turn off any midi file accessed via Firefox
> that loads without the TiMidity GUI, I can access the icon for the System
> Monitor with ease and elect to stop (or kill) the process (yes, I know that
> I could do it via the command line too).
> 
> I knew it was going to be easy, it just took a while to get there..


Apologies if this turns out to be a duplicate post - I seem to be having
some email issues here with Sylpheed. Trying again with Mutt...

I thought this was an interesting problem, so I tried a few things...

I use the gtk interface for timidity . which is called as

timidity -ig

If you don't have it, install " timidity-interfaces-extra' from the
universe repo.

Now, this was a bit of an adventure *cough* ...

I tried calling timidity from a little wrapper script thus:

#!/bin/bash
timidity -ig "$@"

This was ... interesting...  It not only refused to run, it shot the CPU
through the roof so badly that the whole system was wedged - I couldn't
even ssh in to kill it.

After several attempts at variations, I hit on the problem, which is that
you need the * full path to timidity * for this to work in a script ,,,
First time I've come across something that requires the full path
hard-coded like this, but there you are... 

So, here is how to get Firefox to give you a gui when you play a midi on a
website: put this somewhere ( doesn't matter much where, I suggest ~/bin)

#---------------------------------------------------------------------#
#!/bin/bash

# Wrapper for timidity with firefox  - $HOME/bin/timidity-wrapper
# Uses the gtk interface from timidity-interfaces-extra
# You can use the athena version with -ia
# You *must* give the full /usr/bin/timidity path as below, or it will 
# freeze everything ( I'm not kidding - I found out the hard way)

/usr/bin/timidity -ig  "$@"

#---------------------------------------------------------------------#

I put this in /home/peter/bin/timidity-wrapper , and gave that path for
timidity to Firefox in the dialogue that pops up in FF for "helper" apps .
You might need to alter yours if you have set "Always do... " 
Of course the "script" needs to be executable

chmod u+x ~/bin/timidity-wrapper    ( if in ~/bin , of course )

This appears to work.

Tested at

http://www.trachtman.org/ragtime/

I think this is not a Firefox bug - I think it's a problem with timidity's
way of finding the PATH, or perhaps the way it is called ( don't know).

Perhaps the galeon devs etc. call it the right way ? (In which case I 
suppose it could be seen as a Firefox bug, although hard coding paths 
doesn't seem like something you should need to do ? ) .

Peter




More information about the ubuntu-au mailing list