mirror of
https://github.com/xmonad/xmonad.git
synced 2025-05-19 08:30:21 -07:00
add W.shiftMaster, fix float/tile-reordering bug
This commit is contained in:
parent
b605fd9fce
commit
74c6dd2721
@ -226,12 +226,12 @@ mouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ())
|
|||||||
mouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
|
mouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
|
||||||
-- mod-button1 %! Set the window to floating mode and move by dragging
|
-- mod-button1 %! Set the window to floating mode and move by dragging
|
||||||
[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w
|
[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w
|
||||||
>> windows W.swapMaster))
|
>> windows W.shiftMaster))
|
||||||
-- mod-button2 %! Raise the window to the top of the stack
|
-- mod-button2 %! Raise the window to the top of the stack
|
||||||
, ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
|
, ((modMask, button2), (\w -> focus w >> windows W.shiftMaster))
|
||||||
-- mod-button3 %! Set the window to floating mode and resize by dragging
|
-- mod-button3 %! Set the window to floating mode and resize by dragging
|
||||||
, ((modMask, button3), (\w -> focus w >> mouseResizeWindow w
|
, ((modMask, button3), (\w -> focus w >> mouseResizeWindow w
|
||||||
>> windows W.swapMaster))
|
>> windows W.shiftMaster))
|
||||||
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ module XMonad.StackSet (
|
|||||||
insertUp, delete, delete', filter,
|
insertUp, delete, delete', filter,
|
||||||
-- * Setting the master window
|
-- * Setting the master window
|
||||||
-- $settingMW
|
-- $settingMW
|
||||||
swapUp, swapDown, swapMaster, modify, modify', float, sink, -- needed by users
|
swapUp, swapDown, swapMaster, shiftMaster, modify, modify', float, sink, -- needed by users
|
||||||
-- * Composite operations
|
-- * Composite operations
|
||||||
-- $composite
|
-- $composite
|
||||||
shift, shiftWin,
|
shift, shiftWin,
|
||||||
@ -508,6 +508,15 @@ swapMaster = modify' $ \c -> case c of
|
|||||||
|
|
||||||
-- natural! keep focus, move current to the top, move top to current.
|
-- natural! keep focus, move current to the top, move top to current.
|
||||||
|
|
||||||
|
-- | /O(s)/. Set the master window to the focused window.
|
||||||
|
-- The other windows are kept in order and shifted down on the stack, as if you
|
||||||
|
-- just hit mod-shift-k a bunch of times.
|
||||||
|
-- Focus stays with the item moved.
|
||||||
|
shiftMaster :: StackSet i l a s sd -> StackSet i l a s sd
|
||||||
|
shiftMaster = modify' $ \c -> case c of
|
||||||
|
Stack _ [] _ -> c -- already master.
|
||||||
|
Stack t ls rs -> Stack t [] (reverse ls ++ rs)
|
||||||
|
|
||||||
-- | /O(s)/. Set focus to the master window.
|
-- | /O(s)/. Set focus to the master window.
|
||||||
focusMaster :: StackSet i l a s sd -> StackSet i l a s sd
|
focusMaster :: StackSet i l a s sd -> StackSet i l a s sd
|
||||||
focusMaster = modify' $ \c -> case c of
|
focusMaster = modify' $ \c -> case c of
|
||||||
|
@ -157,13 +157,15 @@ myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
|
|||||||
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
|
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
|
||||||
|
|
||||||
-- mod-button1, Set the window to floating mode and move by dragging
|
-- mod-button1, Set the window to floating mode and move by dragging
|
||||||
[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
|
[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w
|
||||||
|
>> windows W.shiftMaster))
|
||||||
|
|
||||||
-- mod-button2, Raise the window to the top of the stack
|
-- mod-button2, Raise the window to the top of the stack
|
||||||
, ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
|
, ((modMask, button2), (\w -> focus w >> windows W.shiftMaster))
|
||||||
|
|
||||||
-- mod-button3, Set the window to floating mode and resize by dragging
|
-- mod-button3, Set the window to floating mode and resize by dragging
|
||||||
, ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
|
, ((modMask, button3), (\w -> focus w >> mouseResizeWindow w
|
||||||
|
>> windows W.shiftMaster))
|
||||||
|
|
||||||
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
||||||
]
|
]
|
||||||
|
@ -528,6 +528,18 @@ prop_shift_reversible i (x :: T) =
|
|||||||
y = swapMaster x
|
y = swapMaster x
|
||||||
n = tag (workspace $ current y)
|
n = tag (workspace $ current y)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- shiftMaster
|
||||||
|
|
||||||
|
-- focus/local/idempotent same as swapMaster:
|
||||||
|
prop_shift_master_focus (x :: T) = peek x == (peek $ shiftMaster x)
|
||||||
|
prop_shift_master_local (x :: T) = hidden_spaces x == hidden_spaces (shiftMaster x)
|
||||||
|
prop_shift_master_idempotent (x :: T) = shiftMaster (shiftMaster x) == shiftMaster x
|
||||||
|
-- ordering is constant modulo the focused window:
|
||||||
|
prop_shift_master_ordering (x :: T) = case peek x of
|
||||||
|
Nothing -> True
|
||||||
|
Just m -> L.delete m (index x) == L.delete m (index $ shiftMaster x)
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- shiftWin
|
-- shiftWin
|
||||||
|
|
||||||
@ -933,6 +945,11 @@ main = do
|
|||||||
,("swapUp is local" , mytest prop_swap_left_local)
|
,("swapUp is local" , mytest prop_swap_left_local)
|
||||||
,("swapDown is local" , mytest prop_swap_right_local)
|
,("swapDown is local" , mytest prop_swap_right_local)
|
||||||
|
|
||||||
|
,("shiftMaster id on focus", mytest prop_shift_master_focus)
|
||||||
|
,("shiftMaster is local", mytest prop_shift_master_local)
|
||||||
|
,("shiftMaster is idempotent", mytest prop_shift_master_idempotent)
|
||||||
|
,("shiftMaster preserves ordering", mytest prop_shift_master_ordering)
|
||||||
|
|
||||||
,("shift: invariant" , mytest prop_shift_I)
|
,("shift: invariant" , mytest prop_shift_I)
|
||||||
,("shift is reversible" , mytest prop_shift_reversible)
|
,("shift is reversible" , mytest prop_shift_reversible)
|
||||||
,("shiftWin: invariant" , mytest prop_shift_win_I)
|
,("shiftWin: invariant" , mytest prop_shift_win_I)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user