From c57a7f0db7dba41fd6851535845077adb08da18d Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 5 Feb 2020 10:47:33 -0700 Subject: Now any AlphaNumeric character can be a workspace --- src/Internal/Keys.hs | 14 +++++++++++--- src/Main.hs | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs index 3d0df0c..5313c12 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -26,10 +26,12 @@ newKeys = Map.fromList $ zip ['1'..] (XMonad.workspaces config) - gotoWorkspace :: Char -> X () gotoWorkspace ch = do saveLastMark markContext - mapM_ (windows . W.greedyView) (Map.lookup ch workspacesByInt) + windows $ W.greedyView $ return ch + + shiftToWorkspace ch = do + windows $ W.shift $ return ch in @@ -50,7 +52,8 @@ newKeys = (modm, xK_apostrophe) (jumpToLast markContext) (mapAlpha modm (jumpToMark markContext)))) - , ((modm, xK_g), (submap $ mapNumbers 0 gotoWorkspace)) + , ((modm, xK_g), (submap $ mapNumbersAndAlpha 0 gotoWorkspace)) + , ((modm .|. shiftMask, xK_g), (submap $ mapNumbersAndAlpha 0 shiftToWorkspace)) , ((modm .|. shiftMask, xK_bracketleft), sendMessage (IncMasterN (-1))) , ((modm .|. shiftMask, xK_bracketright), sendMessage (IncMasterN 1)) @@ -62,6 +65,11 @@ newKeys = , ((modm, xK_q), spawn "xmonad --recompile && xmonad --restart") ] +mapNumbersAndAlpha :: KeyMask -> (Char -> X ()) -> Map (KeyMask, KeySym) (X ()) +mapNumbersAndAlpha km fn = + mapNumbers km fn + <> mapAlpha km fn + mapNumbers :: KeyMask -> (Char -> X ()) -> Map (KeyMask, KeySym) (X ()) mapNumbers km fn = Map.fromList [ diff --git a/src/Main.hs b/src/Main.hs index 533a7a1..11d9eab 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -44,6 +44,7 @@ main = do , className =? "mpv" --> doFloat , className =? "gnubby_ssh_prompt" --> doFloat ] + , workspaces = map return (['0'..'9'] ++ ['a'..'z']) , handleEventHook = fullscreenEventHook } -- cgit