From 1cd276eb335b69aeab0abec4a1c31728563bfdf7 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 3 Nov 2021 13:17:54 -0600 Subject: Finally, after much wailing and gnashing of teeth, fixed the Xmobar layout icon issue! --- src/Main.hs | 59 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 25 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 28d50ad..47a00e2 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,5 +1,7 @@ import XMonad +import Control.Exception import XMonad.Hooks.DynamicLog +import Control.Concurrent import XMonad.Layout.Spacing import XMonad.Actions.WindowNavigation import XMonad.Util.CustomKeys @@ -12,10 +14,15 @@ import XMonad.Layout.IndependentScreens import Text.Printf import Data.List.Split import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.ManageDocks +import XMonad.Util.Run (spawnPipe) +import Control.Monad (when) +import System.IO import Internal.Keys import Internal.LayoutDraw import Data.List (partition, isPrefixOf) +import Data.Maybe main = do @@ -23,8 +30,10 @@ main = do homeDir <- getHomeDirectory let fp = homeDir ".xmonad" "startup" + xmproc <- spawnPipe "xmobar" + config <- - applyKeys $ def + applyKeys $ docks $ def { terminal = "alacritty" , modMask = mod3Mask , borderWidth = 2 @@ -49,33 +58,33 @@ main = do , handleEventHook = fullscreenEventHook , focusFollowsMouse = False , clickJustFocuses = False - } + , logHook = do + (_, _, layout) <- showLayout - let toggleStructsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b) + dynamicLogWithPP $ xmobarPP { + ppCurrent = xmobarColor "#ff8888" "red" . printf "%s" + , ppVisible = xmobarColor "#8888ff" "" . printf "%s" + , ppHidden = xmobarColor "#888888" "" . printf "%s" + , ppWsSep = " " + , ppTitle = + xmobarColor "#808080" "" . + printf "%s" . + parseOut . + trunc 50 + + , ppSep = xmobarColor "#404040" "" " │ " + , ppLayout = const (fromMaybe "" layout) + , ppExtras = [] + , ppOutput = hPutStrLn xmproc + , ppOrder = \ss -> + let (icons, etc) = partition ("%s" - , ppVisible = xmobarColor "#8888ff" "" . printf "%s" - , ppHidden = xmobarColor "#888888" "" . printf "%s" - , ppWsSep = " " - , ppTitle = - xmobarColor "#808080" "" . - printf "%s" . - parseOut . - trunc 50 + -- let toggleStructsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b) - , ppSep = xmobarColor "#404040" "" " │ " - , ppLayout = const "" - , ppExtras = [showLayout] - , ppOrder = \ss -> - let (icons, etc) = partition (" String -- cgit