diff options
| author | Josh Rahm <rahm@google.com> | 2022-03-28 10:01:01 -0600 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2022-03-28 10:01:01 -0600 |
| commit | 67f325a17b81d7818db8d17ce261f5cda3d2ed93 (patch) | |
| tree | 02baee57c408816a961f69e17b6af696cec0e957 /src/Main.hs | |
| parent | cfb489be45b8222c4984b344ee4e1f2e760dd3b7 (diff) | |
| parent | a7129b68fb7fa4f7cea52513fad7223dcbba9801 (diff) | |
| download | rde-67f325a17b81d7818db8d17ce261f5cda3d2ed93.tar.gz rde-67f325a17b81d7818db8d17ce261f5cda3d2ed93.tar.bz2 rde-67f325a17b81d7818db8d17ce261f5cda3d2ed93.zip | |
Merge branch 'v017' of git.josher.dev:rde into v017
Diffstat (limited to 'src/Main.hs')
| -rw-r--r-- | src/Main.hs | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/Main.hs b/src/Main.hs index cda3ae2..19050ab 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,6 +1,7 @@ import XMonad import Control.Monad.Trans.Class +import Control.Monad.Reader import XMonad.Hooks.ManageDocks (docks) import System.Directory (getHomeDirectory) import System.FilePath ((</>)) @@ -15,10 +16,13 @@ import Internal.Keys import Internal.Layout import Internal.Logger import Internal.DMenu (menuCommandString) +import Internal.Intercept +import XMonad.Actions.WithAll (withAll) import qualified XMonad as X import qualified XMonad.StackSet as W + main = do -- Execute some commands. @@ -31,7 +35,17 @@ main = do xmobar <- spawnXMobar (=<<) X.xmonad $ - applyKeys $ ewmh $ docks $ def + applyKeys $ ewmh $ docks $ windowHooks (composeAll [ + className =? "Google-chrome" --> composeAll [ + -- The geniuses that made chrome decided that Ctrl+W should kill + -- the current tab! This makes it consistent with the rest of the + -- world ... ctrl+w deletes the last word (ctrl+backspace). + rebindKey (controlMask, xK_w) (controlMask, xK_BackSpace) + , rebindKey (controlMask, xK_h) (0, xK_BackSpace) + , rebindKey (controlMask, xK_u) (controlMask .|. shiftMask, xK_BackSpace) + , rebindKey (controlMask, xK_b) (controlMask, xK_w) + ] + ]) $ def { terminal = "alacritty" , modMask = mod3Mask , borderWidth = 2 @@ -39,7 +53,7 @@ main = do , focusedBorderColor = "#ff6c00" , normalBorderColor = "#404040" , layoutHook = myLayout - , startupHook = spawn fp + , startupHook = spawn fp , manageHook = composeAll [ isFullscreen --> doFullFloat , className =? "Tilda" --> doFloat @@ -48,13 +62,15 @@ main = do , title =? "Event Tester" --> doFloat , title =? "Floating Term" --> doCenterFloat , title =? "Notes" --> doCenterFloat - , title =? "xmessage" --> doFloat - , title =? "gxmessage" --> doFloat + , title =? "xmessage" --> doCenterFloat + , title =? "gxmessage" --> doCenterFloat + , title =? "Volume Control" --> doCenterFloat , className =? "mpv" --> doFloat , className =? "gnubby_ssh_prompt" --> doFloat ] , workspaces = map return (['0'..'9'] ++ ['a'..'z']) - , handleEventHook = fullscreenEventHook + , handleEventHook = + composeAll [fullscreenEventHook, interceptHook, remapHook] , focusFollowsMouse = False , clickJustFocuses = False , logHook = xMobarLogHook xmobar @@ -66,3 +82,15 @@ doCenterFloat = centerRect :: W.RationalRect -> W.RationalRect centerRect (W.RationalRect x y w h) = W.RationalRect ((1 - w) / 2) ((1 - h) / 2) w h + + +windowHooks :: WindowHook -> XConfig l -> XConfig l +windowHooks (Query readerT) config = do + + config { + startupHook = do + withAll $ \w -> runReaderT readerT w + startupHook config, + + manageHook = mappend (Query readerT >> return (Endo id)) (manageHook config) + } |