Re: Adding new global keybindings from an extension



On mar, 2012-02-07 at 00:24 +1300, Malcolm Locke wrote:
> I've got most of the way, but I'm struggling to work out how to set up
> global keybindings.  At the moment I'm trying to do this, basade on the
> code in js/ui/main.js:
> 
>   global.stage.connect('captured-event', _keyPressHandler);
> 
> My _keyPressHandler() checks if the event was a key press, and if it was
> within the range super+1 to super+9.  However, the event never seems to
> get triggered, unless I have the ALT+F2 command dialog open.  I'm
> presuming another callback bound to this event is halting the execution
> of subsequent callbacks.

Is that in the overview or outside? There are basically two input modes
- "normal" and "shell". The former uses X events directly and only works
if no global keyboard grab is in place; the latter uses Clutter events
and only works while the shell has grabbed the keyboard.

Keybindings should be defined using global.display.add_keybinding() -
the problem with that is that those keybindings won't work in the
overview (see _globalKeyPressHandler() in main.js for what we do to make
some keybindings available there). A second key press handler like the
one you are using can be used to work around that for now, but we should
probably add some allow_keybinding_in_overview() API for that case ...


Regards,
Florian



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