diff options
author | Adrian Kummerlaender | 2018-04-30 21:33:12 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2018-04-30 21:33:12 +0200 |
commit | 7c4ae27d2895cc5e840b32774761c8349232a65a (patch) | |
tree | dd03c3074d680b0bb76fac91f93787349702685a /conf/xmonad | |
parent | 909f371de9646970dafd8c1d98631f765f68ddda (diff) | |
download | nixos_home-7c4ae27d2895cc5e840b32774761c8349232a65a.tar nixos_home-7c4ae27d2895cc5e840b32774761c8349232a65a.tar.gz nixos_home-7c4ae27d2895cc5e840b32774761c8349232a65a.tar.bz2 nixos_home-7c4ae27d2895cc5e840b32774761c8349232a65a.tar.lz nixos_home-7c4ae27d2895cc5e840b32774761c8349232a65a.tar.xz nixos_home-7c4ae27d2895cc5e840b32774761c8349232a65a.tar.zst nixos_home-7c4ae27d2895cc5e840b32774761c8349232a65a.zip |
Extract float rect definitions in XMonad config
Diffstat (limited to 'conf/xmonad')
-rw-r--r-- | conf/xmonad/xmonad.hs | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/conf/xmonad/xmonad.hs b/conf/xmonad/xmonad.hs index cba4517..90897ce 100644 --- a/conf/xmonad/xmonad.hs +++ b/conf/xmonad/xmonad.hs @@ -42,14 +42,21 @@ availableLayouts = smartBorders $ tabs ||| tilesLM ||| tilesRM ||| tilesTM ||| t windowBringerDmenuConfig = def { menuCommand = "rofi" , menuArgs = [ "-p", "win", "-dmenu", "-i" ] } +floatRectFull = RationalRect (1/20) (1/20) (18/20) (18/20) +floatRectCenter = RationalRect (1/6) (1/6) (2/3) (2/3) +floatRectBottom = RationalRect 0 (1/3) 1 (2/3) +floatRectTop = RationalRect 0 0 1 (2/3) +floatRectLeft = RationalRect 0 0 (1/2) 1 +floatRectRight = RationalRect (1/2) 0 (1/2) 1 + scratchpads = [ NS "terminal" "kitty --class=scratchterm" (className =? "scratchterm") - (customFloating $ RationalRect (1/6) (1/6) (2/3) (2/3)) + (customFloating floatRectCenter) , NS "browser" "firefox" (className =? "Firefox") - (customFloating $ RationalRect 0 0 1 (2/3)) + (customFloating floatRectTop) , NS "zeal" "zeal" (className =? "Zeal") - (customFloating $ RationalRect (1/20) (1/20) (18/20) (18/20)) + (customFloating floatRectFull) , NS "telegram" "telegram-desktop" (className =? "TelegramDesktop") - (customFloating $ RationalRect (1/6) (1/6) (2/3) (2/3)) ] + (customFloating floatRectCenter) ] main = xmonad $ ewmh $ defaultConfig @@ -93,10 +100,12 @@ main = xmonad $ ewmh , ("M-s h" , namedScratchpadAction scratchpads "zeal") , ("M-s m" , namedScratchpadAction scratchpads "telegram") -- floating placement - , ("M-f j" , withFocused $ snapFloatingBottom) - , ("M-f k" , withFocused $ snapFloatingTop) - , ("M-f h" , withFocused $ snapFloatingRight) - , ("M-f l" , withFocused $ snapFloatingLeft) + , ("M-f f" , withFocused $ placeFloating floatRectFull) + , ("M-f c" , withFocused $ placeFloating floatRectCenter) + , ("M-f j" , withFocused $ placeFloating floatRectBottom) + , ("M-f k" , withFocused $ placeFloating floatRectTop) + , ("M-f h" , withFocused $ placeFloating floatRectLeft) + , ("M-f l" , withFocused $ placeFloating floatRectRight) -- system control , ("M-c <Up>" , spawn "amixer sset Master 10%+") , ("M-c <Down>" , spawn "amixer sset Master 10%-") @@ -104,11 +113,9 @@ main = xmonad $ ewmh `additionalKeys` [ ((noModMask, xK_Menu) , namedScratchpadAction scratchpads "terminal") ] -snapFloatingBottom = windows . (flip XMonad.StackSet.float $ RationalRect 0 (1/3) 1 (2/3)) -snapFloatingTop = windows . (flip XMonad.StackSet.float $ RationalRect 0 0 1 (2/3)) -snapFloatingRight = windows . (flip XMonad.StackSet.float $ RationalRect 0 0 (1/2) 1 ) -snapFloatingLeft = windows . (flip XMonad.StackSet.float $ RationalRect (1/2) 0 (1/2) 1 ) - nonEmptyWS = WSIs $ return (\w -> nonNSP w && nonEmpty w) where nonNSP (Workspace tag _ _) = tag /= "NSP" nonEmpty = isJust . stack + +placeFloating :: RationalRect -> Window -> X () +placeFloating rect = windows . (flip XMonad.StackSet.float $ rect) |