@Matthew:
You could use something like `gtk_key_snooper_install()`[0] to get priority access to keys. It's deprecated because the GTK+ team don't care about edge cases where it's useful, or other reasons, but it should still work fine with GTK2/3 on all platforms, though I haven't tested it.
I'd rather not use deprecated functions, you never know what GTK might do with them in the future.
If you don't mind writing #ifdefs/platform-dependent code, you could use XLib and/or Win32 functions directly to grab the key events for the window. I don't believe Wayland protocol supports this (on principle), but it may be supported by some compositors in protocol extensions, not sure. I can think of a few ideas to do it with Geany/GTK+/plugin alone, but I'd have to test it out to see if would work at all.
Hmm, sounds a bit can-of-wormsy. I feel my solution is cleaner; needs only two extra statements in keybindings.c.
Cheers, Austin.