GTK (and I think QT also) has a fairly intuitive system for binding keys to commands: Control 3 is just "<Ctrl>3"
. However when you want to bind a key with Shift, things get tricky. I had tried "<Ctrl><Shift>3"
, and "<Ctrl>#"
, and "<Ctrl><Shift>#"
, all without success.
To make this particular keybinding work, you have to use the special X11 keysym name for that key. I found permanent url that describes these keys here, and a better list with printable characters here.
So for my example, the proper binding would be "<Ctrl><Shift>numbersign"
.
However keybindings like this are very tricky and shouldn’t be used in production applications (this example is a personal plugin for GEdit). This is because keyboards in other countries have different symbols over different numbers. So it’s not a given that Shift-3 is the same as numbersign in every country.