summaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/accordion.gifbin0 -> 71898 bytes
-rw-r--r--doc/plugins.org120
2 files changed, 110 insertions, 10 deletions
diff --git a/doc/accordion.gif b/doc/accordion.gif
new file mode 100644
index 0000000..c21d2b0
--- /dev/null
+++ b/doc/accordion.gif
Binary files differ
diff --git a/doc/plugins.org b/doc/plugins.org
index f27d7ff..442af34 100644
--- a/doc/plugins.org
+++ b/doc/plugins.org
@@ -306,7 +306,7 @@
"--", "-O", "<fc=green>On</fc> - ", "-i", "",
"-L", "-15", "-H", "-5",
"-l", "red", "-m", "blue", "-h", "green",
- "-a", "notify-send -u critical 'Battery running out!!'",
+ "-a", "notify-once \"xmobar\" -u critical 'Battery running out!!'",
"-A", "3"]
600
#+end_src
@@ -316,7 +316,19 @@
separator affect how =<watts>= is displayed. For this monitor, neither
the generic nor the specific options have any effect on =<timeleft>=.
We are also telling the monitor to execute the unix command
- =notify-send= when the percentage left in the battery reaches 6%.
+ =notify-once= when the percentage left in the battery reaches 6%.
+
+ =notify-once= is a bash wrapper script provided with the =xmobar= package.
+ =xmobar= will run the notification command according to the refresh period,
+ this has the effect of spamming the notification tray if calling =notify-send= directly.
+ =notify-once= script deduplicates the notification by indicating to =notify-send=
+ the last notification we want to replace.
+ See [[https://codeberg.org/xmobar/xmobar/issues/746][#746]] for more information.
+ Note that your notification daemon should handle notification replacement
+ for this to work. Whether the replacement resets the timeout is also handled by the
+ notification daemon.
+ For example, the =wired-notify= implementation has =replacing_enabled=
+ and =replacing_resets_timeout= configuration options [[https://github.com/Toqozz/wired-notify/wiki/Config]].
It is also possible to specify template variables in the =-O= and =-o=
switches, as in the following example:
@@ -1077,8 +1089,8 @@
** Music monitors
*** =MPD Args RefreshRate=
- - This monitor will only be compiled if you ask for it using the
- =with_mpd= flag. It needs [[http://hackage.haskell.org/package/libmpd/][libmpd]] 5.0 or later (available on Hackage).
+ - This monitor will only be compiled if you ask for it using the =with_mpd=
+ flag. It needs [[http://hackage.haskell.org/package/libmpd/][libmpd]] 0.10.1 or later (available on Hackage).
- Aliases to =mpd=
@@ -1268,9 +1280,11 @@
- Works in the same way as =Weather=, but takes an additional argument,
a list of pairs from sky conditions to their replacement (typically a
unicode string or an icon specification).
- - Use the variable =skyConditionS= to display the replacement of the
- corresponding sky condition. All other =Weather= template variables
- are available as well.
+ - Use the variable =skyConditionS= or =weatherS= to display the replacement of
+ the corresponding sky condition. =weatherS= uses the string returned by
+ =weather= to look up a replacement, and, if that one is not found, it
+ looks up the value of =skyConditionS=. All other =Weather= template
+ variables are available as well.
For example:
@@ -1321,7 +1335,7 @@
#+begin_src haskell
Run UVMeter "Brisbane" ["-H", "3", "-L", "3", "--low", "green", "--high", "red"] 900
#+end_src
-** Other monitors
+** Other monitors and plugins
*** =CatInt n filename=
- Reads and displays an integer from the file whose path is =filename=
@@ -1351,6 +1365,94 @@
the display of those numeric fields.
- Default template: =Up: <days>d <hours>h <minutes>m=
+*** =PacmanUpdates (Zero, One, Many, Error) Rate=
+
+ - *This constructor is deprecated. Use =PacmanUpdatesK= or =PacmanUpdatesNoK= instead.*
+ - Aliases to =pacman=
+ - =Zero=: a =String= to use when the system is up to date.
+ - =One=: a =String= to use when only one update is available.
+ - =Many=: a =String= to use when several updates are available; it can contain
+ a =?= character as a placeholder for the number of updates.
+ - =Error=: a =String= to use when pacman fails for unkown reasons (e.g.
+ network error)
+ - Example:
+ #+begin_src haskell
+ PacmanUpdates ("<fc=green>up to date</fc>",
+ "<fc=yellow>1 update</fc>,
+ "<fc=red>? updates</fc>",
+ "<fc=red>!Pacman Error!</fc>")
+ 600
+ #+end_src
+
+*** =PacmanUpdatesK Rate KernName (Bool -> Either String (Int, Bool) -> String)=
+
+ - Aliases to =pacman=
+ - =KernName=: a =String= containing the name of the kernel package, e.g. `linux`, `linux-lts`, …
+ - =(Bool -> Either String (Int, Bool) -> String)=: a function producing the
+ string to be shown by the plugin; it is fed with a `Bool` telling whether
+ the running kernel is older than the installed kernel, and an `Int` and
+ `Bool` telling the number of available updates and whether one of them is a
+ kernel update (or an error message if `checkupdates` fails).
+ - Example:
+ #+begin_src haskell
+ PacmanUpdatesK
+ 600
+ "linux"
+ $ \oldKern mayb -> (if oldKern then "Running old kernel!" else "") ++
+ case mayb of
+ Left _ -> "Some error occurred!"
+ Right (0, False) -> "Up to date"
+ Right (n, pendingK) | n >= 1 -> show n ++ " updates available"
+ ++ if pendingK then " including a kernel update" else ""
+ _ -> error "This is impossible"
+ #+end_src
+
+*** =PacmanUpdatesNoK Rate (Bool -> Either String Int -> String)=
+
+ - Aliases to =pacman=
+ - =(Bool -> Either String Int -> String)=: a function producing the
+ string to be shown by the plugin; it is fed with a `Bool` telling whether
+ the running kernel is older than the installed kernel, and an `Int` telling
+ the number of available updates (or an error message if `checkupdates` fails).
+ - Example:
+ #+begin_src haskell
+ PacmanUpdatesNoK
+ 600
+ $ \oldKern mayb -> (if oldKern then "Running old kernel!" else "") ++
+ case mayb of
+ Left _ -> "Some error occurred!"
+ Right 0 -> ""
+ Right n | n >= 1 -> show n ++ " updates available"
+ _ -> error "impossible"
+ #+end_src
+
+*** =makeAccordion Tuning [Runnable]=
+
+ - Wraps other =Runnable= plugins and makes them all collapsible to a single string:
+
+ [[file:accordion.gif]]
+
+ - Aliases to =alias' tuning=, being =tuning= of type =Tuning=, so one can use multiple such "accordions"
+ - **Disclaimer**: This only works for Haskell =xmobar.hs=
+ - =Tuning=: the "settings", for which a default value is provided,
+ #+begin_src haskell
+ defaultTuning = Tuning {
+ alias' = "accordion"
+ , initial = True
+ , expand = "<>"
+ , shrink = "><"
+ }
+ #+end_src
+ - =expand=: =String= shown when the accordion is contracted (defaults to ="<>"=).
+ - =shrink=: =String= shown when the accordion is expanded (defaults to ="><"=).
+ - =initial=: =Bool= to tell whether the accordion is initially expanded (defaults to =True=).
+ - =[Runnable]=: a list of =Runnable= plugins
+
+*** =makeAccordion' Tuning [Runnable] [Runnable]=
+
+ - Like =makeAccordion=, but it accepts two distinct lists of runnables to be shown in the two states.
+ - One possible usage is to have a long-vs-short rather than an expanded-vs-collapsed policy, but it's up to you.
+
* Interfacing with window managers
:PROPERTIES:
:CUSTOM_ID: interfacing-with-window-managers
@@ -1575,8 +1677,6 @@
xmonad configuration (=xmonad.hs=), e.g. by using a custom
=~/.xmonad/build= script.
-
-
* Executing external commands
In order to execute an external command you can either write the