Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently installed tilda and I would like to open it and close with the same keyboard shortcut. I wrote little something in bash that closes tilda if it is open and opens tilda when there is no such a process in ps -ef. It looks like this:

a=ps -ef | fgrep -i tilda | cut -d' ' -f4 | head -1;if [ $a ] ; then kill $a; else tilda; fi

It seems to be working (at least partially) when I commit this in terminal, but when I assign this command to specific keyboard shortcut (for example alt+1) it does nothing. Any suggestions?

btw. is it possible to assign this shortcut for button '`' like in Quake?

share|improve this question
up vote 0 down vote accepted

You need to use

bash -c "a=`ps -ef | fgrep -i tilda | cut -d' ' -f4 | head -1`;if [ $a ] ; then kill $a; else tilda; fi" 

as the field is expected to be a single program name or path and arguments, and not a shell script. Or you can place that script in a file and give it a #!/bin/bash and chmod +x it and give the path to that script instead.

share|improve this answer
    
Thank you, it helped me. – Peter Nov 24 '12 at 16:02

Why are you killing Tilda instead of hiding it? I use Tilda and have assigned a keyboard shortcut to show/hide it. Tilda starts upon login. Check Tilda's preferences.

share|improve this answer
    
I didn't know that ... That helped me too :) Thanks! – Peter Nov 24 '12 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .