Is there a place in "Ubuntu" that stores a complete list of what keys/combinations/shortcuts are bound to what?
What are Unity's keyboard and mouse shortcuts? list some "Unity" shortcuts to the Dash, Launcher, etc. and How to list Compiz keybindings in use? shows a way to list compiz bindings, but I'm looking for more than that (not just a few of the keybindings limited only to Unity or Compiz) although it's a start.
Is there a global list of key bindings/key combinations/keyboard Shortcuts in use, that is stored somewhere in Ubuntu or is there a way to compile and list them? One that applies to Ubuntu and things running in it (Unity, Compiz, Shortcuts to Programs, etc.).
Surely, Ubuntu must store this somewhere for the key combination pressed on the keyboard to be directed to what it's connected with? If there is no such place in Ubuntu, then post so as an answer, so future users, that search, will know.
Since Ubuntu 17.10
On this paths:
You can also use
dconf-editor
(GUI) orgsettings
(CLI).Since Ubuntu 12.10-17.04
~/.config/dconf/user
(in dconf-editor:org.gnome.settings-daemon.plugins.media-keys.custom-keybindings
(custom shortcuts)~/.config/compiz-1/compizconfig
Until Ubuntu 12.04
The shortcuts are placed differently depending on witch desktop you are using (gnome/unity, kde, xfce, lxde,etc).
For gnome, they are under
~/.gconf/desktop/gnome/keybindings
(custom shortcuts)and under
~/.gconf/apps/metacity
.Your window manager gets the any key events before applications do, so if it wants to consume those events, it does so and your applications will never receive them. If the window manager does not want to react to the key events itself, it passes them along to the application.
You can verify this by yourself in the following way:
xev | grep KeyPress
, the X event viewer.Alt
, note thatxev
shows that it got the key event in its terminal window.Ctrl
, again note thatxev
got the event. Take note of what the terminal window looks like right now.Left arrow
to go to another workspace. (I'm assuming you have that as a window manager shortcut key.)Right arrow
to go back to where you are runningxev
. Note that it never received any key events for you switching workspaces via left and right arrow keys -- the output is the same as it was in Step 4.So you see that the window manager in practice gets all key events and if it does not want to capture them, it passes them along to the application. The application then gets to do the same for its own widgets (like how you can press
Enter
all day long in your web browser but it won't do anything until you put the cursor in the address bar or some field where you can enter text).It is up to the application to set its own shortcuts, and applications are configured independently of each other.
In KDE 3.x, if I recall correctly, you could set the default shortcuts (e.g.
Ctrl-s
for save) in the KDE Control Center and it would apply to all applications written with the Qt toolkit, but I don't know if that's still possible since their switch to KDE 4.No, there is no single place where all shortcuts are stored. Applications can choose to store their configurations wherever they choose.
That said, you're mostly looking at two levels: the application level (like Ctrl-C for copy in Firefox), and the window manager level (like Win+D to show the desktop). Compiz uses gconf to store its configuration.
For applications, you can roughly divide them by their toolkits. Namely, GTK apps use gconf too.
Not quite. The focussed application gets first kick at an X keyboard event, but if it doesn't, it bubbles up to other applications, namely the window manager. Thus, you can have a game that captures Alt+F4 and doesn't close the window (damn you, Jamestown!). I think you're thinking it goes to some central event router, then matched against some database, and routed to its destination. It's more like passing a bottle of drink around: pass, take a swig if you want and pass the rest, or take the whole thing and be greedy.
The Linux/FOSS environment (you may have noticed) is pretty democratic, and getting all applications to agree on a single central keyboard configuration repository is a fool's errand. For one thing, you've got unmaintained applications that were written a long time ago and wouldn't know about it.
Update: According to the Xlib docs on the subject:
Also,
And you can set an attribute to disable propagation.
The problem is, you don't tell X which keys to listen for, so you can never tell a priori what keys the application listens for (let alone what they do) or really whether they intend to propagate it up if they are in fact listening for it. Thus, a central registry is impossible at the X level, so you'd have to do it at the toolkit level, which is merely practically impossible. :D
Applications store their shortcuts independently, so there is no central place, where they are stored.
I don't understand the whole process of the interaction keyboard--OS--kernel--X11--Window Manager--Desktop Environment--Applications, but if a certain window, like Gedit, has the keyboard focus, it can handle the input on its own, and it does so.
In 11.10, under System Configuration -> Keyboard -> Shortcuts you get a pretty big list of them. Is that what you are looking for?