27

I'm running XFCE 4.12 on top of Gentoo with a 4.2.0 kernel. My PlayPause button on my keyboard used to work as a global hotkey for VLC. Now VLC won't even recognize the key. It does see "Alt + Media Play Pause" but not the key alone.

Is there a way to see if and what program might be capturing that key?

When I run xdotool key "XF86LogGrabInfo" the tail /var/log/Xorg.0.log file reads

[ 10138.690] (II) Printing all currently active device grabs:
[ 10138.690] (II) End list of active device grabs
  • @don_crissti thanks but that doesn't seem to answer anything. Is there another way of registering hotkeys? – Andrew Redd Feb 10 '16 at 22:45
  • @don_crissti It's related for sure but I don't think it's a duplicate. Listing all the grabs and finding one specific grabber isn't the same. The solution that's useful to Andrew is buried in a comment (because Andrew's problem isn't what I was asking). – Gilles Feb 10 '16 at 22:46
  • Yes running xdotool keydown "XF86AudioPlay"; xdotool key "XF86LogGrabInfo"; xdotool keyup "XF86AudioPlay"; sleep 1; tail /var/log/Xorg.0.log did it. For somehow google Chrome registered the hotkey. – Andrew Redd Feb 10 '16 at 23:21
18

To find out which app/program grabbed your key use the debug keysym XF86LogGrabInfo. Use xdotool to press keys + XF86LogGrabInfo at the same time e.g. in a terminal run

KEY=XF86AudioPlay
xdotool keydown ${KEY}; xdotool key XF86LogGrabInfo; xdotool keyup ${KEY} 

Then check for output with tail /var/log/Xorg.0.log
Note that with gnome 3/gdm and systemd this is no longer logged to Xorg.0.log (it's instead logged to the journal). In that case you could run

journalctl -f

and then in another terminal run the xdotool commands. Switch to the first terminal and you'll see something like

/usr/lib/gdm/gdm-x-session[629]: Active grab 0x40c0a58e (xi2) on device 'Virtual core keyboard' (3):
/usr/lib/gdm/gdm-x-session[629]: client pid 708 /usr/bin/gnome-shell
/usr/lib/gdm/gdm-x-session[629]: at 32595124 (from passive grab) (device frozen, state 6)
/usr/lib/gdm/gdm-x-session[629]: xi2 event mask for device 3: 0xc000
/usr/lib/gdm/gdm-x-session[629]: passive grab type 2, detail 0xac, activating key 172

In the above example the program (the client) that grabbed the key is gnome-shell.

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.