Subject: FVWM: Key bindings

From: Piotr Zielinski <[email-masked]>
Date: Mon, 22 Mar 2004 21:29:58 +0000

Hi,

I would like to achieve the following effects:

1. I'd like to have the FvwmButtons window raised when Super_L is
   pressed, and lowered when it's not.  It seems to me that this
   requires a way of assigning a command to a key release event.  Is
   this possible in fvwm? Or is creating a fake menu with the
   SelectOnRelease option the only method?

2. If the above is impossible to achieve, I'd like the Super_L key to
   act as a lower/raise toggle for the FvwmButtons window (this one I
   can do).  In addition, whenever Alt or Control is pressed,
   FvwmButtons should be lowered.  The problem I have with this is
   that if I assign a keybinding to these keys, they are no longer
   passed to the application, which breaks some programs (eg xterm).
   Is there a way of passing the intercepted key to the application?
   I fiddled with FakeKeypress but it didn't seem to work.

Thanks,

Piotr

--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Scott Smedley <[email-masked]>
Date: Wed, 24 Mar 2004 02:55:40 +1100

Hi Piotr,

: I would like to achieve the following effects:
: 
: 1. I'd like to have the FvwmButtons window raised when Super_L is
:    pressed, and lowered when it's not.  It seems to me that this
:    requires a way of assigning a command to a key release event.  Is
:    this possible in fvwm?

Unfortunately FVWM only allows you to bind to key _press_ events.

If you're trying to keep your buttonbar on top of all your xterms etc,
you may want to try the 'StaysOnTop' style or try an autohiding
buttonbar like I do. (See Q7.17 in the FVWM FAQ.)

: 2. If the above is impossible to achieve, I'd like the Super_L key to
:    act as a lower/raise toggle for the FvwmButtons window (this one I
:    can do).  In addition, whenever Alt or Control is pressed,
:    FvwmButtons should be lowered.  The problem I have with this is
:    that if I assign a keybinding to these keys, they are no longer
:    passed to the application, which breaks some programs (eg xterm).
:    Is there a way of passing the intercepted key to the application?

I recently implemented a patch to allow window-specific key-bindings (to
avoid problems like these), hopefully it will be added to FVWM soon.

Bye,

SCoTT. :)

---

From: Piotr Zielinski <[email-masked]>
Date: Tue, 23 Mar 2004 16:57:58 +0000

Piotr> I'd like to have the FvwmButtons window raised when Super_L is
Piotr> pressed, and lowered when it's not.

Scott> If you're trying to keep your buttonbar on top of all your
Scott> xterms etc, you may want to try the 'StaysOnTop' style or try
Scott> an autohiding buttonbar like I do. 

For lowering FvwmButtons (almost) exactly when Super_L is released, 
I came up with the following solution.

DestroyFunc RaiseBar
AddToFunc RaiseBar
+ I	  Next (FvwmButtons) Layer 0 6

DestroyFunc LowerBar
AddToFunc LowerBar
+ I	  Next (FvwmButtons) Layer 0 2

DestroyFunc SuperPress
AddToFunc SuperPress
+ I	  RaiseBar
+ I	  SuperTest

DestroyFunc SuperTest
AddToFunc SuperTest
+ I	  NoWindow FakeKeypress depth 1 press F12
+ I	  Schedule 50 10 SuperTest

DestroyFunc SuperDepress
AddToFunc SuperDepress
+ I	  LowerBar
+ I	  Deschedule 10   # 10-> periodic testing for super

Key Super_L	A	A	SuperPress
Key F12		A	N	SuperDepress

Basically, when Super_L has been pressed, this code moves FvwmButtons
to Layer 6 (top), and start testing (every 50ms) whether Super_L is
still pressed.  When it's not, FvwmButtons is moved back to Layer 2
(bottom).  The only way of testing I could come up with was sending a
fake keypress even and intercepting it if no modifiers are used.  Is
there a better way?

By the way, the NoWindow modifier in SuperTest is necessary. I'm not
sure why.

I'm a bit worried about using the Schedule command here.  The manual
says that the scheduled command is executed in the same window
context.  How is this implemented?  My experiments show that even if
scheduled with a very long delay, a command is executed immediately
when I move the mouse pointer out of the window.  Therefore, I'm
surprised (positively) that the above code does not generate an
infinite loop (that would hang fvwm) when I move the mouse pointer
from one window to another while Super_L is pressed.

Scott> I recently implemented a patch to allow window-specific
Scott> key-bindings (to avoid problems like these), hopefully it will
Scott> be added to FVWM soon.

Cool.

Thanks,

Piotr

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 29 Mar 2004 11:47:09 +0200

> avoid problems like these), hopefully it will be added to FVWM soon.

Hm, I thought I was waiting for a new version of your patch...

Ciao

Dominik ^_^  ^_^

---

From: Scott Smedley <[email-masked]>
Date: Mon, 29 Mar 2004 23:13:25 +1000

Hi Dominik,

> Hm, I thought I was waiting for a new version of your patch...

Ah bugger! I just realised that that modified patch got lost in a fatal system
crash a month back - I'm not sure if I've got a backup. Don't worry,
either way I'll get a patch to you soon.

Thanks for reminding me.

SCoTT. :)

---

From: Ukpong Ukpong <[email-masked]>
Date: Tue, 30 Mar 2004 08:09:52 +0100 (BST)

Agh this will be so use full please try and implement it

---

From: Scott Smedley <[email-masked]>
Date: Tue, 30 Mar 2004 17:42:58 +1000

Hi,

: Agh this will be so use full please try and implement it 

: > > > I recently implemented a patch to allow window-specific key-bindings (to
: > > > avoid problems like these), hopefully it will be added to FVWM soon.

I actually managed to post the modified patch just before my system crash.
If you want to try it it's here:

http://www.hpc.uh.edu/fvwm/archive/0403/msg00054.html

It still applies cleanly against CVS.

Example of usage is here:

http://www.hpc.uh.edu/fvwm/archive/0403/msg00000.html

SCoTT. :)