diff options
author | Karsten Schoelzel <kuser@gmx.de> | 2007-09-10 13:38:35 +0200 |
---|---|---|
committer | Karsten Schoelzel <kuser@gmx.de> | 2007-09-10 13:38:35 +0200 |
commit | 0ddfabc605c890cda31fe7104cedaa6b6684ed25 (patch) | |
tree | 9c7cb8c119d3b90f14e3f0a01bcf6f45771ad7be | |
parent | 3ff93a4b9482f5e3392649b0ae214fcf43fe32aa (diff) | |
download | xmonad-0ddfabc605c890cda31fe7104cedaa6b6684ed25.tar.gz xmonad-0ddfabc605c890cda31fe7104cedaa6b6684ed25.tar.xz xmonad-0ddfabc605c890cda31fe7104cedaa6b6684ed25.zip |
Add delete' for use in shift
Rename delete to delete' so we can clear floating status in delete,
thus removing one special handling.
At the moment delete' is only used in shift, but is useful for temporarily
removing a window from the stack.
darcs-hash:20070910113835-eb3a1-39397766e3c6b9428f69cd8c1bd316cdd20cedcb.gz
-rw-r--r-- | Operations.hs | 6 | ||||
-rw-r--r-- | StackSet.hs | 15 |
2 files changed, 11 insertions, 10 deletions
diff --git a/Operations.hs b/Operations.hs index 9d20841..d7f6639 100644 --- a/Operations.hs +++ b/Operations.hs @@ -66,15 +66,11 @@ manage w = whenX (fmap not $ isClient w) $ withDisplay $ \d -> do -- | unmanage. A window no longer exists, remove it from the window -- list, on whatever workspace it is. -- --- FIXME: clearFloating should be taken care of in W.delete, but if we do it --- there, floating status is lost when moving windows between workspaces, --- because W.shift calls W.delete. --- -- should also unmap? -- unmanage :: Window -> X () unmanage w = do - windows (W.sink w . W.delete w) + windows (W.delete w) setWMState w 0 {-withdrawn-} modify (\s -> s {mapped = S.delete w (mapped s), waitingUnmap = M.delete w (waitingUnmap s)}) diff --git a/StackSet.hs b/StackSet.hs index bd7a6fa..48006dd 100644 --- a/StackSet.hs +++ b/StackSet.hs @@ -26,7 +26,7 @@ module StackSet ( focusWindow, tagMember, member, findIndex, -- * Modifying the stackset -- $modifyStackset - insertUp, delete, filter, + insertUp, delete, delete', filter, -- * Setting the master window -- $settingMW swapMaster, swapUp, swapDown, modify, modify', float, sink, -- needed by users @@ -453,9 +453,14 @@ insertUp a s = if member a s then s else insert -- * otherwise, delete doesn't affect the master. -- delete :: (Ord a, Eq s) => a -> StackSet i a s sd -> StackSet i a s sd -delete w s = s { current = removeFromScreen (current s) - , visible = map removeFromScreen (visible s) - , hidden = map removeFromWorkspace (hidden s) } +delete w = sink w . delete' w + +-- only temporarily remove the window from the stack, thereby not destroying special +-- information saved in the Stackset +delete' :: (Ord a, Eq s) => a -> StackSet i a s sd -> StackSet i a s sd +delete' w s = s { current = removeFromScreen (current s) + , visible = map removeFromScreen (visible s) + , hidden = map removeFromWorkspace (hidden s) } where removeFromWorkspace ws = ws { stack = stack ws >>= filter (/=w) } removeFromScreen scr = scr { workspace = removeFromWorkspace (workspace scr) } @@ -495,5 +500,5 @@ swapMaster = modify' $ \c -> case c of shift :: (Ord a, Eq s, Eq i) => i -> StackSet i a s sd -> StackSet i a s sd shift n s | n `tagMember` s && n /= curtag = maybe s go (peek s) | otherwise = s - where go w = view curtag . insertUp w . view n . delete w $ s + where go w = view curtag . insertUp w . view n . delete' w $ s curtag = tag (workspace (current s)) |