From 17fe2b579f096ab4b3daacaca2db2d5443fd5e92 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/Internal/LayoutDraw.hs | 19 ++++++++++--------- src/Main.hs | 38 ++++++++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/Internal/LayoutDraw.hs b/src/Internal/LayoutDraw.hs index 7dc2087..4bb069a 100644 --- a/src/Internal/LayoutDraw.hs +++ b/src/Internal/LayoutDraw.hs @@ -54,13 +54,13 @@ drawPng l = do -- (0.9, 0.9, 1.0), -- (0.8, 0.8, 1.0), -- (0.7, 0.7, 1.0), - (0.6, 0.6, 0.8), - (0.5, 0.5, 0.8), - (0.4, 0.4, 0.8), - (0.3, 0.3, 0.8), - (0.2, 0.2, 0.8), - (0.1, 0.1, 0.8), - (0.0, 0.0, 0.8) + (0.8, 0.6, 0.6), + (0.8, 0.5, 0.5), + (0.8, 0.4, 0.4), + (0.8, 0.3, 0.3), + (0.8, 0.2, 0.2), + (0.8, 0.1, 0.1), + (0.8, 0.0, 0.0) ] exists <- liftIO $ doesFileExist filepathXpm @@ -71,7 +71,7 @@ drawPng l = do setLineCap LineCapButt setLineJoin LineJoinMiter - forM_ (reverse $ zip (map (second padR) rects) colors) $ + forM_ (reverse $ zip (map (second extraPad) rects) colors) $ \((wind, Rectangle x y w h), (r, g, b)) -> do setSourceRGBA r g b 1 @@ -93,7 +93,8 @@ drawPng l = do return filepathXpm where - padR = id + extraPad (Rectangle x y w h) = + Rectangle (x + 100) (y + 100) (w - 100) (h - 100) -- padR (Rectangle x y w h) = -- Rectangle x y (max 1 $ w - 120) (max 1 $ h - 120) 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