Subject: FVWM: Key bindings with modifiers

From: John Davin <[email-masked]>
Date: Fri, 28 Sep 2001 11:26:01 -0400 (EDT)

The fvwm FAQ mentions that the NumLock, CapsLock and Scrolllock keys act
as modifiers and will interfere with key bindings... I have experienced
this problem.  However, the FAQ just says to disable the keys or set
ignore.  Is there a way I can get my key bindings to still work when the
NumLock key is on (NumLock is the only one I care about, and I prefer to
have it on all the time but it doesn't go on automatically)?
For example, some of my key bindings in .fvwm2rc are:

Key 1 A M GotoPage 0 0
Key 2 A M GotoPage 1 0
Key 3 A M GotoPage 0 1
Key 4 A M GotoPage 1 1
Key Tab A M WindowList Root c c NoDeskSort

So alt-1 goes to 1st page of desktop 0, etc.
Is there a change I can make so that it works when NumLock is on?

-John

--
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: Erik Steffl <[email-masked]>
Date: Fri, 28 Sep 2001 16:24:50 -0700

> Is there a change I can make so that it works when NumLock is on?

  IMO the best solution is to have each keybinding that you want to work
the same way with or without numLock twice - once with numLock, once
without numLock.

  use xmodmap to find out wich modifier numLock is, on my machine
(linux, debian unstable) it looks like this:

jojda:~>xmodmap 
xmodmap:  up to 2 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x6d)
mod1        Alt_L (0x40),  Alt_R (0x71)
mod2        Num_Lock (0x4d)
mod3      
mod4        Meta_L (0x73)
mod5        Scroll_Lock (0x4e)

  as you can see numLock is modifier 2 (you can change it using xmodmap,
see man xmodmap), your keybindings would look like this:

Key 1 A M  GotoPage 0 0
Key 1 A M2 GotoPage 0 0
Key 2 A M  GotoPage 1 0
Key 2 A M2 GotoPage 1 0
Key 3 A M  GotoPage 0 1
Key 3 A M2 GotoPage 0 1
Key 4 A M  GotoPage 1 1
Key 4 A M2 GotoPage 1 1
Key Tab A M  WindowList Root c c NoDeskSort
Key Tab A M2 WindowList Root c c NoDeskSort

  it's kinda ugly, but it's quite flexible, you still can use numLock
and your keybindings work the way you want them. The other solution is
to disable numlock which is not acceptable to everyone...

  the other solution would be to have slightly more complicated syntax
for specifying modifiers in fvwm - adding a way to ignore modifiers for
given key binding, e.g. something like this:

Key 1 A M/2 GotoPage 0 0 

  all modifiers listed before slash would be required to be on, all
modifiers after slash would be ignored, all modifiers that are not
mentioned would be required to be off. Note that it's backward
compatible.

  not sure if it makes sense in overall fvwm design... of course,
something like that could be added as M4 macro (I guess, I don't use
it).

	erik