Skip to content

lock masks

bakkeby edited this page Jul 1, 2024 · 2 revisions

By default in dwm the status of Caps Lock and Num Lock is ignored when handling keybindings.

To achieve this dwm will, for each button and key binding, subscribe to all four combinations of the Caps and Num Lock states, then when interpreting the key and button press events the lock states are discarded by the CLEANMASK macro.

This patch changes this logic so that a user can, if they so desire, have keybindings that are only active when the Caps Lock or Num Lock are active - while still ignoring the Caps Lock and Num Lock states for general keybindings.

As an example the following button bindings would allow the user to move and resize windows using only the mouse buttons when Caps Lock is on (i.e. no need to hold down a modifier key):

	{ ClkClientWin,         LockMask,       Button1,        movemouse,      {0} },
	{ ClkClientWin,         LockMask,       Button2,        togglefloating, {0} },
	{ ClkClientWin,         LockMask,       Button3,        resizemouse,    {0} },

The modifier for Num Lock is usually Mod2Mask, but check with xmodmap to be sure.

Download

Clone this wiki locally