aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2021-11-04 10:44:49 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:45 -0600
commitbce86b0bb2b863a75cfb570b4d049d8105e1b9a5 (patch)
tree19ab542802561a25d6714a11cd78382034d58d71 /src
parent8c1296e7e66e78ca78d824b67f0b334e3c981edb (diff)
downloadrde-bce86b0bb2b863a75cfb570b4d049d8105e1b9a5.tar.gz
rde-bce86b0bb2b863a75cfb570b4d049d8105e1b9a5.tar.bz2
rde-bce86b0bb2b863a75cfb570b4d049d8105e1b9a5.zip
Remove extra log. Change trunc to be TCO-able.
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs29
1 files changed, 12 insertions, 17 deletions
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 " </fc></fn>"
tell $ xmobarColor "#404040" "" "│ "
- tell $ "<fc=#808080><fn=3>"
+ tell $ "<fc=#a0a0a0><fn=3>"
tell $ title
tell $ "</fn></fc>"
}
@@ -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