Re: Global keybindings in GNOME



Cc'ing Dan and David, because they brought something like this up at
GUADEC (in the mini metacity/compiz meeting, I think?) and I thought
they had some good ideas for it.  I don't remember the details,
though...

On 8/6/06, Havoc Pennington <hp redhat com> wrote:
Nigel Tao wrote:
>
> Would it make sense to have a single D-Bus service where tomboy,
> deskbar, metacity, etc. (and don't forget our KDE friends) can just
> say "notify me on <Alt>F12", or is that just total crack and should we
> just have a traditionally linked libkeybinder instead?

metacity can't do this because its keybindings are not just "run some
action on key press" - it relies on getting the implicit key grab and
thus release events and so forth. i.e. it has to do the XGrabKey() itself.

Yeah, IIRC, in those discussions at GUADEC when we were discussing
where the keybindings would be centered, David also said that it would
probably need to be the WM.

Since the WM has by far the most global bindings and also needs to
actually grab them, metacity historically has been responsible for
GNOME's global bindings, e.g. it also sets up the panel's bindings and
forwards them to the panel as required.

By putting the bindings in the one WM process the idea was to keep a
centrally maintained global binding set.

Unfortunately, we didn't actually do that, or at least didn't keep
things that way.  We have almost half the global keybindings
controlled by gnome-settings-daemon, with most of the others
controlled by metacity or compiz.  This has confused lots of people to
this day...even including me.  :)  Especially now that other apps want
global keybindings and aren't doing them through metacity or
gnome-settings-daemon and are instead hardcoding their own.  It's a
little mini-nightmare for people to figure out why certain keybindings
work and others don't (and where to file bugs when certain ones
don't).

Just having an API to register bindings doesn't really get you far; the
X server already offers that API, it's called XGrabKey() and it fails if
two apps try to use the same binding. So the question is what else would
a D-Bus service offer.

We have a nifty control center dialog that allows users to set or
unset keybindings to certain actions.  And they are updated instantly
(i.e. the relevant application, be it metacity or compiz or
gnome-settings-daemon) is notified of the change.  That's something
XGrabKey() doesn't offer.  Unfortunately, global keybindings created
by other apps confusingly aren't listed there.  And there's no way to
get them to relinquish a key grab that they shouldn't have taken (the
two random apps break each other scenario), whereas a central
registration mechanism might help us avoid or fix this.  Dan may have
had other ideas in mind besides just this as well, I'm not sure.

Since bindings are a global resource really there are two options for
avoiding conflict:
  - foist it off on users - when they install an offending app, a dialog
    comes up like "this app wants to bind F12. the desktop has already
    bound F12" then the user chooses F11 instead and a new dialog is all
    "such-and-such already has F11. try again!" and so forth...
    not good.
  - have a centrally maintained list of global bindings that don't
    conflict

The second I'd hope is what GNOME does at least, even if third party
apps don't. The KISS way to do that is just the WM register them all,
there may be more complex solutions also.

I think the gripe is that GNOME only partially does the second.  I'd
also like to see  us actually do the second, though I've personally
been too busy as of late (dissertation needs to be done soon...) to
help others do this.


Elijah



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]