nix-config/modules/home-manager/desktop-xmonad/xmonad/lib/Utils.hs

16 lines
500 B
Haskell
Raw Normal View History

2022-01-18 09:32:55 +01:00
module Utils ( mkSubmap ) where
import qualified Data.Map as M ( fromList )
import XMonad ( (.|.) )
import Graphics.X11.Types ( KeyMask , KeySym , ButtonMask )
import XMonad.Core ( X )
import XMonad.Actions.Submap ( submap )
mkSubmap :: ButtonMask -> [((KeyMask, KeySym), X ())] -> X ()
mkSubmap modm = submap . M.fromList . concatMap buildSubmaps
where
buildSubmaps x = map (buildSubmap x) [0,modm]
buildSubmap ((modKey,key),action) m = ((modKey .|. m,key),action)