2

I use xbindkeys for managing my hotkeys in Gnome 3 but it doesn't have a daemon so I added it to .xinitrc.

~$ cat .xinitrc 
ck-launch-session gnome-session
nohup xbindkeys &

Strangely, this does not work at all. I still have to manually start xbindkeys every time I boot. What am I doing wrong here?

My system:

~$ uname -a
Linux [...] 3.0.28-1-lts #1 SMP PREEMPT Mon Apr 16 21:05:30 CEST 2012 x86_64 Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz GenuineIntel GNU/Linux
7

To have xbindkeys running in your Gnome 3 environment you should run gnome-session-properties and add xbindkeys there. After that just log out and log in again.

(note please, that your ~/.xbindkeysrc should contain at least 1 command to let xbindkeys demonize)

Anyway, it is not a good idea to run it from .xinitrc, you probably should avoid that. Simply - .xinitrc it is a shell script => sequence of commands you are going to run one by one. So your xbindkeys will not run until your previous command will not exit (in your example it is ck-launch-session gnome-session

4

In sh scripts, including .xinitrc, all commands are run serially by default – nohup xbindkeys is not considered until gnome-session exits. Swapping the lines should work (although nohup is useless here).

However, it is better to run xbindkeys from GNOME session, rather than .xinitrc; otherwise programs started using keybindings will break when they attempt to do certain privileged operations (those that are controlled by polkit & ConsoleKit). Add xbindkeys to gnome-session-properties instead.

  • 1
    Thank you both very much! Unfortunately I could only mark one answer as accepted so I gave it to the one with less points. – Konrad Höffner May 9 '12 at 14:29

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.