aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-04-19 21:33:51 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:46 -0600
commit29d59e1dbbf3d47247c10813432895cb60a458ab (patch)
treeb301ae4a705ab31dd87bff3f1a8cbee1f78cfdc5 /src/Rahm/Desktop
parentf052c5a0018f90b356a0b3ec295e86b2208e0921 (diff)
downloadrde-29d59e1dbbf3d47247c10813432895cb60a458ab.tar.gz
rde-29d59e1dbbf3d47247c10813432895cb60a458ab.tar.bz2
rde-29d59e1dbbf3d47247c10813432895cb60a458ab.zip
Add : object to reference floating windows
Diffstat (limited to 'src/Rahm/Desktop')
-rw-r--r--src/Rahm/Desktop/Keys/Wml.hs21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs
index 21b8c4c..babf3b5 100644
--- a/src/Rahm/Desktop/Keys/Wml.hs
+++ b/src/Rahm/Desktop/Keys/Wml.hs
@@ -21,6 +21,7 @@ import Control.Monad (join, forM_)
import Data.List (sortOn, intercalate)
import Data.Ord (Down(..))
+import qualified Data.Map as Map
import Data.Char (isAlphaNum, isAlpha, isDigit, ord)
import Data.Maybe (fromMaybe, catMaybes)
import XMonad.Actions.CopyWindow as CopyWindow
@@ -149,7 +150,7 @@ locationSetForStringT :: String -> MaybeT X [Location]
locationSetForStringT s = feedKeysT s readNextLocationSet
locationSetForString :: String -> X [Location]
-locationSetForString s = fromMaybe [] <$> (runMaybeT $ locationSetForStringT s)
+locationSetForString s = fromMaybe [] <$> runMaybeT (locationSetForStringT s)
-- Returns the next workspaces associated with the next set of keystrokes.
readNextWorkspace :: (KeyFeeder m) => MaybeT m Workspace
@@ -191,7 +192,7 @@ readNextWorkspace =
let (_, rest) = break (==workspaceName ws) (screens ++ screens)
- justWorkspace <$> (MaybeT $ return $ head $ tail $ rest)
+ justWorkspace <$> MaybeT (return $ head $ tail rest)
(_, _, ";") -> do
ws <- readNextWorkspace
@@ -202,14 +203,14 @@ readNextWorkspace =
let (front, _) = break (==workspaceName ws) (screens ++ screens)
- justWorkspace <$> (MaybeT $ return $ last $ front)
+ justWorkspace <$> MaybeT (return $ last front)
(_, _, "/") -> fromMaybeTX $ do
justWorkspace <$> ((MaybeT . workspaceWithWindow) =<< MaybeT ((head=<<) <$> askWindowId))
(_, _, "@") -> do
loc <- readNextLocationSet
- MaybeT (return $ (justWorkspace . locationWorkspace) <$> head loc)
+ MaybeT (return $ justWorkspace . locationWorkspace <$> head loc)
(_, _, " ") -> mt $
justWorkspace . accompaningWorkspace <$> getCurrentWorkspace
@@ -242,16 +243,22 @@ readNextLocationSet =
(_, _, "-") -> fromMaybeTX $
mapM windowLocation =<< lift getAlternateWindows
(_, _, "/") -> fromMaybeTX $
- (mapM windowLocation =<< MaybeT askWindowId)
+ mapM windowLocation =<< MaybeT askWindowId
(_, _, "%") -> fromMaybeTX $ do
ret <- mapM windowLocation =<< lift (withWindowSet (return . sortOn Down . W.allWindows))
lift $ logs $ "allWindows " ++ intercalate "\n" (map show ret)
return ret
(_, _, "@") ->
(mt . windowsInWorkspace . workspaceName) =<< readNextWorkspace
- (_, _, "!") -> (:[]) <$> (joinMaybe $ head <$> readNextLocationSet)
+ (_, _, "!") -> (:[]) <$> joinMaybe (head <$> readNextLocationSet)
(_, _, ",") -> tail <$> readNextLocationSet
(_, _, "~") -> reverse <$> readNextLocationSet
+ (_, _, ":") -> mt $
+ withWindowSet $
+ fmap catMaybes .
+ mapM (runMaybeT . windowLocation) .
+ Map.keys .
+ W.floating
(_, _, "?") -> do
l1 <- readNextLocationSet
l2 <- readNextLocationSet
@@ -268,7 +275,7 @@ readNextLocationSet =
(_, _, "&") -> do -- intersection
l1 <- readNextLocationSet
l2 <- readNextLocationSet
- return $ filter (flip elem l2) l1
+ return $ filter (`elem` l2) l1
_ -> MaybeT (return Nothing)
where