Skip to content

Instantly share code, notes, and snippets.

@lisael
Last active September 27, 2017 09:56
Show Gist options
  • Save lisael/47e6d637de6fb94365d9f1ef8f0ba646 to your computer and use it in GitHub Desktop.
Save lisael/47e6d637de6fb94365d9f1ef8f0ba646 to your computer and use it in GitHub Desktop.
inputMode :: [( (KeyMask, KeySym), (X () ) )] -> X ()
inputMode xs = do
submap . M.fromList $ modeMap where
modeMap = [ ( ( km, ks ), do x
(submap . M.fromList $ modeMap) )
| ( ( km, ks ), x ) <- xs
] ++ [((0, xK_Escape), return ())]
moveMode =
[ ((0, xK_h), withFocused (keysMoveWindow (-15,0) ) )
, ((0, xK_l), withFocused (keysMoveWindow (15,0) ) )
, ((0, xK_k), withFocused (keysMoveWindow (0,-15) ) )
, ((0, xK_j), withFocused (keysMoveWindow (0,15) ) )
, ((controlMask, xK_h), withFocused (keysMoveWindow (-1,0) ) )
, ((controlMask, xK_l), withFocused (keysMoveWindow (1,0) ) )
, ((controlMask, xK_k), withFocused (keysMoveWindow (0,-1) ) )
, ((controlMask, xK_j), withFocused (keysMoveWindow (0,1) ) )
, ((0, xK_Tab), focusDown )
]
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
[ ...
-- floating: move and resize with h, j, k, l. These are modes. Just hit modm+g and then
-- use plain h,j,k,l. Hit Esc when done
, ((modm, xK_g), inputMode moveMode)
...
]
@lisael
Copy link
Author

lisael commented Sep 27, 2017

@byorgey: I totally re wrote the thing to make it a function. BTW your tip is still useful to generate the movMode mapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment