summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-02-02 21:32:01 +0000
committerjao <jao@gnu.org>2022-02-02 21:32:01 +0000
commitd7d1873cd009edc8f3de8d141de388f638c6a926 (patch)
treeb87363d1656369b2a9413bf025971ebbc8ff1309 /src
parent560c68cd4f0890a6e273b4a5918ac71416d64d88 (diff)
downloadxmobar-d7d1873cd009edc8f3de8d141de388f638c6a926.tar.gz
xmobar-d7d1873cd009edc8f3de8d141de388f638c6a926.tar.bz2
Allow specifying color format as a -T argument
Diffstat (limited to 'src')
-rw-r--r--src/Xmobar/App/Config.hs2
-rw-r--r--src/Xmobar/App/Opts.hs41
2 files changed, 24 insertions, 19 deletions
diff --git a/src/Xmobar/App/Config.hs b/src/Xmobar/App/Config.hs
index 34127aa..7d3c781 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 = Ansi
+ , textOutputColors = NoColors
}
-- | 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 39d3060..2925d26 100644
--- a/src/Xmobar/App/Opts.hs
+++ b/src/Xmobar/App/Opts.hs
@@ -33,25 +33,25 @@ data Opts = Help
| Verbose
| Recompile
| Version
- | TextOutput
- | Font String
- | AddFont String
- | BgColor String
- | FgColor String
- | Alpha String
+ | TextOutput (Maybe String)
+ | Font String
+ | AddFont String
+ | BgColor String
+ | FgColor String
+ | Alpha String
| T
| B
| D
- | AlignSep String
- | Commands String
+ | AlignSep String
+ | Commands String
| AddCommand String
- | SepChar String
- | Template String
- | OnScr String
- | IconRoot String
- | Position String
- | WmClass String
- | WmName String
+ | SepChar String
+ | Template String
+ | OnScr String
+ | IconRoot String
+ | Position String
+ | WmClass String
+ | WmName String
deriving (Show, Eq)
options :: [OptDescr Opts]
@@ -60,9 +60,11 @@ options =
, Option "v" ["verbose"] (NoArg Verbose) "Emit verbose debugging messages"
, Option "r" ["recompile"] (NoArg Recompile) "Force recompilation"
, Option "V" ["version"] (NoArg Version) "Show version information"
- , Option "T" ["text"] (NoArg TextOutput) "Write text-only output to stdout"
+ , Option "T" ["text"] (OptArg TextOutput "color")
+ "Write text-only output to stdout. NoColors/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"
+ , Option "N" ["add-font"] (ReqArg AddFont "font name")
+ "Add to the list of additional fonts"
, Option "w" ["wmclass"] (ReqArg WmClass "class") "X11 WM_CLASS property"
, Option "n" ["wmname"] (ReqArg WmName "name") "X11 WM_NAME property"
, Option "B" ["bgcolor"] (ReqArg BgColor "bg color" )
@@ -132,7 +134,10 @@ doOpts conf (o:oo) =
Help -> doOpts' conf
Version -> doOpts' conf
Recompile -> doOpts' conf
- TextOutput -> doOpts' (conf {textOutput = True})
+ TextOutput s -> doOpts' $ case s of
+ Just fmt -> conf {textOutput = True,
+ textOutputColors = read fmt}
+ Nothing -> conf {textOutput = True}
Verbose -> doOpts' (conf {verbose = True})
Font s -> doOpts' (conf {font = s})
AddFont s -> doOpts' (conf {additionalFonts = additionalFonts conf ++ [s]})