I've used xbindkeys to associate a hot-key with /usr/bin/test.sh

I can run the script two ways now! (well, not always! hence this question.)

eg. /usr/bin/test.sh contains

  • Using terminal ... gedit launches
  • Using hot-key ... gedit launches

However, when test.sh contains

  • Using terminal ... nautilus launches
  • Using hot-key ... nautilus fails to execute!

My bash skills are basic, to say the least... Is there some bracket, or quotes thing I need here?... or is there something inately differnt between "nautilus" and "gedit"... is it "xbindkeys"? ... I'm stuck :(

  • Do any messages appear in .xsession-errors in your home directory when test.sh produces no visible effect? – Gilles 'SO- stop being evil' Nov 10 '10 at 0:10
  • Gilles: I'll check .xsession-errors soon... but now I want to mention that nautilus is the only offender ... xclip is fine; I was expecting it to behave like a Windows CLI utility I used for years... but nautilus is still an issue.. I'll check the log as you suggest.. (I've ammended my question to refer only to nautilus) – Peter.O Nov 10 '10 at 0:28
  • If you change the script to start notnautilus, does a message like notnautilus: command not found appear in ~/.xsession-errors (it should)? What if you start nautilus --no-desktop? What about nautilus /tmp? – Gilles 'SO- stop being evil' Nov 10 '10 at 0:47
  • Gilles: I just now saw your message... I managed to work it out, but you were spot on.. I wish I'd noticed it earlier ;) ... I tried adding just the path (more detail below)... WE got there.. Thanks to all... and now I need a coffeeeeeee!!! – Peter.O Nov 10 '10 at 1:46

How about this?

/usr/bin/nautilus ~/

Perhaps your hot-key manager isn't aware of your PATH.

  • A good thought, but unfortunateley it didn't work... same result... I wonder if it is a permissions thing: -rwxr-xrwx, but I think that means read/write/execute for all and sundry!... – Peter.O Nov 9 '10 at 23:34
  • @fred.bear It is not the permission issue. Usually 755 works fine. I should warn you though that you shouldn't set the 'write' permission for 'others' like you do on the file. Correct it with sudo chmod 755 /usr/bin/test.sh. – Gödel Nov 9 '10 at 23:40
  • How about just specifying nautilus for the hot key? Also, what's your hot-key manager? I use xbindkey and compiz command plugin. Both don't exhibit any of the problem you are having. – Gödel Nov 9 '10 at 23:42
  • UPDATE: The only offender is nautilus (see comment attatched to question) – Peter.O Nov 10 '10 at 0:35
  • Gödel: Thanks..I was (partially) aware of the security issue of the write permission, and perhaps a bit more aware now.. Does a script owned by root, but executed by a non-sudo'd user have any elevated rights? (... too many years of windows nonchalance).... I am using xbindkeys-config to set up the bindings ... I haven't used Compiz Commands yet.... And I have tried nautilus directly into xbindkeys, but it doesn't work there either. – Peter.O Nov 10 '10 at 0:51

You need to add exec and the path of the executable as Gödel mentioned. For example:

exec /usr/bin/gedit .

I just tried doing the same with GNOME's own keyboard shortcuts, surprisingly I seem to have the same problem. Have you tried this yourself?

Update: it seems that this is only happening with some keyboard shortcuts. I tried Super+G and it didn't work, but CTRL+G for grun works perfectly. Can you see if the same works for you? Maybe it's that another shortcut should work.

  • Roland, that didn't change things... I have 8 hotkeys set by xbindkeys, but the 2 I've mentioned just don't respond... The script(s) run via the terminal... Also, when I put the command directly into xbindkeys, rather than a script, it still won't work... (a mystery) – Peter.O Nov 9 '10 at 23:48
  • UPDATE: The only offender is nautilus (see comment attatched to question) – Peter.O Nov 10 '10 at 0:35
  • Thanks for the extra effort... Different keys don't apply in my case, because the xbindkeys inteface has a test-the-command button, and it doesn't work from there either.. (in case you haven't already seen my comment (see Gödel): my particular problem with nautilus has been resolved... ### I tried Super+g and Ctrl+g for grun... They both work. (aren't computers such fun ;) ... never a dull moment! – Peter.O Nov 10 '10 at 1:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.