Skip to main content

How do I figure out what the keys are called?

Check out the manpage of xdotool using man xdotool or an online version, as it lists a number of the special keys. For instance, "alt+r", "Control_L+J", "ctrl+alt+n", "BackSpace". The LinuxQuestions wiki also has a list of X Keysyms one could use. To make things a bit easier, xdotool also has aliases for some of these, such that pressing Shift-Alt-Tab would for instance just be shift+alt+Tab. To verify that this does indeed click that key combination, you could send the input to xev, which is a program that will print whatever key or mouse events it gets to the console. Just do sleep 2; xdotool keydown ${KEY} and switch to the xev window before two seconds has passed to see the keys being clicked on that window. It should then output a series of events, such as these:

PropertyNotify event, serial 168, synthetic NO, window 0x1e00001, atom 0x13e (_GTK_EDGE_CONSTRAINTS), time 4390512, state PropertyNewValue MappingNotify event, serial 168, synthetic NO, window 0x0, request MappingKeyboard, first_keycode 8, count 248 KeyPress event, serial 168, synthetic NO, window 0x1e00001, root 0x163, subw 0x0, time 4390719, (882,657), root:(1000,771), state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyPress event, serial 169, synthetic NO, window 0x1e00001, root 0x163, subw 0x0, time 4390738, (882,657), root:(1000,771), state 0x8, keycode 23 (keysym 0xff09, Tab), same_screen YES, XLookupString gives 1 bytes: (09) " " XmbLookupString gives 1 bytes: (09) " " XFilterEvent returns: False 

How do I figure out what the keys are called?

Check out the manpage of xdotool using man xdotool or an online version, as it lists a number of the special keys. For instance, "alt+r", "Control_L+J", "ctrl+alt+n", "BackSpace". The LinuxQuestions wiki also has a list of X Keysyms one could use. To make things a bit easier, xdotool also has aliases for some of these, such that pressing Shift-Alt-Tab would for instance just be shift+alt+Tab. To verify that this does indeed click that key combination, you could send the input to xev, which is a program that will print whatever key or mouse events it gets to the console. Just do sleep 2; xdotool keydown ${KEY} and switch to the xev window before two seconds has passed to see the keys being clicked on that window. It should then output a series of events, such as these:

PropertyNotify event, serial 168, synthetic NO, window 0x1e00001, atom 0x13e (_GTK_EDGE_CONSTRAINTS), time 4390512, state PropertyNewValue MappingNotify event, serial 168, synthetic NO, window 0x0, request MappingKeyboard, first_keycode 8, count 248 KeyPress event, serial 168, synthetic NO, window 0x1e00001, root 0x163, subw 0x0, time 4390719, (882,657), root:(1000,771), state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyPress event, serial 169, synthetic NO, window 0x1e00001, root 0x163, subw 0x0, time 4390738, (882,657), root:(1000,771), state 0x8, keycode 23 (keysym 0xff09, Tab), same_screen YES, XLookupString gives 1 bytes: (09) " " XmbLookupString gives 1 bytes: (09) " " XFilterEvent returns: False 
added 748 characters in body
Source Link
don_crissti
  • 85.7k
  • 31
  • 234
  • 262

To find out which app/program grabbed your key use the debug keysym XF86LogGrabInfoXF86LogGrabInfo. UseUse xdotool to press keys + XF86LogGrabInfo at the same time, see falconer's post here ; In e.g. in a terminal run

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

Then check for output inwith 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.

To find out which app grabbed your key use the debug keysym XF86LogGrabInfo. Use xdotool to press keys + XF86LogGrabInfo at the same time, see falconer's post here ; In a terminal run

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

Then check for output in tail /var/log/Xorg.0.log.

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.

Filled out the response to completely explain the solution without having to go to links.
Source Link

To find out which app grabbed your key you could use the debug keysym XF86LogGrabInfo. Use xdotool to press keys + XF86LogGrabInfo at the same time, see XF86LogGrabInfofalconer's post here; ; In a terminal run

sleepKEY=XF86AudioPlay;\ xdotool 2;keydown ${KEY}; \ xdotool key "XF86LogGrabInfo"XF86LogGrabInfo; \ xdotool keyup ${KEY}; 

and then immediately start pressing that particular key repeatedly, thenThen check for output in tail /var/log/Xorg.0.log.

Or use xdotool to press keys + XF86LogGrabInfo at the same time, see falconer's post here

To find out which app grabbed your key you could use the debug keysym XF86LogGrabInfo; run

sleep 2; xdotool key "XF86LogGrabInfo" 

and then immediately start pressing that particular key repeatedly, then check for output in /var/log/Xorg.log.

Or use xdotool to press keys + XF86LogGrabInfo at the same time, see falconer's post here

To find out which app grabbed your key use the debug keysym XF86LogGrabInfo. Use xdotool to press keys + XF86LogGrabInfo at the same time, see falconer's post here ; In a terminal run

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

Then check for output in tail /var/log/Xorg.0.log.

Must be the head cold
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 266
Loading
added 10 characters in body
Source Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k
Loading
Source Link
don_crissti
  • 85.7k
  • 31
  • 234
  • 262
Loading