diff options
| author | Josh Rahm <rahm@google.com> | 2021-11-02 00:41:08 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:45 -0600 |
| commit | 17fe2b579f096ab4b3daacaca2db2d5443fd5e92 (patch) | |
| tree | 7d8eb4f25a8d53f2f33508e29e918ecf4f416156 /src | |
| parent | 8475c103767344bd9c6a47052794cc14675d24cd (diff) | |
| download | rde-17fe2b579f096ab4b3daacaca2db2d5443fd5e92.tar.gz rde-17fe2b579f096ab4b3daacaca2db2d5443fd5e92.tar.bz2 rde-17fe2b579f096ab4b3daacaca2db2d5443fd5e92.zip | |
Big powerpill added to my XMonad and XMobar.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Internal/LayoutDraw.hs | 19 | ||||
| -rw-r--r-- | src/Main.hs | 38 |
2 files changed, 40 insertions, 17 deletions
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 = "<fn=1><fc=#808080> · </fc></fn>" + ppCurrent = xmobarColor "#ff8888" "red" . printf "<fn=1>%s</fn>" + , ppVisible = xmobarColor "#8888ff" "" . printf "<fn=0>%s</fn>" + , ppHidden = xmobarColor "#888888" "" . printf "<fn=2>%s</fn>" + , ppWsSep = "<fn=1><fc=#808080> </fc></fn>" , ppTitle = - xmobarColor "#8888ff" "" . printf "%s" . - (printf "<fn=1>%s</fn>" :: String -> String) + xmobarColor "#808080" "" . + printf "<fn=3><fc=#bbbbbb>%s</fc></fn>" . + 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 "<fc=%s>%s</fc> " 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) + |