GNOME Bugzilla – Bug 410758
Should be pluggable
Last modified: 2007-03-19 15:18:36 UTC
The current arch is very static, and compiled in. We should have a plugin system for application to allow desktop-wide shortcuts (useful for Beagle, and Tomboy), as well as a way to check whether a particular window manager is running, so we can add compiz/beryl support to the app. I'm thinking simple xml files (with translations), actions <-> associated GConf key, and a way to check which window manager is running (for compiz/beryl support).
There are already some functions for window manager detection in capplets/common/wm-common.{c,h}
Created attachment 83118 [details] [review] gcc-pluggable-bindings.patch A braindump. It will parse .xml files in the current directory, and add them to the tree. It doesn't support section names, or using the ".data". Here's an exaample file: <?xml version="1.0" encoding="UTF-8" ?> <KeyListEntries> <KeyListEntry name="/apps/gnome_settings_daemon/keybindings/help" visibility="ALWAYS_VISIBLE" data="1" /> </KeyListEntries>
Created attachment 83172 [details] [review] gcc-pluggable-bindings-2.patch Take 2. Loads the section name from the .xml, loads ".data" correctly, some bits of conditions support added (which actually work in our case, but only because we currently have some builtin support). This is an updated file.xml: <?xml version="1.0" encoding="UTF-8" ?> <KeyListEntries name="My not so supa-test"> <Condition name="N_WORKSPACES_GT" key="/apps/metacity/general/num_workspaces" comparison="gt" /> <KeyListEntry name="/apps/gnome_settings_daemon/keybindings/help" visibility="ALWAYS_VISIBLE" data="1" /> <KeyListEntry name="/apps/metacity/window_keybindings/move_to_workspace_12" visibility="N_WORKSPACES_GT" data="11" /> <KeyListEntry name="/apps/metacity/window_keybindings/move_to_workspace_5" visibility="N_WORKSPACES_GT" data="4" /> </KeyListEntries>
Should the window manager name be in there somewhere? Or would you just install a separate file per wm?
(In reply to comment #4) > Should the window manager name be in there somewhere? Or would you just install > a separate file per wm? I have that code on my HD now. You can put the window manager's expected name in the .xml file.
Created attachment 83647 [details] [review] gcc-pluggable-bindings-3.patch Another patch, with some of the keybindings implemented. I have a problem with some of the keybindings being window manager dependent, but in the same section as "always" keybindings. Need to fix that...
Created attachment 83655 [details] [review] gcc-pluggable-bindings-4.patch All fixed up. We now get: - XML files-based definition for keybindings - Per-window manager keybindings (no more hacking the sources) - Conditional appearance supporting any GConf key with an integer type - Ability to prioritise entries/sections, through the filenames The Metacity XML files obviously need to go in Metacity itself. But until then, this patch ensures feature-parity. There's only one FIXME in the code. The path to find the XML file needs to be the install pkgdatadir.
Created attachment 83656 [details] test.c The gruesome piece of code used to generate the metacity xml.in file.
I just realised that the code I attached wouldn't be able to translate .xml files from other modules properly. Need to add a package name in the .xml file, and use dgettext.
Created attachment 83952 [details] [review] gcc-pluggable-bindings-5.patch Allows the "package" property in XML files to set the package that should be used to translate the section name.
Committed to trunk! 2007-03-19 Bastien Nocera <hadess@hadess.net> * capplets/keybindings/00-multimedia-key.xml.in: * capplets/keybindings/01-desktop-key.xml.in: * capplets/keybindings/50-metacity-desktop-key.xml.in: * capplets/keybindings/50-metacity-key.xml.in: * capplets/keybindings/Makefile.am: * capplets/keybindings/gnome-keybinding-properties.c: (create_dialog), (should_show_key), (count_rows_foreach), (ensure_scrollbar), (append_keys_to_tree), (parse_start_tag), (append_keys_to_tree_from_file), (reload_key_entries), (setup_dialog): * po/POTFILES.in: Make all the keybindings be external to the keybindings capplet itself. This allows applications to add their own keybindings without recompilation (Closes: #410758)