xmonad-config/xmonad.hs
2021-12-15 12:38:09 +02:00

79 lines
2.9 KiB
Haskell
Executable file

-- My xmonad configuration, based on the example.hs of the xmonad project
-- including best practises.
-- https://github.com/xmonad/xmonad-contrib/blob/master/XMonad/Config/Example.hs
module Main (main) where
import XMonad
import XMonad.Actions.DynamicProjects
import XMonad.Config.Desktop
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.NoBorders (noBorders, smartBorders)
import XMonad.Layout.NoFrillsDecoration
import XMonad.Layout.PerScreen
import XMonad.Layout.Reflect
import XMonad.Layout.ResizableTile (ResizableTall(..))
import XMonad.Layout.Spacing
import XMonad.Layout.ThreeColumns (ThreeCol(..))
import XMonad.Layout.ToggleLayouts (toggleLayouts)
import XMonad.Util.EZConfig
import XMonad.Util.SpawnOnce
import qualified Solarized as S
-- Tidy modules
import KeyBindings as Keys (modify)
import MouseBindings as Mouse (modify)
import Projects (modify)
import Scratchpad (modify)
import ScreenEvents (modify)
-------------------- toggle btw vvvvvvvvvv or vvvvv
--layouts = titleBar $ toggleLayouts fullscreen tiled
layouts = toggleLayouts fullscreen tiled
where
fullscreen = (noBorders Full)
tiled = smarts $ ifWider (1920 + 1) wideScreen normalScreen
wideScreen = ThreeColMid 1 (5/100) (1/2)
normalScreen = ResizableTall 1 (5/100) (1/2) []
smarts = (smartSpacingWithEdge 5) . smartBorders
--titleBar = noFrillsDeco shrinkText S.theme
-- Use the `xprop' tool to get the info you need for these matches.
-- For className, use the second value that xprop gives you.
-------------- Here be the law of windows
myManageHook = composeOne
[ className =? "Pavucontrol" -?> doShift "music"
, className =? "Pinentry" -?> doFloat
, className =? "VirtualBox" -?> doFloat
, className =? "mpv" -?> doFullFloat <+> (doShift "flims")
, className =? "qemu-system-x86_64" -?> doFloat
, className =? "qutebrowser" -?> doShift "web"
, isDialog -?> doCenterFloat
, isDialog -?> doCenterFloat
-- Move transient windows to their parent:
, transience
]
------------ build the full config
withConfig =
Projects.modify -- Apply projects config
$ Keys.modify -- Apply keybindings config
$ Mouse.modify -- Apply mouse bindings config
$ Scratchpad.modify -- Apply scratchpad managehook config
$ ScreenEvents.modify -- Apply screen event hook config
$ desktopConfig -- on a default desktop config
{ manageHook = myManageHook <+> manageHook desktopConfig
, layoutHook = desktopLayoutModifiers layouts
, startupHook = spawnOnce "sh ~/.fehbg"
, terminal = "nvidia-offload kitty"
, normalBorderColor = S.base03
, focusedBorderColor = S.violet
, borderWidth = 5
}
------ and pass it to xmonad:
main = xmonad withConfig