15

In short: is there (under Unity) any way to find out which application grabbed some global shortcut? I do not ask for "standard shortcuts" but for some way to get information about actual shortcuts (which app is actually keeping given key just now in my current config)

Longer story:

I have repeatable problems with managing keyboard shortcuts. At the moment:

  • Synapse sometimes (*) can't bind Win-Space as it's activation shortcut, reporting "Failed to register hotkey 'activate' with signature 'space'" (what usually means that this shortcut is already taken)

    (*) After one login it works, after another login it does not. I suspect some race between two apps…

  • F9 for some reason makes my screen slightly darker (and F9 does not reach application-level shortcuts so for example my byobu menu does not work)

I tried looking at various places, and:

  • I do not see any of those shortcuts in Keyboard settings/Shortcuts

  • I can't find them in gconf-editor (I tried searching for F9 in values in particular, nothing found)

  • I could not find them in dconf-editor (there is no search so I clicked some most obvious paths)

So my question is: is there any way to ask unity/dconf/gconf/d-bus/whatever about current global hotkeys allocation (which process is keeping which key). Or force logging those allocations to some log file. Or grep them from somewhere. Or………

4
  • Could you clarify or define (for the purpose of this question) what is meant by global shortcut?
    – user25656
    Mar 7, 2013 at 17:06
  • The key which I press and which causes something unrelated to the currently active window to happen. For example global shortcut Win-S opens expo view, global shortcut Alt-Tab switches windows, F12 (in my setup) opens tilda drop-down terminal etc etc. And, as I said, whenever I press F9, the screen dims, and I have no clue which app does that and why. And something sometimes grabs Win-space. And in the past I happened to see F12 taken away from tilda (luckily this problem went away). So I'd be happy to have some way to examine those keyboard allocations.
    – Mekk
    Mar 7, 2013 at 17:33
  • I think F9 might activate the widgets overlay, but it's been done time since I've been on Unity. Maybe look for that in CCSM..?
    – Rasmus
    Dec 1, 2014 at 23:09
  • Look at askubuntu.com/questions/101226/… or wiki.ubuntu.com/Keybindings or superuser.com/questions/152367/… - There are described several locations e.g. in dconf or gconf where Unity stores its shortcuts. Maybe you would like to check these pages for any new information?
    – Byte Commander
    Jan 2, 2017 at 12:50

3 Answers 3

2

Between 12.10 and 17.04 the Ubuntu desktop is actually Compiz and Unity itself is just a Compiz plugin.

If you, instead, set and enable the Compiz "commands" plugin and set keyboard shortcuts using CCSS where there is a conflict, CCSM should alert you to what plugin is causing the conflict and should also provide options to disable the conflicting plugin or conflicting keybinding before applying your settings.

Personally, I've also experienced difficulty setting keyboard shortcuts in 14.04+ but ever since I decided to start using the CCSM plugin instead of the keyboard shortcut settings in Unity, I have not experienced any issues whatsoever and all my shortcuts work just fine and so strongly suggest you at least check it out as an option.

1

Now I understand what you need...

sudo apt-get install evtest

Enjoy disembowling Ubuntu USB HID events!

Warning This does not work on PS2/style keyboards... (but who uses there any more anyway?) :-)

5
  • Not fully solving my problem, but surely useful. Still, I am curious what is the place where those active bindings are actually kept and whether it can be introspected (gsettings are place they are read from by many apps, but not every app must use gsettings...)
    – Mekk
    Dec 7, 2014 at 8:55
  • If you give me the output of the above command, I can help you... If you want to know why, I advise you to read: wiki.archlinux.org/index.php/Extra_keyboard_keys and then you'll appreciate it works at all!!! ;-)
    – Fabby
    Dec 7, 2014 at 10:41
  • This article is not quite what I am asking about - I do not ask how keys are translated from physical keypresses to symbols (albeit this is also interesting and sometimes confusing). I ask simpler thing: which program actually keeps and applies global keyboard shortcuts, and whether there exist any kind of util or API which would let me introspect or trace those assignments.
    – Mekk
    Dec 9, 2014 at 10:33
  • (when I start unity, it registers Alt-F2, Alt-F4, Win-S etc etc. when I start synapse it registers Win-space, when I start yakuake it registers F12 etc etc - two latter according to my config - but what is the place they register those keys in and how to access this place?)
    – Mekk
    Dec 9, 2014 at 10:35
  • Oooh... Now I see... There is something called evtest but that does USB stuff only! On the other hand, that's exactly what you need if you use a laptop or a desktop without PS/2 style keyoard!
    – Fabby
    Dec 9, 2014 at 20:18
1

From one of my older answers:

First you have to install xdotool:

sudo apt-get install xdotool

I made up a series of commands to show us the passive grabs on a keystroke. For example to see what is grabbing the Shift+PrintScreen combo, you can use the below "script":

xdotool keydown "shift+Print"; xdotool key "XF86LogGrabInfo"; xdotool keyup "Print"; sleep 1; xdotool keyup "shift"; tail /var/log/Xorg.0.log

This will trigger Shift+PrtSc keyevent and on a default Ubuntu install will show gnome-settings-daemon grabbing the keyboard. At least this worked on my older 12.04 install, but looks like on a 14.04 I had to use this:

xdotool key "shift+Print"; sleep 1; xdotool key "XF86LogGrabInfo"; xdotool keyup "Print"; sleep 1; xdotool keyup "shift"; tail /var/log/Xorg.0.log

but

xdotool keydown "F12"; xdotool key "XF86LogGrabInfo"; xdotool keyup "F12"; tail /var/log/Xorg.0.log

still works, sometimes, and not other times. Don't know why.

You just have to modify the above "script" by changing the keys which have to be simulated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .