Subject: FVWM: Using Windows keys as modifiers

From: Glen Lee Edwards <[email-masked]>
Date: Sun, 7 Oct 2001 09:42:44 -0500 (CDT)

Thanks to this list and the Red Hat list, I've been able to set up the Windows
keys on my keyboard as modifiers.  This is what I did:

               Add the following to ~/fvwm/.fvwm2rc

(These next lines modify the keys so that they're defined as modifiers. Note - I
had to use Super_L and Hyper_L as the modifiers because Super_R and Hyper_R when
added to Mod4 also added themselves to Mod3. Setting it this way allows me to
use the left window key and the right window key as separate modifiers)

######################## Initialization Functions ############################
AddToFunc InitFunction 	  "I" Module FvwmButtons
<edit>
+                         "I" Exec exec xmodmap -e 'keycode 115 = Super_L'
+                         "I" Exec exec xmodmap -e 'keycode 116 = Hyper_L'
+                         "I" Exec exec xmodmap -e 'keycode 117 = Menu'
+                         "I" Exec exec xmodmap -e 'add Mod3 = Super_L'
+                         "I" Exec exec xmodmap -e 'add Mod4 = Hyper_L'
<edit>

AddToFunc RestartFunction "I" Module FvwmButtons
<edit>
+                         "I" Exec exec xmodmap -e 'keycode 115 = Super_L'
+                         "I" Exec exec xmodmap -e 'keycode 116 = Hyper_L'
+                         "I" Exec exec xmodmap -e 'keycode 117 = Menu'
+                         "I" Exec exec xmodmap -e 'add Mod3 = Super_L'
+                         "I" Exec exec xmodmap -e 'add Mod4 = Hyper_L'
<edit>

To create shortcut keys with the above, I used the following:

# "3" stands for mod3 "4" for mod4 (xmodmap)
Key F1    A     3      gotoDesk 0 0
Key F2    A     3      gotoDesk 0 1
<etc>
Key KP_Enter    A     3      GotoDeskAndPage Prev
Key KP_Add      A     3      GotoDesk +1 0 24
Key KP_Subtract A     3      GotoDesk -1 0 24
<etc>
Key F1    A     4     MoveToDesk 0 0
Key F1    A     4     MoveToDesk 0 0
Key F2    A     4     MoveToDesk 0 1
<etc>
Key Left  A     3    GotoPage 0 0
Key Up    A     3    GotoPage 1 0
Key Right A     3    GotoPage 1 1
Key Down  A     3    GotoPage 0 1
<etc>
Key KP_Home     A     3      All (MyBar7) Iconify
Key KP_Up       A     3      All (MyBar4) Iconify
Key KP_Down     A     3      All (MyBar2) Iconify
Key KP_Right    A     3      All (MyBar1) Iconify
Key KP_Left     A     3      All (MyBar3) Iconify
Key KP_Begin    A     3      All (MyBar3) Iconify

               Notes

To get the above to work with this keyboard (having the left and right windows
keys act as separate modifiers) I had to set this keyboard in
/etc/X11/XF86Config to a pc101 keyboard.  Setting it to pc105 or microsoft (to
get the windows keys to automatically work) did work, but the windows keys
defaulted to the same modifier, meaning that I couldn't set them up as separate
modifiers.  Setting the keyboard to pc101 so that these keys weren't
automatically recognized allowed me to individually define them.

               Syntax

Here is my output from xmodmap:

$ 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        Super_L (0x73)
mod4        Hyper_L (0x74)
mod5        Scroll_Lock (0x4e)

To get Fvwm2 to recognize mod3 and mod4, I had to use the following syntax:

Key KP_Begin    A     3      All (MyBar3) Iconify

The "3" stands for Mod3.  I tried M3, m3, Mod3, and mod3, but only "3" was
recognized.  To use two modifiers I had to set it up as:

Key KP_Begin    A     M/3      All (MyBar3) Iconify

The above works if you hold down the left window key and left alt key
simultaneously while pressing the number 5 on the keypad.  If you remove the "/"
it won't work (been there, done that).

I'm using fvwm-2.4.0-2 on a Red Hat 7.0 system.

Glen
--
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: Ionel Mugurel Ciobîcă <[email-masked]>
Date: Sun, 7 Oct 2001 18:14:45 +0200

You could make also the PC104 or PC105 works by inserting a new line
+  "I" Exec exec xmodmap -e "clear Mod3" -e "clear Mod4"
before the add, or in just one line:

+  "I" Exec exec xmodmap -e "keycode 0x73 = Super_L" -e "keycode 0x74 = Hyper_L" -e "keycode 0x75 = Menu" -e "clear Mod3" -e "clear Mod4" -e "add Mod3 = Super_L" -e "add Mod4 = Hyper_L"

Ionel