xmonad-config/xmonad.hs
2018-01-27 15:03:59 +02:00

77 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.Config.Desktop
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.NoBorders (noBorders, smartBorders)
import XMonad.Layout.ResizableTile (ResizableTall(..))
import XMonad.Layout.Spacing
import XMonad.Layout.ToggleLayouts (toggleLayouts)
import XMonad.Util.EZConfig
import qualified Solarized as S
-- Tidy modules
import StatusBar as Bar (modify)
import KeyBindings as Keys (modify)
import MouseBindings as Mouse (modify)
-------- A list of my usual workspaces (with some FontAwesome & xmobar format)
wkspcs = [ wrap "<fn=1>" "</fn>" "\xF0E0" --  email
, wrap "<fn=1>" "</fn>" "\xF086" --  chat
, wrap "<fn=1>" "</fn>" "\xF120" --  work
, wrap "<fn=1>" "</fn>" "\xF1B6" --  game
, wrap "<fn=1>" "</fn>" "\xF11B" --  game
, wrap "<fn=1>" "</fn>" "\xF09C" --  password
, wrap "<fn=1>" "</fn>" "\xF16C" --  web work
, wrap "<fn=1>" "</fn>" "\xF025" --  sound
, wrap "<fn=1>" "</fn>" "\xF269" --  web perso
, wrap "<fn=1>" "</fn>" "\xF03D" --  movie
]
--------- toggle btw vvvvvvvvvv or vvvvv
layouts = toggleLayouts fullscreen tiled
where
fullscreen = (noBorders Full)
tiled = smarts $ resizableTall ||| (Mirror resizableTall)
smarts = (smartSpacingWithEdge 5) . smartBorders
resizableTall = ResizableTall 1 (5/100) (1/2) []
-- 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 =? "mpv" -?> doFullFloat <+> (doShift $ last wkspcs)
, className =? "Pinentry" -?> doFloat
, className =? "Steam" -?> doFloat
, className =? "csgo_linux64" -?> doFullFloat
, className =? "Pavucontrol" -?> doShift $ wkspcs !! 7
, className =? "qutebrowser" -?> doShift $ wkspcs !! 5
, isDialog -?> doCenterFloat
-- Move transient windows to their parent:
, transience
]
------------ build the full config
withConfig =
Bar.modify -- Apply statusBar config
$ Keys.modify -- Apply keybindings config
$ Mouse.modify -- Apply mouse bindings config
$ desktopConfig -- on a default desktop config
{ manageHook = myManageHook <+> manageHook desktopConfig
, layoutHook = desktopLayoutModifiers layouts
, terminal = "/run/current-system/sw/bin/kitty"
, workspaces = wkspcs
, normalBorderColor = S.base03
, focusedBorderColor = S.violet
, borderWidth = 5
}
------ and pass it to xmonad:
main = xmonad withConfig