diff options
Diffstat (limited to 'src/Rahm/Desktop/Keys')
| -rw-r--r-- | src/Rahm/Desktop/Keys/Wml.hs | 21 |
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 |