[xmonad] code for moving/resizing windows in xmonad wiki

Chengqi Song songcq at gmail.com
Fri Jul 31 09:46:36 EDT 2009


Dear All,

Just for your information:

http://haskell.org/haskellwiki/Xmonad/Config_archive

/lars' xmonad.hs
    Move/Resize windows using keyboard easily: 
    1. move window around using M-Arrows. 
    2. resize windows using C-Arrows. 
    3. Holding <Shift> to move/resize 2 pixels per step instead of 20 pixels. 
    Please find the lines below comment "-- moving floating window with key" to see details. 

Thanks to the powerful haskell, the definition for those 4*2*2 = 16 key bindings is quite simple:

    -- moving floating window with key
    [(c ++ m ++ k, withFocused $ f (d x))
         | (d, k) <- zip [\a->(a, 0), \a->(0, a), \a->(0-a, 0), \a->(0, 0-a)] ["<Right>", "<Down>", "<Left>", "<Up>"]
         , (f, m) <- zip [keysMoveWindow, \d -> keysResizeWindow d (0, 0)] ["M-", "M-S-"]
         , (c, x) <- zip ["", "C-"] [20, 2]]

I personally found it's very convenient. Hope it can help who want keybindings for moving/resizing windows.

lars


More information about the xmonad mailing list