From c9159878868bea1fcc7d40d85f09cb29428ba0d5 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 3 Aug 2022 15:27:34 -0600 Subject: Actually, change the workspace conditional operator. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was ?&s@.'@s This reads as, if (?) the intersection between the Spotify window and the windows on the current workspace (&s@.) is not empty (if spotify is on the current window), go to the last workspace ('), otherwise go to the workspace Spotify is on (@s). --- src/Rahm/Desktop/Keys/Wml.hs | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index 647234c..9074b66 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -291,27 +291,18 @@ readNextWorkspace = then ws3 else ws4 - (_, _, "<") -> do - lift . fromX $ - logs Trace "Doing thing" + -- ?&s@.'@s - l1 <- map locationWindow <$> readNextLocationSet - - lift . fromX $ - logs Trace "%s" (show l1) - - l2 <- map locationWindow <$> readNextLocationSet + (_, _, "?") -> do + l1 <- readNextLocationSet ws1 <- readNextWorkspace ws2 <- readNextWorkspace - (lift . fromX) $ (logs Trace "%s < %s? %s" (show l1) (show l2) (show $ all (`elem`l2) l1) :: X ()) - (lift . fromX) $ (logs Trace "%s %s" (show $ workspaceName ws1) (show $ workspaceName ws2)) - return $ - if all (`elem`l2) l1 - then ws1 - else ws2 + if null l1 + then ws2 + else ws1 (mask, keysym, _) -> do macro <- (MaybeT . fromX) (Map.lookup (mask, keysym) . workspaceMacros <$> XS.get) -- cgit From 6122cd030e03945382dad927c32a259c077bd468 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 3 Aug 2022 15:49:24 -0600 Subject: Add check for xK_Escape to end trynig ot type a Wml object. --- src/Rahm/Desktop/Keys/Wml.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index 9074b66..34dabd2 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -214,6 +214,8 @@ readNextWorkspace :: (KeyFeeder m) => MaybeT m Workspace readNextWorkspace = readNextKey $ \mask sym str -> case (mask, sym, str) of + (_, e, _) | e == xK_Escape -> MaybeT $ return Nothing + (_, _, [ch]) | isAlphaNum ch || ch == '*' -> return $ justWorkspace [ch] (_, _, "[") -> justWorkspace <$> @@ -291,14 +293,14 @@ readNextWorkspace = then ws3 else ws4 - -- ?&s@.'@s - (_, _, "?") -> do l1 <- readNextLocationSet ws1 <- readNextWorkspace ws2 <- readNextWorkspace + mt $ logs Trace "If not empty %s then %s else %s" (show l1) (show $ workspaceName ws1) (show $ workspaceName ws2) + return $ if null l1 then ws2 @@ -315,6 +317,8 @@ readNextLocationSet :: (KeyFeeder m) => MaybeT m [Location] readNextLocationSet = readNextKey $ \mask sym str -> case (mask, sym, str) of + (_, e, _) | e == xK_Escape -> MaybeT $ return Nothing + (_, _, [ch]) | isAlpha ch -> mt $ getMarkedLocations [ch] (_, _, "0") -> (:[]) <$> MaybeT (fromX getMostRecentLocationInHistory) (_, _, [ch]) | isDigit ch -> -- cgit From 539bbd4045c010bedc785f5859e29b03814b5796 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 3 Aug 2022 16:04:48 -0600 Subject: Add preferred window for some Workspace jumps. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wml workspace @w refers to the workspace that contains the window marked 'w', however when jumping to that workspace, an arbitrary window is focused. It's more intuitive to set focus to the window 'w'. This means that @• is the same as •. --- src/Rahm/Desktop/Keys/Wml.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index 34dabd2..d6289bd 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -94,6 +94,22 @@ justWorkspace s = , extraWorkspaceData = () } +justWorkspaceWithPreferredWindow :: Window -> String -> Workspace +justWorkspaceWithPreferredWindow w s = + Workspace { + moveLocationToWorkspaceFn = flip moveLocationToWorkspace s + , gotoWorkspaceFn = do + windows $ \ws' -> + let ws = W.greedyView s ws' + l = W.integrate' $ W.stack $ W.workspace $ W.current ws in + if w `elem` l + then W.focusWindow w ws + else ws + + , workspaceName = Just s + , extraWorkspaceData = () + } + blackHoleWorkspace :: Workspace blackHoleWorkspace = Workspace { @@ -272,7 +288,7 @@ readNextWorkspace = MaybeT $ fromX $ withWindowSet $ \ws -> return $ do win <- locationWindow =<< head loc winLocation <- W.findWindow ws win - (justWorkspace . W.tag) <$> W.getLocationWorkspace winLocation + (justWorkspaceWithPreferredWindow win . W.tag) <$> W.getLocationWorkspace winLocation (_, _, "~") -> justWorkspace . accompaningWorkspace <$> readNextWorkspaceName -- cgit From ad4024b1c688531fca783736cefcdc79d0a1b411 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 3 Aug 2022 16:18:53 -0600 Subject: Jumping to the black hole workspace will exit Xmonad (with confirmation). --- src/Rahm/Desktop/Keys/Wml.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index d6289bd..7cff173 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -22,6 +22,8 @@ import Control.Monad (join, forM_, unless) import Data.List (sortOn, intercalate) import Data.Ord (Down(..)) import Data.Typeable (cast) +import XMonad.Prompt.ConfirmPrompt (confirmPrompt) +import System.Exit (exitWith, ExitCode(..)) import qualified Data.Map as Map import Data.Map (Map) @@ -114,7 +116,8 @@ blackHoleWorkspace :: Workspace blackHoleWorkspace = Workspace { moveLocationToWorkspaceFn = mapM_ killWindow . locationWindow - , gotoWorkspaceFn = return () -- can't navigate to black hole + , gotoWorkspaceFn = + confirmPrompt def "Do you want to exit xmonad" $ io (exitWith ExitSuccess) , workspaceName = Nothing , extraWorkspaceData = () } -- cgit From 9bd7b8fd7e15ff0a1b1114fb459066ebf90616c0 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Fri, 12 Aug 2022 10:08:27 -0600 Subject: Disable swallow by default --- src/Rahm/Desktop/Swallow.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Rahm/Desktop/Swallow.hs b/src/Rahm/Desktop/Swallow.hs index 1939c58..a411b3f 100644 --- a/src/Rahm/Desktop/Swallow.hs +++ b/src/Rahm/Desktop/Swallow.hs @@ -26,4 +26,4 @@ toggleSwallowEnabled :: X () toggleSwallowEnabled = (setSwallowEnabled . not) =<< isSwallowEnabled instance ExtensionClass DisableSwallow where - initialValue = DisableSwallow False + initialValue = DisableSwallow True -- cgit