All XMonad shortcuts use the modifier key modMask
, which by default is bound to the left Alt key. Often however, we need another key.
XMonad has a so-called “modKey”. This is just one of the keyboard’s modifier keys ➡ Wiki modifier key chosen to be involved in all XMonad’s built-in shortcuts to not conflict with other shortcuts of our operating system.
This “modKey” appears in shortcut configurations as modMask
in
.|. shiftMask, xK_Return), spawn "xterm") ((modMask
in native Haskell notation or as M
in
"M-S-<Enter>", spawn "xterm") (
in an Emacs-like “EZ” notation. Both definitions represent a shortcut that opens a new terminal window when we press Mod + Shift + Enter at the same time.
More: In-depth XMonad shortcuts
See: XMonad shortcuts cheat sheet
See: XMonad shortcuts source code
See: The best editor: (Doom) Emacs
Change the modifier key
modMask
usually is the left Alt key, but to avoid conflict with other apps like Emacs, that also rely heavily on that key, many set it to the windows key:
-- myConfig :: XConfig
= def
myConfig
{ ..
= mod4Mask -- windows key
, modMask ..
}
myConfig
- Custom variable for our configured
XConfig
value. def
- The default
XConfig
value as configured by the XMonad authors. ➡ Source code def { modMask = mod4Mask }
- Haskell syntax to create a copy of
def
with our modifications. Here we replace the oldmodMask
value withmod4Mask
, which represents the Win key. ➡ Override notation
With this simple change we have “moved” all shortcuts to other key combination that hopefully don’t conflict with existing apps anymore. Of course we can choose any other modifier key.
More: In-depth XMonad shortcuts
The keyboard’s modifier keys are named mod1Mask
, mod2Mask
, etc. in XMonad ➡ Wiki modifier key and are usually bound to:
mod1Mask
|
Left Alt key. |
mod2Mask
|
Numlock Num key. |
mod3Mask
|
Undefined. |
mod4Mask
|
Win key, also called “Super key” in Linux. |
mod5Mask
|
“ISO_Level3_Shift” key. |
In a terminal you can run
$ xmodmap
..
mod1 Alt_L
mod2 Num_Lock
mod3
mod4 Super_L, Super_R
mod5 ISO_Level3_Shift
to find out to which keyboard key is assigned to which modifier key in your linux distribution.