From 8486ce27943b1c0460bfcd6d93ed84d2b3c5afb5 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Mon, 29 Nov 2021 13:11:54 -0700 Subject: Add some changes. 1. Make the spotify control work for both Spotify and Spotifyd 2. Xmobar weather not break xmobar when not connected to the internet 3. Add g keybinding to go to the toogle-cased version of the current workspace. --- src/Internal/Keys.hs | 1 + src/Internal/Lib.hs | 11 +++++++++++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs index 89e2cf1..2905ba0 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -141,6 +141,7 @@ keymap = runKeys $ do justMod $ mapNextString $ \_ str -> case str of [ch] | isAlphaNum ch -> gotoWorkspace ch + [' '] -> gotoAccompaningWorkspace _ -> return () shiftMod $ mapNextString $ \_ str -> case str of diff --git a/src/Internal/Lib.hs b/src/Internal/Lib.hs index c3bdeb9..3beb640 100644 --- a/src/Internal/Lib.hs +++ b/src/Internal/Lib.hs @@ -64,6 +64,17 @@ getHorizontallyOrderedScreens windowSet = where screens = current windowSet : visible windowSet +getCurrentWorkspace :: X WorkspaceName +getCurrentWorkspace = withWindowSet $ + \(StackSet (Screen (Workspace t _ _) _ _) _ _ _) -> do + return (head t) + +gotoAccompaningWorkspace :: X () +gotoAccompaningWorkspace = do + cur <- getCurrentWorkspace + if isUpper cur + then gotoWorkspace (toLower cur) + else gotoWorkspace (toUpper cur) gotoWorkspace :: WorkspaceName -> X () gotoWorkspace ch = do -- cgit