From 25483a5b8960525447e3f81e86926508731c8fa6 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 29 Jan 2026 14:35:15 -0600 Subject: XMobar --- modules/home/christian.nix | 7 ++++++- modules/home/xmobar/xmobarrc | 26 ++++++++++++++++++++++++++ modules/xmonad.hs | 28 +++++++++++++++------------- 3 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 modules/home/xmobar/xmobarrc (limited to 'modules') diff --git a/modules/home/christian.nix b/modules/home/christian.nix index 9c35e07..b7bbe3d 100644 --- a/modules/home/christian.nix +++ b/modules/home/christian.nix @@ -49,7 +49,12 @@ ]; }; }; - + + programs.xmobar = { + enable = true; + extraConfig = builtins.readFile ./xmobar/xmobarrc; + }; + programs.home-manager.enable = true; } diff --git a/modules/home/xmobar/xmobarrc b/modules/home/xmobar/xmobarrc new file mode 100644 index 0000000..3185112 --- /dev/null +++ b/modules/home/xmobar/xmobarrc @@ -0,0 +1,26 @@ +Config + { font = "Monospace" + , borderColor = "#d0d0d0" + , border = FullB + , borderWidth = 1 + , bgColor = "#222" + , fgColor = "grey" + , position = TopH 30 + , commands = + [ Run Cpu ["-t", "cpu: %"] 10 + , Run Network "wlan0" ["-S", "True", "-t", "wlan: /"] 10 + , Run Memory ["-t","mem: %"] 10 + , Run Date "date: %a %d %b %Y %I:%M:%S %p " "date" 10 + , Run Battery + ["-t", "bat: ", + "-L", "10", "-H", "80", "-S", "True", + "-l", "red", "-n", "#4eb4fa", "-h", "green", + "--", + "-L", "-15", "-H", "-5", + "-l", "red", "-m", "#4eb4fa", "-h", "green"] + 600 + ] + , sepChar = "%" + , alignSep = "}{" + , template = " %battery% | %cpu% | %memory% | %wlan0% }{%date% " +} diff --git a/modules/xmonad.hs b/modules/xmonad.hs index 1df21b5..6de28c7 100644 --- a/modules/xmonad.hs +++ b/modules/xmonad.hs @@ -1,5 +1,8 @@ import XMonad import XMonad.Util.EZConfig (additionalKeys) +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.StatusBar +import XMonad.Hooks.StatusBar.PP import Control.Monad (when) import Text.Printf (printf) import System.Posix.Process (executeFile) @@ -7,23 +10,22 @@ import System.Info (arch,os) import System.Environment (getArgs) import System.FilePath (()) -compiledConfig = printf "xmonad-%s-%s" arch os +myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full) + where + tiled = Tall nmaster delta ratio + nmaster = 1 -- Default number of windows in the master pane + ratio = 1/2 -- Default proportion of screen occupied by master pane + delta = 3/100 -- Percent of screen to increment by when resizing panes myConfig = defaultConfig { modMask = mod1Mask + , layoutHook = myLayout + , focusedBorderColor = "#4eb4fa" , terminal = "alacritty" } `additionalKeys` - [ ( (mod1Mask, xK_r), compileRestart True) - , ( (mod1Mask, xK_q), restart "xmonad" True ) ] + [ ( (mod1Mask, xK_q), restart "xmonad" True ) ] -compileRestart resume = do - dirs <- asks directories - whenX (recompile dirs True) $ do - when resume writeStateToFile - catchIO - ( do - args <- getArgs - executeFile (cacheDir dirs compiledConfig) False args Nothing - ) +mySB = statusBarProp "xmobar" (pure xmobarPP) +-- main = xmonad $ withEasySB mySB defToggleStrutsKey def -main = getDirectories >>= launch myConfig +main = getDirectories >>= launch (docks $ withSB mySB myConfig) -- cgit v1.2.3