diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Rahm/Desktop/Keys.hs | 266 |
1 files changed, 81 insertions, 185 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index db0d7fb..4fdddac 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -190,22 +190,6 @@ keymap = runKeys $ do spawnX "pkill -SIGUSR1 xmobar" bind xK_F1 $ do - -- Experimental. Sends 'a' to all windows. - -- - -- I've discovered that many clients ignore such synthetic events, including - -- Spotify, Chrome and Gedit. Some, like Chrome, seem to honor them if it's - -- focused. It's pretty annoying because it keeps me from doing some cool - -- things all for BS security theater, but I guess there might be some way - -- to do this via XTest? - shiftMod $ - withWindowSet $ - mapM_ - ( \w -> do - logs Info "Try send to %s" (show w) - sendKey (0, xK_a) w - ) - . W.allWindows - justMod $ doc "Print this documentation" @@ -218,12 +202,6 @@ keymap = runKeys $ do X () ) - bind xK_F7 $ - justMod $ - doc - "Print this documentation." - (logs Info "%s" (documentation (keymap config)) :: X ()) - bind xK_F10 $ do justMod playPauseDoc @@ -236,10 +214,6 @@ keymap = runKeys $ do bind xK_Return $ do justMod swapMaster - bind xK_Tab $ do - justMod $ windows W.focusDown - shiftMod $ windows W.focusUp - -- Switch between different screens. These are the leftmost keys on the home -- row in a Dvorak layout. One might want to switch these to ASD for QWERTY. forM_ (zip [xK_a, xK_o, xK_e] [0 ..]) $ \(key, idx) -> @@ -254,7 +228,7 @@ keymap = runKeys $ do withScreen W.greedyView idx -- Move the current window to the select screen. shiftMod $ - doc ("Move the current window to screne " ++ show idx) $ + doc ("Move the current window to screen " ++ show idx) $ withScreen W.shift idx altgrMod @@ -291,7 +265,7 @@ keymap = runKeys $ do bind xK_g $ do justMod $ doc - "Goto/Send/Etc To a workspace\n\n\t\ + "Goto To a workspace\n\n\t\ \Workspacs are alphanumeric characters. So if the next key typed is an\n\t\ \alphanumeric character, that's the workspace to operate on\n\n\ \\tThe following special characters can also reference workspaces:\n\t\t\ @@ -312,24 +286,16 @@ keymap = runKeys $ do $ pushPendingBuffer "g " $ runMaybeT_ $ (lift . gotoWorkspaceFn) =<< readNextWorkspace - controlMod $ - doc "Restore the desktop marked with the next typed character." $ - pushPendingBuffer "C-g " $ - runMaybeT_ $ do - mapNextString $ \_ str -> lift $ - case str of - [ch] | isAlpha ch -> restoreDesktop [ch] - _ -> return () - - -- shiftMod $ - -- doc "Swap a workspace with another workspace." $ - -- runMaybeT_ $ - -- lift . windows . uncurry W.swapWorkspaces =<< - -- (,) <$> readNextWorkspaceName <*> readNextWorkspaceName - shiftMod $ - doc "Restore a theater state" $ - pushPendingBuffer "G " $ + doc + "Switch to a different theater.\n\n\t\ + \Theaters are like super-workspaces. They are used for different\n\ + \'contexts'. Theaters share all the windows with eachother, but\n\ + \but each theater has its own mappings for window -> workspace. i.e.\n\ + \one theater can have window 'x' on workspace 'y', but another might\n\ + \have 'x' on 'z' instead. If a theater does explicity place a window,\n\ + \the window is placed in the hidden workspace (which is '*')" + $ pushPendingBuffer "G " $ runMaybeT_ $ do mapNextString $ \_ str -> lift $ case str of @@ -337,54 +303,37 @@ keymap = runKeys $ do [' '] -> restoreTheater Nothing _ -> return () - bind xK_n $ do - justMod $ - doc "Banish the current window to the border" $ - withFocused $ sendMessage . toggleBanish - - shiftMod $ - doc "Rotate border windows" $ - repeatable $ do - bind xK_h $ do - (justMod -|- noMod) $ - withFocused $ sendMessage . moveForward - - shiftMod $ - sendMessage (rotateBorderForward (Proxy :: Proxy Window)) - - bind xK_l $ do - (justMod -|- noMod) $ - withFocused $ sendMessage . moveBackward - - shiftMod $ - sendMessage (rotateBorderBackward (Proxy :: Proxy Window)) - - bind xK_plus $ do - (justMod -|- noMod) $ - sendMessage $ - changeWidth Proxy (1 / 24) - <> changeHeight (Proxy :: Proxy Window) (1 / 24) - - bind xK_minus $ do - (justMod -|- noMod) $ - sendMessage $ - changeWidth Proxy (-1 / 24) - <> changeHeight (Proxy :: Proxy Window) (-1 / 24) - bind xK_d $ justMod $ doc "Record (define) macros." $ subkeys $ do bind xK_w $ noMod $ - doc "Record a windowset macro" $ - pushPendingBuffer "Win Macro " $ + doc + "Record a windowset macro.\n\n\t\ + \To record a 'windowset' macro, type <M-d>w<key> and then\n\ + \type a character sequence followed by Enter. Now <key> can\n\ + \be used anywhere a 'windowset' is required and that macro\n\ + \will be used.\n\n\t\ + \For example, if one wants to define '+' as 'all windows \n\ + \not on the current workspace, one can type:\n\n\t\ + \<M-d>w+\\%@.<Enter>" + $ pushPendingBuffer "Win Macro " $ runMaybeT_ readWindowsetMacro bind xK_t $ noMod $ - doc "Record a workspace macro" $ - pushPendingBuffer "Wksp Macro " $ + doc + "Record a workspace macro\n\n\t\ + \To record a 'workspace' macro, type <M-d>t<key> and then\n\ + \type a character sequence followed by Enter. Now <key> can\n\ + \be used anywhere a 'workspace' is required and that macro\n\ + \will be used.\n\n\t\ + \For example, if one wants to define '<c-s>' as 'the workspace with\n\ + \the window 's' on it or the last workspace if already on that \n\ + \workspace (more useful that one would think):\n\n\t\ + \<M-d>t<c-s>?&s@.'s<Enter>" + $ pushPendingBuffer "Wksp Macro " $ runMaybeT_ readWorkspaceMacro bind xK_h $ do @@ -437,8 +386,11 @@ keymap = runKeys $ do bind xK_minus $ do justMod $ - doc "Decrease the number of windows in the master region." $ - sendMessage (IncMasterN (-1)) + doc + "Decrease the number of windows in the master region, or decrease\n\ + \the size of the master region if the current layout cannot have more\n\ + \than one window in the master region." + $ sendMessage $ IncMasterN (-1) shiftMod $ doc "For mosaic layout, shrink the size-share of the current window" $ @@ -446,40 +398,29 @@ keymap = runKeys $ do bind xK_m $ do justMod $ - doc "Mark the current window with the next typed character." $ do - pushPendingBuffer "m " $ do - locs <- fromMaybe [] <$> runMaybeT readNextLocationSet - let wins = mapMaybe locationWindow locs - unless (null wins) $ do - withBorderColor "#00ffff" wins $ do - runMaybeT_ $ do - mapNextString $ \_ str -> lift $ - case str of - [ch] | isAlpha ch -> markAllLocations str locs - _ -> return () - - shiftMod $ - doc "Mark the current desktop with the next typed character." $ - pushPendingBuffer "M " $ - runMaybeT_ $ do - mapNextString $ \_ str -> lift $ - case str of - [ch] | isAlpha ch -> saveCurrentDesktop str - _ -> return () - - controlMod $ - doc "Mark the current theater with the next typed character." $ - pushPendingBuffer "C-M " $ - runMaybeT_ $ do - mapNextString $ \_ str -> lift $ - case str of - [ch] | isAlpha ch -> saveCurrentTheater (Just str) - _ -> return () + doc + "Mark the windows described by the window set with a given character.\n\n\ + \For example, to mark the current window use <M-m>.<character>. That window\n\n\ + \can then be recalled anywhere that requires a WML window." + $ do + pushPendingBuffer "m " $ do + locs <- fromMaybe [] <$> runMaybeT readNextLocationSet + let wins = mapMaybe locationWindow locs + unless (null wins) $ do + withBorderColor "#00ffff" wins $ do + runMaybeT_ $ do + mapNextString $ \_ str -> lift $ + case str of + [ch] | isAlpha ch -> markAllLocations str locs + _ -> return () bind xK_plus $ do justMod $ - doc "Increase the number of windows in the master region." $ - sendMessage (IncMasterN 1) + doc + "Increase the number of windows in the master region, or increase\n\ + \the size of the master region if the current layout cannot have more\n\ + \than one window in the master region." + $ sendMessage $ IncMasterN 1 shiftMod $ doc "For mosaic layout, increase the size-share of the current window." $ @@ -490,14 +431,6 @@ keymap = runKeys $ do doc "Recompile and restart XMonad" $ spawnX "xmonad --recompile && xmonad --restart" - justMod $ - doc "Experimental Bindings" $ - subkeys $ do - bind xK_q $ - (justMod -|- noMod) $ - doc "EXPERIMENTAL: Move mouse to control media." $ - mouseRotateMotion (logs Info "CW") (logs Info "CCW") - bind xK_r $ do justMod $ doc "Run a command via Rofi" runDMenu shiftMod $ @@ -618,8 +551,10 @@ keymap = runKeys $ do -- Allows repeated strokes of M-h and M-l to reduce and increase volume -- respectively. justMod $ - doc "Changes the volume." $ - repeatable $ do + doc + "Allows repeated strokes of M-h and M-l to decrease and\n\ + \increase volume respectively" + $ repeatable $ do bind xK_h $ justMod $ doc @@ -644,33 +579,6 @@ keymap = runKeys $ do justMod $ doc "Less often used keybindings." $ subkeys $ do - bind xK_p $ do - (justMod -|- noMod) $ - doc "Go to the prior window in the history" historyBack - - bind xK_t $ do - (justMod -|- noMod) (logs Info "Test Log" :: X ()) - - -- bind xK_n $ do - -- (justMod -|- noMod) $ - -- doc "Take a note" $ - -- spawnX (terminal config ++ " -t Notes -e notes new") - bind xK_n $ do - (justMod -|- noMod) $ - doc "Go to the next window in the history" historyForward - - bind xK_c $ do - shiftMod $ - doc - "Kill all other copies of a window." - CopyWindow.killAllOtherCopies - - bind xK_q $ - justMod $ do - subkeys $ do - bind xK_q $ - justMod $ spawnX "echo hi" - bind xK_e $ do (justMod -|- noMod) $ doc "Select an emoji" $ @@ -709,22 +617,6 @@ keymap = runKeys $ do doc "Set the volume of an application via rofi." $ spawnX "set-volume.sh -a" - let navigateHistory = repeatable $ do - bind xK_bracketright $ do - noMod $ - doc "Move forward in location history" historyForward - - bind xK_bracketleft $ do - noMod $ - doc "Move backward in location history" historyBack - - bind xK_bracketleft $ - noMod $ - doc "Move forward in location history" navigateHistory - bind xK_bracketright $ - noMod $ - doc "Move backward in location history" navigateHistory - -- Double-tap Z to toggle zoom. bind xK_z $ do noMod -|- justMod $ @@ -744,22 +636,26 @@ keymap = runKeys $ do sendMessage togglePop bind xK_F8 $ do - justMod $ do - ll <- getLogLevel - let next = if minBound == ll then maxBound else pred ll - - safeSpawnX - "notify-send" - ["-t", "2000", printf "LogLevel set to %s" (show next)] - setLogLevel next - logs next "LogLevel set to %s." (show next) - - shiftMod $ do - ss <- withWindowSet return - logs - Info - "Current Stack Set:%s" - (show $ viaShow $ W.mapLayout (const ()) ss) + justMod $ + doc + "Set the log level.\n\ + \Log levels are, in order\n\n\t\ + \Trace\n\t\ + \Debug\n\t\ + \Info (default)\n\t\ + \Warn\n\t\ + \Error\n\t\ + \Fatal\n\n\ + \Log is sent to stdout." + $ do + ll <- getLogLevel + let next = if minBound == ll then maxBound else pred ll + + safeSpawnX + "notify-send" + ["-t", "2000", printf "LogLevel set to %s" (show next)] + setLogLevel next + logs next "LogLevel set to %s." (show next) bind xF86XK_Calculator $ do noMod $ spawnX $ terminal config ++ " -t Floating\\ Term -e /usr/bin/env python3" |