aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/Common.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Rahm/Desktop/Common.hs')
-rw-r--r--src/Rahm/Desktop/Common.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Rahm/Desktop/Common.hs b/src/Rahm/Desktop/Common.hs
index 926d5ff..5a5aecf 100644
--- a/src/Rahm/Desktop/Common.hs
+++ b/src/Rahm/Desktop/Common.hs
@@ -2,6 +2,7 @@ module Rahm.Desktop.Common where
import Prelude hiding ((!!))
+import Control.Monad (void)
import Control.Monad.Trans.Maybe
import XMonad.Actions.DynamicWorkspaces
import XMonad.Util.Run
@@ -42,6 +43,14 @@ masterWindow = MaybeT $ withWindowSet $ \ss ->
(a:_) -> return $ Just a
_ -> return Nothing
+windowsInWorkspace :: WorkspaceId -> X [Location]
+windowsInWorkspace wid =
+ withWindowSet $
+ return . concatMap (\ws ->
+ if S.tag ws == wid
+ then map (Location wid . Just) $ S.integrate' (S.stack ws)
+ else []) . S.workspaces
+
data WinPrompt = WinPrompt
instance XPrompt WinPrompt where
@@ -84,3 +93,11 @@ getCurrentWorkspace = withWindowSet $
\(S.StackSet (S.Screen (S.Workspace t _ _) _ _) _ _ _) -> do
return t
+getCurrentLocation :: X Location
+getCurrentLocation = do
+ ws <- getCurrentWorkspace
+ win <- withWindowSet (return . peek)
+ return (Location ws win)
+
+runMaybeT_ :: (Monad m) => MaybeT m a -> m ()
+runMaybeT_ = void . runMaybeT