aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/Keys
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2023-12-13 12:40:15 -0700
committerJosh Rahm <rahm@google.com>2023-12-13 12:40:15 -0700
commit2604f0608d176d89a4e307c90a5f904b8d06921a (patch)
treeeb9c734597c2338c86d0ca7f4d4a05dab43e62f2 /src/Rahm/Desktop/Keys
parent4cdab9f06cd0ecf5ad7d5ee15dd83c4dc4eb396a (diff)
downloadrde-2604f0608d176d89a4e307c90a5f904b8d06921a.tar.gz
rde-2604f0608d176d89a4e307c90a5f904b8d06921a.tar.bz2
rde-2604f0608d176d89a4e307c90a5f904b8d06921a.zip
Add multi-select Rofi support and allow multiselect for windows.
Diffstat (limited to 'src/Rahm/Desktop/Keys')
-rw-r--r--src/Rahm/Desktop/Keys/Wml.hs25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs
index def3b27..5565c31 100644
--- a/src/Rahm/Desktop/Keys/Wml.hs
+++ b/src/Rahm/Desktop/Keys/Wml.hs
@@ -71,6 +71,11 @@ import qualified Data.Map as Map
import Data.Maybe (catMaybes, fromJust, fromMaybe)
import Data.Ord (Down (..))
import Data.Typeable (cast)
+-- getMostRecentLocationInHistory,
+
+-- pastHistory,
+
+import Rahm.Desktop.BorderColors (BorderColor (BorderColor), setBorderColor)
import Rahm.Desktop.Common
( Location (..),
askWindowId,
@@ -81,10 +86,8 @@ import Rahm.Desktop.Common
windowsInWorkspace,
)
import Rahm.Desktop.History
- ( -- getMostRecentLocationInHistory,
- lastLocation,
+ ( lastLocation,
nextLocation,
- -- pastHistory,
)
import Rahm.Desktop.Layout.PinWindow (pinnedWindows)
import Rahm.Desktop.Logger (LogLevel (Info, Trace), logs)
@@ -143,7 +146,6 @@ import XMonad
import XMonad.Prompt.ConfirmPrompt (confirmPrompt)
import qualified XMonad.Util.ExtensibleState as XS (get, modify, put)
import Prelude hiding (head, last)
-import Rahm.Desktop.BorderColors (setBorderColor, BorderColor (BorderColor))
type KeyString = [(KeyMask, KeySym, String)]
@@ -183,7 +185,6 @@ saveMacros = do
macros <- getMacros
io $ writeFile dataFile $ show macros
-
selColor = BorderColor "#ffff00" "#b8b880"
insertWorkspaceMacroString :: (KeyMask, KeySym) -> KeyString -> X ()
@@ -527,7 +528,7 @@ readNextWorkspace =
-- The workspace with the searched for window.
(_, _, "/") -> fromMaybeTX $ do
- justWorkspace <$> ((MaybeT . workspaceWithWindow) =<< MaybeT ((head =<<) <$> askWindowId))
+ justWorkspace <$> ((MaybeT . workspaceWithWindow) =<< MaybeT (head <$> askWindowId))
-- The workspace with the next read window on it.
(_, _, "@") -> do
@@ -583,6 +584,14 @@ readNextWorkspace =
mt :: (KeyFeeder m) => X a -> MaybeT m a
mt = lift . fromX
+nonempty :: (Monad m) => m [a] -> MaybeT m [a]
+nonempty l = MaybeT $ do
+ l
+ >>= ( \case
+ [] -> return Nothing
+ a -> return (Just a)
+ )
+
readNextLocationSet :: (KeyFeeder m) => MaybeT m [Location]
readNextLocationSet = do
(WindowSelect mp) <- MaybeT (Just <$> fromX XS.get)
@@ -640,7 +649,7 @@ readNextLocationSet' =
-- Search for the windows.
(_, _, "/") ->
fromMaybeTX $
- mapM windowLocation =<< MaybeT askWindowId
+ mapM windowLocation =<< nonempty askWindowId
-- All windows.
(_, _, "%") -> fromMaybeTX $ do
ret <- mapM windowLocation =<< lift (withWindowSet (return . sortOn Down . W.allWindows))
@@ -650,7 +659,7 @@ readNextLocationSet' =
-- Windows in a workspace
(_, _, s)
| s == "\t" || s == "@" || s == "\n" ->
- (mt . windowsInWorkspace) =<< readNextWorkspaceName
+ (mt . windowsInWorkspace) =<< readNextWorkspaceName
-- The first window in the next window set.
(_, _, "!") -> (: []) <$> joinMaybe (head <$> readNextLocationSet)
-- The windows except the first in a window set.