From 0d13796f6cb360ec8c00bf84651d68df5a108a33 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 2 Nov 2021 00:41:08 -0600 Subject: Big powerpill added to my XMonad and XMobar. --- src/Main.hs | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 25c930e..7e1cc68 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -10,6 +10,7 @@ import Internal.Layout import XMonad.Hooks.ManageHelpers import XMonad.Layout.IndependentScreens import Text.Printf +import Data.List.Split import XMonad.Hooks.EwmhDesktops import Internal.Keys @@ -29,7 +30,8 @@ main = do , borderWidth = 2 , keys = \config -> mempty , focusedBorderColor = "#ff6c00" - , normalBorderColor = "#ffd9bf" + -- , normalBorderColor = "#ffd9bf" + , normalBorderColor = "#000000" , layoutHook = myLayout , startupHook = do ewmhDesktopsStartup @@ -55,15 +57,17 @@ main = do statusBar "xmobar" xmobarPP { - ppCurrent = xmobarColor "#ffffff" "red" . printf "%s" - , ppVisible = xmobarColor "#8888ff" "" . printf "%s" - , ppHidden = xmobarColor "#888888" "" . printf "%s" - , ppWsSep = " · " + ppCurrent = xmobarColor "#ff8888" "red" . printf "%s" + , ppVisible = xmobarColor "#8888ff" "" . printf "%s" + , ppHidden = xmobarColor "#888888" "" . printf "%s" + , ppWsSep = " " , ppTitle = - xmobarColor "#8888ff" "" . printf "%s" . - (printf "%s" :: String -> String) + xmobarColor "#808080" "" . + printf "%s" . + parseOut . + trunc 50 - , ppSep = xmobarColor "#404040" "" " ──── " + , ppSep = xmobarColor "#404040" "" " │ " , ppLayout = const "" , ppExtras = [showLayout] , ppOrder = \ss -> @@ -72,3 +76,21 @@ main = do } toggleStructsKey config + + where + parseOut :: String -> String + parseOut str = + let colors = ["#ff878f", "#e187ff", "#8f87ff", "#87fff7", "#8bff87", "#ffe987", "#ff8787"] + components = zip (cycle colors) (splitOnAll [" - ", " · ", " "] str) + in concatMap (\(color, str) -> + printf "%s " color str) components + + trunc amt str = + if length str > amt - 4 + then take (amt - 4) str ++ " ..." + else str + + splitOnAll arr str = splitOnAll' arr [str] + splitOnAll' [] str = str + splitOnAll' (a:as) str = splitOnAll' as (concatMap (splitOn a) str) + -- cgit