From bce86b0bb2b863a75cfb570b4d049d8105e1b9a5 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 4 Nov 2021 10:44:49 -0600 Subject: Remove extra log. Change trunc to be TCO-able. --- extras/HOME/.xmobarrc | 2 +- src/Main.hs | 29 ++++++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/extras/HOME/.xmobarrc b/extras/HOME/.xmobarrc index 5a5d4a4..5f4af3c 100644 --- a/extras/HOME/.xmobarrc +++ b/extras/HOME/.xmobarrc @@ -57,7 +57,7 @@ Config "--high", "red" ] 10, Run WeatherX "KLMO" - [ ("clear", "") + [ ("clear", "") , ("sunny", "") , ("mostly clear", "") , ("mostly sunny", "") diff --git a/src/Main.hs b/src/Main.hs index 9785b52..e18c1d8 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -49,11 +49,6 @@ main = do xmproc <- spawnPipe "xmobar" hSetEncoding xmproc utf8 - logFile <- openFile "/tmp/xmonad.log" WriteMode - - hPutStrLn logFile "·······························" - hFlush logFile - config <- applyKeys $ def { terminal = "alacritty" @@ -101,7 +96,7 @@ main = do tell " " tell $ xmobarColor "#404040" "" "│ " - tell $ "" + tell $ "" tell $ title tell $ "" } @@ -111,22 +106,22 @@ main = do xmonad (docks config) where - trunc amt str = trunc' False amt str - - trunc' :: Bool -> Int -> String -> String - trunc' _ _ [] = [] - trunc' ignore amt (a:as) = + trunc amt str = reverse $ trunc' False amt str [] + + trunc' :: Bool -> Int -> String -> String -> String + trunc' _ _ [] acc = acc + trunc' ignore amt (a:as) acc = case a of - '<' -> a : trunc' True amt as - '>' -> a : trunc' False amt as + '<' -> trunc' True amt as (a : acc) + '>' -> trunc' False amt as (a : acc) _ -> if ignore - then a : trunc' True amt as + then trunc' True amt as (a : acc) else case amt of - 0 -> trunc' False 0 as - 3 -> "..." ++ trunc' False 0 as - _ -> a : trunc' False (amt - 1) as + 0 -> trunc' False 0 as acc + 3 -> trunc' False 0 as ("..." ++ acc) + _ -> trunc' False (amt - 1) as (a : acc) splitOnAll arr str = splitOnAll' arr [str] splitOnAll' [] str = str -- cgit