diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-04-18 01:31:22 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-04-18 01:31:22 -0600 |
| commit | dac3bec93f90b58d1bf97e81d992651b1cf83458 (patch) | |
| tree | 3ebc893496656d477a07dd02b5e6b36b69c29f8b /src/Rahm/Desktop/Common.hs | |
| parent | 9dc562c177fef4ad3b25bfac348c21a6c57839f5 (diff) | |
| download | rde-dac3bec93f90b58d1bf97e81d992651b1cf83458.tar.gz rde-dac3bec93f90b58d1bf97e81d992651b1cf83458.tar.bz2 rde-dac3bec93f90b58d1bf97e81d992651b1cf83458.zip | |
Add basic language for moving windows around
Diffstat (limited to 'src/Rahm/Desktop/Common.hs')
| -rw-r--r-- | src/Rahm/Desktop/Common.hs | 17 |
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 |