summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/App
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-02-03 05:14:45 +0000
committerjao <jao@gnu.org>2022-02-03 05:14:45 +0000
commitdc262d1628aa3e1bfe17ce99bfe89782b6185cc5 (patch)
tree43c2bf077702bd118a9f37646ebce50d2025d15f /src/Xmobar/App
parentd7d1873cd009edc8f3de8d141de388f638c6a926 (diff)
downloadxmobar-dc262d1628aa3e1bfe17ce99bfe89782b6185cc5.tar.gz
xmobar-dc262d1628aa3e1bfe17ce99bfe89782b6185cc5.tar.bz2
TextOutputColor -> TextOutputFormat
Thinking of eventually adding a Sway JSON output, or simply add fonts to Pango specification, so it's more than colors. Also, NoColors -> Plain.
Diffstat (limited to 'src/Xmobar/App')
-rw-r--r--src/Xmobar/App/Config.hs2
-rw-r--r--src/Xmobar/App/Opts.hs4
-rw-r--r--src/Xmobar/App/TextEventLoop.hs10
3 files changed, 8 insertions, 8 deletions
diff --git a/src/Xmobar/App/Config.hs b/src/Xmobar/App/Config.hs
index 7d3c781..a284973 100644
--- a/src/Xmobar/App/Config.hs
+++ b/src/Xmobar/App/Config.hs
@@ -66,7 +66,7 @@ defaultConfig =
, verbose = False
, signal = SignalChan Nothing
, textOutput = False
- , textOutputColors = NoColors
+ , textOutputFormat = Plain
}
-- | Return the path to the xmobar data directory. This directory is
diff --git a/src/Xmobar/App/Opts.hs b/src/Xmobar/App/Opts.hs
index 2925d26..9f19ff6 100644
--- a/src/Xmobar/App/Opts.hs
+++ b/src/Xmobar/App/Opts.hs
@@ -61,7 +61,7 @@ options =
, Option "r" ["recompile"] (NoArg Recompile) "Force recompilation"
, Option "V" ["version"] (NoArg Version) "Show version information"
, Option "T" ["text"] (OptArg TextOutput "color")
- "Write text-only output to stdout. NoColors/Ansi/Pango"
+ "Write text-only output to stdout. Plain/Ansi/Pango"
, Option "f" ["font"] (ReqArg Font "font name") "Font name"
, Option "N" ["add-font"] (ReqArg AddFont "font name")
"Add to the list of additional fonts"
@@ -136,7 +136,7 @@ doOpts conf (o:oo) =
Recompile -> doOpts' conf
TextOutput s -> doOpts' $ case s of
Just fmt -> conf {textOutput = True,
- textOutputColors = read fmt}
+ textOutputFormat = read fmt}
Nothing -> conf {textOutput = True}
Verbose -> doOpts' (conf {verbose = True})
Font s -> doOpts' (conf {font = s})
diff --git a/src/Xmobar/App/TextEventLoop.hs b/src/Xmobar/App/TextEventLoop.hs
index 3b754ac..e516298 100644
--- a/src/Xmobar/App/TextEventLoop.hs
+++ b/src/Xmobar/App/TextEventLoop.hs
@@ -27,7 +27,7 @@ import Control.Concurrent.Async (Async)
import Control.Concurrent.STM
import Xmobar.System.Signal
-import Xmobar.Config.Types (Config(textOutputColors), TextColorFormat(..))
+import Xmobar.Config.Types (Config(textOutputFormat), TextOutputFormat(..))
import Xmobar.X11.Parsers (Segment, Widget(..), parseString, tColorsString, colorComponents)
import Xmobar.App.CommandThreads (initLoop, loop)
@@ -100,16 +100,16 @@ withPangoColor (fg, bg) s =
printf fmt (xmlEscape fg) (xmlEscape bg) (xmlEscape s)
where fmt = "<span foreground=\"%s\" background=\"%s\">%s</span>"
-withColor :: TextColorFormat -> (String, String) -> String -> String
+withColor :: TextOutputFormat -> (String, String) -> String -> String
withColor format color = case format of
- NoColors -> id
+ Plain -> id
Ansi -> withAnsiColor color
Pango -> withPangoColor color
-
+
asText :: Config -> Segment -> String
asText conf (Text s, info, _, _) =
- withColor (textOutputColors conf) components s
+ withColor (textOutputFormat conf) components s
where components = colorComponents conf color
color = tColorsString info
asText colors (Hspace n, i, x, y) =