-- modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt"). You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
myModMask = mod1Mask
So change that last line tomyModMask = mod4Mask
and the windows key is now the xmonad mod key. But because my keyboard doesn't have a right windows key, and I like symmetry I want the menu key (the key with the cursor and drop down menu icon) to also function as my mod key. This can be done with the xmodmap command. First run xev from the terminal, which will pop up a blank window. While the blank window is the focus, keyboard events (presses and releases) will be captured and the information about them displayed in the terminal window that called xev. For example, this is the result when I press the menu key:
KeyPress event, serial 27, synthetic NO, window 0x1200001,
root 0x160, subw 0x0, time 29169837, (62,330), root:(741,331),
state 0x0, keycode 135 (keysym 0xff67, Menu), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 27, synthetic NO, window 0x1200001,
root 0x160, subw 0x0, time 29169893, (62,330), root:(741,331),
state 0x0, keycode 135 (keysym 0xff67, Menu), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
The important bit is the " (keysym 0xff67, Menu)", which is the keysim information. Now, run xmodmap to check the existing modifier keys.xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
This shows that Menu is not a modifier. I want to make the menu key function identical to the windows key (Super_L) such that either functions as mod key for xmonad. Do this in the following /home/USER/.xmodmap file.! Comments start with !
! translate Menu into Super_L keycodes.
keysym Menu = Super_L
Test with by running xmodmap .xmodmap command in the terminal, then pressing mod-q which 'restarts' xmonad but has no effect on the current display. However, the menu key should function as the mod key now. Add a call to xmodmap to .xinitrc to call this translation on startup.if [ -f $HOME/.Xresources]; then
xrdb -merge ~/.Xresources
fi
if [ -f $HOME/.xmodmap ]; then
/usr/bin/xmodmap $HOME/.xmodmap
fi
xmonad
Then reboot and test it out. Warning, I'm pretty sure this renders any bindings to the Menu keysym useless, but do not care since I never use it. Your needs may differ.
No comments:
Post a Comment