There’s no good way to do this, your two bizarre hack-ish solutions are:
1. Use gconf and steal one of the metacity keybindings (like Automatix does)
2. Use Tomboy’s .so file (I forget the name), like gnome-do
1. Means that you potentially steamroller over user preferences unless you’re very careful, and you have a (small) chance of not being able to register a keybinding at all. 2. means that you need to depend on code from Tomboy, so you either have to depend on Tomboy directly (like gnome-do used to) or copy code from them and keep it updated manually (like gnome-do now does).
Probably a bit rough but the only thing that I can think of:
make the application remote controllable with libunique or dbus, provide it with some command line option to do what you want and bind those to metacity global keybindings setting the relevant keys in /apps/metacity/global_key_bindings and /apps/metacity/keybinding_commands.
Any better idea?
Kind of irrelevant, but one thing I don’t get is how Gnome’s keyboard shortcuts completely fail at using the super keys, but both Compiz Fusion and Gnome Do don’t have any trouble at all…
Thanks for this post! I discovered gnome-keybindings which right what I’m looking for.
No well, that wasn’t what I was looking for really. It’s only an entry in gnome-control-center, nothing more. I think i’ll go for the egg!
I don’t know, but the answer lies in the gnome-do source, which you are allowed to read. đ Tomboy, too.
Read the GNOME-do source code…
Hello,
Gnome-Do use a lib: libdo which does, I think, what you’re looking for. Check this file: http://bazaar.launchpad.net/~do-core/do/trunk/annotate/628?file_id=keybinder.c-20080218143923-igx29g94mjn48las-5
Hopes it helps.
Rno
Why don’t you grab the gnome-do source code and see for yourself? It’s in libdo, you might also want to take a look at tomboy’s they do it too.
The “correct” way is to register them in gnome-keybindings-properties like detailed in http://live.gnome.org/ControlCenter/ApplicationDefinedKeybindings
Please write a patch for gnome-do while you’re at it. đ
Hmm. Imagine if we could somehow see the source code of GNOME-do… That would be awesome! đ
I wrote a library to do exactly this. GtkHotkey: https://launchpad.net/gtkhotkey
There’s no good way to do this, your two bizarre hack-ish solutions are:
1. Use gconf and steal one of the metacity keybindings (like Automatix does)
2. Use Tomboy’s .so file (I forget the name), like gnome-do
1. Means that you potentially steamroller over user preferences unless you’re very careful, and you have a (small) chance of not being able to register a keybinding at all. 2. means that you need to depend on code from Tomboy, so you either have to depend on Tomboy directly (like gnome-do used to) or copy code from them and keep it updated manually (like gnome-do now does).
Probably a bit rough but the only thing that I can think of:
make the application remote controllable with libunique or dbus, provide it with some command line option to do what you want and bind those to metacity global keybindings setting the relevant keys in /apps/metacity/global_key_bindings and /apps/metacity/keybinding_commands.
Any better idea?
I think it’s with http://library.gnome.org/devel/gdk/stable/GdkDisplay.html#gdk-display-add-client-message-filter
http://live.gnome.org/ControlCenter/ApplicationDefinedKeybindings
Then there’s some copy-paste code available for actually capturing the key, look for tomboykeybinder.c
Kind of irrelevant, but one thing I don’t get is how Gnome’s keyboard shortcuts completely fail at using the super keys, but both Compiz Fusion and Gnome Do don’t have any trouble at all…
Thanks for this post! I discovered gnome-keybindings which right what I’m looking for.
No well, that wasn’t what I was looking for really. It’s only an entry in gnome-control-center, nothing more. I think i’ll go for the egg!