9

When I restart my computer, xbindkeys is launched but it doesn't work right. If I kill it and then manually start it with nohup xbindkeys, it works fine. I think it'll work fine if I put it into my .xsessionrc file. But something else is already starting it when I boot, which interferes.

I recursively searched /etc for xbindkeys with no success.

  • 1
    Do you have any computers on a network? – horIzoN Feb 25 '13 at 17:43
  • Not sure what you mean. Many systems are on the same WiFi network as me. But there's only one user (me) of the system to which I'm referring, and it's always physical access to the machine. No SSHing or anything. – Espressofa Feb 25 '13 at 21:32
  • Ok. If you have file sharing on and there's a Ubuntu machine on the network with xbindkeys, then they might be running it at the same time as you. But I'm sure @Mik's solution will work. – horIzoN Feb 26 '13 at 16:49
  • I have a similar problem. When I start up, xbindkeys -s shows the correct list of commands, but they don't all work - I run killal xbindkeys && xbindkeys, and then they do work. Does your xbindkeys not work at all? Or do some commands work? – Benubird Apr 22 '14 at 12:44
  • I have this exact same problem (2 years after last comment and on 15.10). Xbindkeys starts up automatically but my keys are not bound. If I kill it and start it again it works. I tried replacing the startup script with just xbindkeys, but it does the same thing. – Lasse Dahl Ebert Mar 14 '16 at 20:23

4 Answers4

8

I have found that xbindkeys is automatically started if you have an .xbindkeysrc in your home folder or in a system folder such as /etc. Hence why it does not usually need to be added as a separate startup item once installed.

This is explained well in the file /etc/X11/Xsession.d/98xbindkeys, which is generated by any normal install from the Ubuntu package. Here is a snippet from the file, generated by running cat /etc/X11/Xsession.d/98xbindkeys:

This file is sourced by Xsession(5), not executed.

PROG="/usr/bin/xbindkeys"
NOAUTO="${HOME}/.xbindkeys.noauto"

This file autostarts xbindkeysrc if the user (or system) has a config
for it AND does NOT Have a .xbindkeys.noauto in his homedir.

[The rest of the file is a script]

So, the simple solution is to take note of the instructions and place a file named .xbindkeys.noauto in your home directory, and then xbindkeys won't start up with your x session, and you can place an alternative startup entry for it with your specific needs.

  • Great, I'll try this out. Do you have any ideas why the auto-started one might fail? Does it use a different $HOME or user or something? – Espressofa Feb 25 '13 at 21:33
  • @Espressofa I'm not sure why the auto-started one should fail; it seems to work in Precise (12.04), and xbindkeys is the same version in both Precise and Quantal. –  Feb 25 '13 at 21:37
  • It's weird -- the process is running but pressing my bound keys seems to have no effect. It's launched as /usr/bin/xbindkeys /home/MY_USERNAME/.xbindkeysrc -- which is the location is xbindkeys and of my config file. When I launch with just xbindkeys it works fine. – Espressofa Feb 26 '13 at 02:14
  • OK, so I have a .xbindkeys.noauto now and it doesn't autostart, as expected. I put xbindkeys & in my .xsession file. That process is running but it's not working. If I run in a terminal kill xbindkeys; xbindkeys & then it works. – Espressofa Feb 27 '13 at 19:28
  • @Espressofa Try adding xbindkeys as a user startup item instead of putting it in your .xsessionrc. –  Feb 27 '13 at 19:37
  • Not sure what you mean by that. If it helps, I use xmonad, not Unity. – Espressofa Feb 27 '13 at 23:04
  • @Espressofa Ah, I see. Perhaps you need to delay xbindkeys starting up by using sleep or something like that. It's difficult for me to diagnose what the issue could be, if you know you have nothing else interfering with xbindkeys. –  Feb 27 '13 at 23:19
  • I tried putting sleep 3 && xbindkeys & into my .xsession -- it still doesn't work. – Espressofa Mar 04 '13 at 21:44
  • @Espressofa If the .xbindkeys.noauto worked, xbindkeys shouldn't be starting up elsewhere, so again, I'm not sure what to suggest about why xbindkeys is still malfunctioning when launched from the xsession file. You could try launching xbindkeys in its own session with setsid, although there's no reason it should work. Try starting xbindkeys with setsid xbindkeys in your xsession file instead of xbindkeys &. I'm sorry that I can do little more than guess at the moment. –  Mar 04 '13 at 23:45
  • Yeah, it's very strange. The .noauto did work. It's definitely starting up from my xsession fine. I'll try playing around with setsid. – Espressofa Mar 05 '13 at 03:38
0

I experienced the same problem when trying to get the touchpad on/off button working on my HP G60-530US laptop. When I login xbindkeys was running, killing xbindkeys & restarting xbindkeys would sometimes work. killing xbindkeys, running xbindkeys-config 'apply, save & exit' worked, but was pretty cumbersome.

Trying Mik's suggestion appeared to not work as I already had a 'xbindkeys' in my gnome-session-properties (gsp). I then remembered that just typing in the command in gsp often doesn't work; instead I click the 'browse' button and browsed to /usr/bin/xbindkeys to set the key. Logged out and logged backing and the mouse touchpad on/off buttons are now working properly.

HP G60-530US specific:

  1. relevant bits of ~/.xbindkeysrc (the rest of the file is default):

    #TouchpadOff - works
    "synclient TouchpadOff=1"
       0x1008ffb1
    
    #TouchpadOn - works
    "synclient TouchpadOff=2"
       0x1008ffb0
    
  2. .xbindkeys.noauto is present in user home profile:

    ~/.xbindkeys.noauto
    
  3. Enabled /usr/bin/xbindkeys was set using gnome-session-properties Startup Application Preferences. Important part (for me) was setting the command using the 'browse' button in the UI.

    Name: xbindkeys
    Command: /usr/bin/xbindkeys
    Comments: Touchpad on/off
    
Seth
  • 58,122
NoOp
  • 1
0

I had an issue with the same symptoms: xbindkeys appear to have been started, but no shortcut worked. After manually restarting xbindkeys from a shell it worked as expected.

My problem was that the commands tied to the shortcuts were dependent on my shell config (trying to start a Ruby command, but Ruby was loaded with asdf which is sourced in my .zshrc)

Solution was to replace the xbindkeys startup command from xbindkeys to /usr/bin/zsh -c "xbindkeys" and also move the asdf setup from .zshrc to .zshenv, since the latter is loaded even if no tty is present.

The startup command was editable from "Startup applications" in my Ubuntu 16.04.

-1

I dealt with this issue by running xbindkeys in terminal on startup! Add Terminal=true in your .desktop file.

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – Volker Siegel Jun 26 '15 at 12:46
  • @VolkerSiegel I believe this is an answer, the answerer says it solved the problem for him. – Seth Jun 26 '15 at 17:43
  • @VolkerSiegel It is indeed an answer and NOT a comment! I provided instructions (add Terminal=true to .desktop file that opens xbindkeys on startup, usually located under ~/.config/autostart) but due to the nature of the problem, I believe that it's a permission related bug in xbindkeys, I cannot be sure that it will work for everybody! – Dimitrios Charalampidis Jun 27 '15 at 13:45