summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/quick-start.org8
-rw-r--r--readme.org26
-rw-r--r--src/Xmobar/App/Config.hs2
-rw-r--r--src/Xmobar/App/Opts.hs41
4 files changed, 52 insertions, 25 deletions
diff --git a/doc/quick-start.org b/doc/quick-start.org
index 2f8591d..1c48c43 100644
--- a/doc/quick-start.org
+++ b/doc/quick-start.org
@@ -151,10 +151,10 @@ the =Config= block in your configuration.
- =template= The output template.
-- =wmClass= The value for the window's X11 WM_CLASS property. Defaults
+- =wmClass= The value for the window's X11 ~WM_CLASS~ property. Defaults
to "xmobar".
-- =wmName= The value for the window's X11 WM_NAME property. Defaults to
+- =wmName= The value for the window's X11 ~WM_NAME~ property. Defaults to
"xmobar".
- =textOutput= When True, instead of running as an X11 application,
@@ -164,7 +164,7 @@ the =Config= block in your configuration.
- =textOutputColors= NoColors, Ansi or Pango, to emit, when in text
mode, escape color sequences using ANSI controls (for terminals) or
- pango markup. Default is Ansi.
+ pango markup. Default is NoColors.
** The Output =template=
@@ -383,7 +383,7 @@ This is the list of command line options (the output of =xmobar --help=):
-C command --add-command=command Add to the list of commands to be executed
-x screen --screen=screen On which X screen number to start
-p position --position=position Specify position of xmobar. Same syntax as in config file
- -T --text Write output to stdout
+ -T [format] --text[=format] Write output to stdout
Mail bug reports and suggestions to <mail@jao.io>
#+end_src
diff --git a/readme.org b/readme.org
index 36ad94a..ac9e72e 100644
--- a/readme.org
+++ b/readme.org
@@ -108,7 +108,7 @@
xmobar can be run inside a terminal o console, or its output piped
to other applications, and there is no need for an X11 display
(so, for instance, you could pipe xmobar's output to a Wayland
- application, such as waybar.)
+ application, such as swaybar.)
To run xmobar in text mode, either pass the =-T= flag to its
invocation:
@@ -117,7 +117,29 @@
xmobar -T /path/to/config &
#+end_src
- or set the parameter =textOutput= to True in its configuration.
+ or set the parameter =textOutput= to True in its configuration. You
+ can also specify the format of color escapes, for instance
+ omitting them altogether with ~NoColors~:
+
+ #+begin_src shell
+ xmobar -TNoColors /path/to/config &
+ #+end_src
+
+ Other options are ~Ansi~ and ~Pango~.
+
+*** Using xmobar in Wayland with swaybar
+
+ In text mode, xmobar can be told to ouput its information using
+ pango markup for colors, and it that way you can use it with
+ swaybar. Here's a minimal ~bar~ configuration for sway's
+ configuration file:
+
+ #+begin_src conf
+ bar {
+ status_command xmobar -TPango
+ pango_markup enabled
+ }
+ #+end_src
* Configuration and further Links
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]})