index.md - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       index.md (2074B)
       ---
            1 Change Mod1 key to the Windows key in config.h
            2 ==============================================
            3 dwm's documentation refers to Mod1 as the modifier key that you must press to
            4 issue commands to it. On most keyboards, Mod1 is mapped to the left Alt key.
            5 Most new keyboards now come equipped with the *Windows* key. Since no known
            6 UNIX/X applications are known to use the Windows key, it is an excellent
            7 alternative mapping to issue commands to dwm.
            8 
            9 In config.h, under the comment `/* key definitions */`, you can find the line
           10 
           11         #define MODKEY Mod1Mask
           12 
           13 In order to change dwm's modifier key to the Windows key, you can simply change
           14 its value definition to Mod4Mask.
           15 
           16         #define MODKEY Mod4Mask
           17 
           18 The following patch also produces the same result:
           19 
           20         --- a/config.def.h      Sun Jul 27 03:34:57 2008 +0100
           21         +++ b/config.def.h      Sun Jul 27 23:04:57 2008 +0100
           22         @@ -35,7 +35,7 @@
           23          };
           24         
           25          /* key definitions */
           26         -#define MODKEY Mod1Mask
           27         +#define MODKEY Mod4Mask
           28          #define TAGKEYS(KEY,TAG) \
           29                 { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
           30                 { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
           31 
           32 Can I use any other modifier key?
           33 ---------------------------------
           34 Yes. There are 5 modifiers, Mod1Mask to Mod5Mask. They are associated to up-to
           35 three keysyms (keycodes) from the X window server. To show the current
           36 association on your keyboard, run `xmodmap` with no arguments. It will show
           37 something like:
           38 
           39         $ xmodmap 
           40         xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):
           41         
           42         shift       Shift_L (0x32),  Shift_R (0x3e)
           43         lock        Caps_Lock (0x42)
           44         control     Control_L (0x25),  Control_R (0x6d)
           45         mod1        Alt_L (0x40),  Alt_L (0x7d),  Meta_L (0x9c)
           46         mod2        Num_Lock (0x4d)
           47         mod3      
           48         mod4        Super_L (0x7f),  Hyper_L (0x80)
           49         mod5        Mode_switch (0x5d),  ISO_Level3_Shift (0x7c)
           50 
           51 Using `xev`, a utility to show X events, such as key presses, we can quickly
           52 identify which keysym (keycode) combination a particular key has, and associate
           53 that to a modifier using `xmodmap`.