How to find *why* I can't bind some keyboard shortcut (or which app took it)?
Solution 1:
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.
Solution 2:
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?) :-)
Solution 3:
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.