clean xmonad config and change close window binding

This commit is contained in:
Felix Van der Jeugt 2022-05-16 15:36:03 +02:00 committed by Felix Van der Jeugt
parent bfc4f820fe
commit bc6ede5703
No known key found for this signature in database
GPG Key ID: 58B209295023754D

View File

@ -1,12 +1,15 @@
module Main where
import qualified Data.Map as M
import Data.Maybe (isJust)
import Graphics.X11.ExtraTypes.XF86
import System.Exit (exitSuccess)
import XMonad.Actions.CycleWS (nextScreen, shiftNextScreen)
import XMonad.Actions.Warp (warpToWindow)
import XMonad hiding ((|||))
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.ManageHelpers ((-?>), composeOne)
import XMonad.Hooks.ManageHelpers ((-?>), ($?))
import qualified XMonad.Hooks.ManageHelpers as H
import XMonad.Layout.IndependentScreens (countScreens, onCurrentScreen, withScreens, workspaces')
import XMonad.Layout.LayoutCombinators ((|||), JumpToLayout(JumpToLayout))
import XMonad.Layout.LayoutModifier (ModifiedLayout(ModifiedLayout))
@ -31,7 +34,7 @@ myKeys conf@(XConfig { modMask = modMask }) = M.fromList $
, (mod xK_t, spawn $ terminal conf)
, (mod xK_r, spawn "exec \"$(dmenu_path | dmenu)\"")
, (mod xK_p, spawn "delegator")
, (modshift xK_c, kill)
, (mod xK_BackSpace, kill)
, (mod xK_j, windows W.focusDown >> center)
, (mod xK_k, windows W.focusUp >> center)
, (modshift xK_j, windows W.swapDown >> center)
@ -42,20 +45,28 @@ myKeys conf@(XConfig { modMask = modMask }) = M.fromList $
, (mod xK_d, sendMessage (IncMasterN (-1)) >> center)
, (mod xK_h, sendMessage Shrink >> center)
, (mod xK_l, sendMessage Expand >> center)
, (mod xK_q, spawn "cd ~/.xmonad; stack install; xmonad --restart")
, (mod xK_q, spawn "xmonad --recompile; xmonad --restart")
, (modshift xK_q, io exitSuccess)
, (mod xK_m, sendMessage $ JumpToLayout "Max")
, (mod xK_w, sendMessage $ JumpToLayout "Wide")
, (mod xK_f, sendMessage $ JumpToLayout "Floating")
, (mediaUp, spawn "pamixer -i 5")
, (mediaDown, spawn "pamixer -d 5")
, (mediaPlay, spawn "playerctl play-pause")
, (mediaNext, spawn "playerctl next")
] ++
[ (m k, windows $ onCurrentScreen f i)
| (i, k) <- zip (workspaces' conf) [xK_1 .. xK_9]
| (i, k) <- zip (workspaces' conf) [xK_1 .. xK_9] ++ zip (workspaces' conf) [xK_z, xK_x, xK_c, xK_v, xK_b]
, (f, m) <- [(W.greedyView, mod), (W.shift, modshift)]
]
where
mod k = (modMask, k)
modshift k = (modMask .|. shiftMask, k)
center = warpToWindow 0.5 0.5
mediaUp = (0, xF86XK_AudioRaiseVolume)
mediaDown = (0, xF86XK_AudioLowerVolume)
mediaNext = (0, xF86XK_AudioNext)
mediaPlay = (0, xF86XK_AudioPlay)
myMouse :: XConfig l -> M.Map (KeyMask, Button) (Window -> X ())
myMouse conf@(XConfig { modMask = modMask }) = M.fromList
@ -68,9 +79,3 @@ myLayout = rename "Wide" (Tall 1 (3/100) (1/2))
||| rename "Max" (noBorders Full)
||| rename "Floating" simplestFloat
where rename = ModifiedLayout . Renamed.Replace
myManageHook = composeOne
[ ("dialog" `isSuffixOf`) <$> role -?> doFloat
]
where role = stringProperty "WM_WINDOW_ROLE"
isSuffixOf suf str = suf == drop (length str - length suf) str