clunk: make polybar use dynamic hostname

This commit is contained in:
Aaron Bieber 2024-01-24 07:09:34 -07:00
parent ea8deadc45
commit e8ea921321
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View File

@ -68,7 +68,7 @@ in
windowManager.xmonad = {
enable = true;
extraPackages = haskellPackages: [ haskellPackages.xmonad-contrib ];
extraPackages = haskellPackages: with haskellPackages; [ xmonad-contrib hostname ];
config = builtins.readFile ./xmonad.hs;
};
};

View File

@ -2,6 +2,7 @@
import qualified Data.Map as M
import Data.Monoid
import Network.HostName
import XMonad
import XMonad.Actions.CycleWS
import XMonad.Hooks.EwmhDesktops
@ -32,6 +33,7 @@ instance UrgencyHook LibNotifyUrgencyHook where
main :: IO ()
main = do
hostname <- getHostName
xmonad $
ewmh $
withUrgencyHook LibNotifyUrgencyHook $
@ -41,7 +43,7 @@ main = do
, focusFollowsMouse = False
, terminal = "alacritty"
, workspaces = myWorkspaces
, startupHook = myStartupHook
, startupHook = myStartupHook hostname
, layoutHook = myLayoutHook
, keys = \c -> myKeys c `M.union` XMonad.keys def c
, manageHook = manageDocks <+> myManageHook <+> manageHook def
@ -136,6 +138,5 @@ myManageHook =
, className =? "XConsole" --> doF (W.shift (myWorkspaces !! 8))
]
myStartupHook :: X ()
myStartupHook = do
spawn "pkill polybar; polybar"
myStartupHook hostname = do
spawn ("pkill polybar; polybar " ++ hostname)