summaryrefslogtreecommitdiffstats
path: root/StackSet.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-03-22 23:15:47 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-03-22 23:15:47 +0100
commit78b0adb5a1fd50642b2df05bd1353a7e5ecf4643 (patch)
treee98f665b9b6d0c812fc212fba4a46bbd5bade997 /StackSet.hs
parent3c8587dc97dd0a71fc0215f25bdbe253b78e520f (diff)
downloadmetatile-78b0adb5a1fd50642b2df05bd1353a7e5ecf4643.tar
metatile-78b0adb5a1fd50642b2df05bd1353a7e5ecf4643.zip
Add promote
darcs-hash:20070322221547-a5988-e45624fd50539d7db13cf34d2b1e94612bdb06e9
Diffstat (limited to 'StackSet.hs')
-rw-r--r--StackSet.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/StackSet.hs b/StackSet.hs
index 8103075..8f3493d 100644
--- a/StackSet.hs
+++ b/StackSet.hs
@@ -169,5 +169,11 @@ raiseFocus k w = case M.lookup k (cache w) of
Nothing -> w
Just i -> w { focus = M.insert i k (focus w) }
+-- | Move a window to the top of its workspace.
+promote :: Ord a => a -> StackSet a -> StackSet a
+promote k w = case M.lookup k (cache w) of
+ Nothing -> w
+ Just i -> w { stacks = M.adjust (\ks -> k : filter (/= k) ks) i (stacks w) }
+
elemAfter :: Eq a => a -> [a] -> Maybe a
elemAfter w ws = listToMaybe . filter (/= w) . dropWhile (/= w) $ ws ++ ws