[xmonad] submapDefault patch - default action for submaps

Stacey Sheldon stac at solidgoldbomb.org
Wed May 6 00:19:28 EDT 2009


I just noticed that my first reply didn't make it back to the list since
I wasn't subscribed.  I can confirm that the submapDefaultFixLeak patch
patch fixes the issue for me.  I no longer see keypresses leaking from
the submap.

In case anyone is interested, here are my keybindings for
moving/resizing floating windows.  Just invoke floatsub from some
initial keybinding and then use arrows or vi or emacs bindings to
move/resize the windows.  Hit enter or escape to break out of the submode.

floatsub = submapDefault floatsub floatsublist
floatsublist = M.fromList $
  [ -- Window floating stuff
      ((0, xK_Return), return ())
    , ((0, xK_Escape), return ())
    , ((0, xK_t     ), withFocused $ windows . W.sink)

    -- arrow bindings
    , ((0,         xK_Left  ), moveFloatLeft)
    , ((0,         xK_Right ), moveFloatRight)
    , ((0,         xK_Up    ), moveFloatUp)
    , ((0,         xK_Down  ), moveFloatDown)
    , ((shiftMask, xK_Left  ), shrinkFloatRight)
    , ((shiftMask, xK_Right ), expandFloatRight)
    , ((shiftMask, xK_Up    ), shrinkFloatBottom)
    , ((shiftMask, xK_Down  ), expandFloatBottom)

    -- vi bindings
    , ((0,         xK_h     ), moveFloatLeft)
    , ((0,         xK_l     ), moveFloatRight)
    , ((0,         xK_k     ), moveFloatUp)
    , ((0,         xK_j     ), moveFloatDown)
    , ((shiftMask, xK_h     ), shrinkFloatRight)
    , ((shiftMask, xK_l     ), expandFloatRight)
    , ((shiftMask, xK_k     ), shrinkFloatBottom)
    , ((shiftMask, xK_j     ), expandFloatBottom)

    -- emacs bindings
    , ((0,         xK_b     ), moveFloatLeft)
    , ((0,         xK_f     ), moveFloatRight)
    , ((0,         xK_p     ), moveFloatUp)
    , ((0,         xK_n     ), moveFloatDown)
    , ((shiftMask, xK_b     ), shrinkFloatRight)
    , ((shiftMask, xK_f     ), expandFloatRight)
    , ((shiftMask, xK_p     ), shrinkFloatBottom)
    , ((shiftMask, xK_n     ), expandFloatBottom)
  ] where
    moveFloatLeft     =
        (withFocused (keysMoveWindow   (-20,  0))) >> floatsub
    moveFloatRight    =
        (withFocused (keysMoveWindow   ( 20,  0))) >> floatsub
    moveFloatUp       =
        (withFocused (keysMoveWindow   (  0,-20))) >> floatsub
    moveFloatDown     =
        (withFocused (keysMoveWindow   (  0, 20))) >> floatsub
    shrinkFloatRight  =
        (withFocused (keysResizeWindow (-10,  0) (0,0))) >> floatsub
    expandFloatRight  =
        (withFocused (keysResizeWindow ( 10,  0) (0,0))) >> floatsub
    shrinkFloatBottom =
        (withFocused (keysResizeWindow (  0,-10) (0,0))) >> floatsub
    expandFloatBottom =
        (withFocused (keysResizeWindow (  0, 30) (0,0))) >> floatsub

Note that this only works properly with the submapDefaultFixLeak patch
from Anders:
  http://www.haskell.org/pipermail/xmonad/2009-April/007821.html

Stacey.



More information about the xmonad mailing list