aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Rahm/Desktop/Keys.hs36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index d55c3bc..8df6e3b 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -39,6 +39,7 @@ import Graphics.X11.ExtraTypes.XF86
xF86XK_MonBrightnessDown,
xF86XK_MonBrightnessUp,
)
+import Graphics.X11.XScreenSaver (XScreenSaverState (ScreenSaverCycle))
import Rahm.Desktop.BorderColors (BorderColor (BorderColor), withBorderColor, withBorderColorM)
import Rahm.Desktop.Common
( Location (..),
@@ -139,6 +140,7 @@ import Rahm.Desktop.XMobarLog.PendingBuffer
pushAddPendingBuffer,
pushPendingBuffer,
)
+import System.Exit (exitSuccess, exitFailure)
import Text.Printf (printf)
import XMonad as X
import XMonad.Actions.CopyWindow as CopyWindow
@@ -154,7 +156,6 @@ import XMonad.Layout.Spacing
import XMonad.Util.Run (safeSpawn)
import XMonad.Util.WindowProperties
import Prelude hiding ((!!))
-import Graphics.X11.XScreenSaver (XScreenSaverState(ScreenSaverCycle))
type KeyMap l = XConfig l -> Map (KeyMask, KeySym) (X ())
@@ -296,18 +297,23 @@ bindings = do
lift $ windows $ W.swapWorkspaces w1 w2
bind xK_BackSpace $ do
- -- The only raw keybinding. Meant to get a terminal to unbrick XMonad if
- -- something goes wrong with the keyboard layout and for first-time boots
- -- where dmenu/alacritty may not be installed.
- rawMask mod4Mask $
- doc "Spawns XTerm as a fallback if xkb is messed up." $
- spawnX "xterm"
-
-- Moves xmobar to different monitors.
justMod $
doc "Move XMobar to another screen." $
spawnX "pkill -SIGUSR1 xmobar"
+ -- Ways to kill XMonad with (hopefully) consistent keys in case xkb gets
+ -- really messed up.
+ withMod (shiftMask .|. mod1Mask) $
+ doc
+ "Kills xmonad, exiting successfully"
+ (io exitSuccess :: X ())
+
+ withMod (shiftMask .|. mod1Mask .|. controlMask) $
+ doc
+ "Kills xmonad, exiting unsuccessfully"
+ (io exitFailure :: X ())
+
let getDoc :: X String
getDoc = do
config <- asks config
@@ -342,6 +348,12 @@ bindings = do
bind xK_Return $ do
justMod swapMaster
+ -- The only raw keybinding. It's a consistent way to launch xterm to unbrick
+ -- XMonad in case rofi and alacritty are broken or the keyboard is messed
+ -- up.
+ rawMask (shiftMask .|. mod4Mask .|. mod1Mask) $
+ doc "Spawns XTerm as a fallback if xkb is messed up." $
+ spawnX "xterm"
bind xK_bracketright $ do
justMod $
@@ -367,9 +379,10 @@ bindings = do
bind xK_f $ do
justMod $
- doc "Focus (non-greedily) a workspace. Useful for focusing between \
- \screens with ',.', '$', '^', etc." $
- pushPendingBuffer "f " $ do
+ doc
+ "Focus (non-greedily) a workspace. Useful for focusing between \
+ \screens with ',.', '$', '^', etc."
+ $ pushPendingBuffer "f " $ do
runMaybeT_ $ do
ws <- readNextWorkspaceName
lift $ windows $ W.view ws
@@ -388,7 +401,6 @@ bindings = do
ws' <- workspaceForStringT ";."
ws <- MaybeT . return $ workspaceName ws'
lift $ windows $ W.view ws
-
bind xK_g $ do
justMod $