[Sawfish] Re: Sawfish popup menu key binding?

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


From: "GSR - FR" <famrom@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: Sawfish popup menu key binding?
Date: Sun, 12 Jul 2020 23:03:50 +0200

> Hi,
> sawfish@xxxxxxxxxx (2020-07-06 at 2131.32 +0200):
>> From: Petter Gustad <sawfish@xxxxxxxxxx>
>> Subject: Sawfish popup menu key binding?
>> Date: Sun, 09 Dec 2018 13:51:56 +0100 (CET)
>> 
>> > 
>> > Is it possible to customize the key binding in the popup menus?
>> > 
>> > I've written this function which I'm using to popup a menu of window
>> > names of certain types:
>> > 
>> > (defun popup-menu-of (pred)
>> >   "make popup windows of a certain type"
>> >   (popup-menu 
>> >    (mapcar #'(lambda (w) 
>> >                (list (window-name w) 
>> >                      (lambda () 
>> >                        (uniconify-window w)
>> >                        (x-raise-window w)
>> >                        (set-input-focus w))))
>> >            (filter pred (managed-windows)))))
>> > 
>> > I can then use the arrow keys to select the entry I want.
>> > 
>> > But I would like to use C-n and C-p rather than the arrow keys. How
>> > can I bind different keys to the popup-menu?
>> > 
>> > Thanks!
>> > Best regards
>> > //Petter
>> 
>> Does anybody know how keybindings are specified in popup menus?
> 
> Hmmm... maybe you missed the replies then? The menus are handled by
> GTK, v2 in Sawfish case.

Sorry if I've missed some previous replies.

> GTK2 Emacs bindings support C-n/C-p, so it can be done, using that
> keyboard theme or copying the relevant parts.
> 
> ---8<---
> binding "gtk-emacs-menu"
> {
>   bind "<ctrl>n" { "move-current" (next) }
>   bind "<ctrl>p" { "move-current" (prev) }
>   bind "<ctrl>f" { "move-current" (child) }
>   bind "<ctrl>b" { "move-current" (parent) }
> }
> ...
> class "GtkMenuShell" binding "gtk-emacs-menu"
> --->8---

I added this:

$ cat ~/.gtkrc-2.0 
gtk-key-theme-name = "Emacs"

And restarted sawfish, and now I'm able to navigate using emacs keys.

Thanks!

Best regards,
//Petter


-- 
Sawfish ML


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/