Setup some basic WM stuff
- Standard image background
- Polybar
- A standard XMonad config
- Picom
diff --git a/modules/xmonad/XMonadLog.hs b/modules/xmonad/XMonadLog.hs
new file mode 100644
index 0000000..78b707b
--- /dev/null
+++ b/modules/xmonad/XMonadLog.hs
@@ -0,0 +1,44 @@
+-- spell-checker:words xmonad,dbus,polybar,mempty
+
+module XMonadLog where
+
+import qualified DBus as D
+import qualified DBus.Client as D
+
+import qualified Codec.Binary.UTF8.String as UTF8
+import XMonad.Hooks.StatusBar.PP
+import XMonad.Util.Replace (replace)
+
+xmonadLog :: IO D.Client
+xmonadLog = let opts = [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]
+ in do
+ dbus <- D.connectSession
+ D.requestName dbus (D.busName_ "org.xmonad.Log") opts
+ return dbus
+
+dbusOutput :: D.Client -> String -> IO ()
+dbusOutput dbus str =
+ let objectPath = D.objectPath_ "/org/xmonad/Log"
+ interfaceName = D.interfaceName_ "org.xmonad.Log"
+ memberName = D.memberName_ "Update"
+ signal = D.signal objectPath interfaceName memberName
+ body = [D.toVariant str]
+ in D.emit dbus $ signal { D.signalBody = body }
+
+polybarHook :: D.Client -> PP
+polybarHook dbus =
+ let wrapper c s | s /= "NSP" = wrap ("%{F" <> c <> "} ") " %{F-}" s
+ | otherwise = mempty
+ blue = "#61afef"
+ grey = "#474e5d"
+ orange = "#e5c07b"
+ purple = "#c678dd"
+ red = "#e06c75"
+ in def { ppOutput = dbusOutput dbus
+ , ppCurrent = wrapper blue
+ , ppVisible = wrapper red
+ , ppUrgent = wrapper orange
+ , ppHidden = wrapper red
+ , ppHiddenNoWindows = wrapper grey
+ , ppTitle = shorten 100 . wrapper purple
+ }
diff --git a/modules/xmonad/xmonad.hs b/modules/xmonad/xmonad.hs
index 725ae28..bbd949f 100644
--- a/modules/xmonad/xmonad.hs
+++ b/modules/xmonad/xmonad.hs
@@ -4,23 +4,48 @@
import System.Exit
import XMonad.Util.EZConfig
+import XMonad.Hooks.EwmhDesktops
+import XMonad.Hooks.ManageDocks
+import XMonad.Config.Desktop
+
+import XMonadLog
+import XMonad.Hooks.DynamicLog
+import qualified DBus.Client as D
+
+import XMonad.Layout.Spacing
+import XMonad.Layout.Gaps
+
terminal = "kitty" -- Kitty, my beloved <3
launcher = "pkill rofi; rofi -show combi"
networkManager = "wpa_cli select_network $(wpa_cli list_networks | tail -n +3 | rofi -dmenu -window-title 'Select Network' | awk '{print $1;}')"
modifierKey = mod4Mask -- Use Super as our mod key
statusBar = "pkill polybar; polybar"
+compositor = "pkill picom; picom"
+background = "feh --no-fehbg --bg-fill .xmonad/background.png"
shift = shiftMask
startupHook = do
- spawn statusBar
+ spawn Main.statusBar
+ spawn Main.compositor
+ spawn background
+
main :: IO ()
-main = xmonad $ ewmh def
+main = XMonadLog.xmonadLog >>= main'
+
+main' :: D.Client -> IO ()
+main' dbus = xmonad $ docks $ ewmh . ewmhFullscreen $ def
{ modMask = modifierKey -- Use Super as our mod key
+ , borderWidth = 0
, XMonad.terminal = Main.terminal
- , startupHook = startupHook
+ , XMonad.startupHook = Main.startupHook
+ , XMonad.logHook = dynamicLogWithPP (polybarHook dbus)
+ , XMonad.layoutHook = avoidStruts $
+ smartSpacing 5 $
+ gaps [(U, 5), (D, 5), (L, 5), (R, 5)] $
+ layoutHook def
} `additionalKeys`
[ ((modifierKey, xK_d), spawn launcher)
, ((modifierKey, xK_n), spawn networkManager)