aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/StackSet.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Rahm/Desktop/StackSet.hs')
-rw-r--r--src/Rahm/Desktop/StackSet.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Rahm/Desktop/StackSet.hs b/src/Rahm/Desktop/StackSet.hs
index 7793ec5..2dc8787 100644
--- a/src/Rahm/Desktop/StackSet.hs
+++ b/src/Rahm/Desktop/StackSet.hs
@@ -1,6 +1,7 @@
module Rahm.Desktop.StackSet
( masterWindow,
allVisibleWindows,
+ differentiateWithFocus,
concatMapTiledWindows,
windowsOnWorkspace,
findWorkspace,
@@ -262,6 +263,13 @@ modifyWorkspace tag fn =
else ws
)
+differentiateWithFocus :: (Eq a) => a -> [a] -> Maybe (Stack a)
+differentiateWithFocus _ [] = Nothing
+differentiateWithFocus thing lst =
+ case break (==thing) lst of
+ (up, foc:down) -> Just $ Stack foc (reverse up) down
+ _ -> differentiate lst
+
getFocusedWindow :: StackSet i l a s sd -> Maybe a
getFocusedWindow (StackSet cur _ _ _) = W.focus <$> (W.stack . W.workspace) cur