summaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorAlexander 'ccntrq' Pankoff <ccntrq@screenri.de>2026-06-01 17:22:49 +0200
committerjao <mail@jao.io>2026-06-16 19:51:56 +0200
commitc294fe3149776f09c497e4d12f5d3eb125b30ca4 (patch)
tree7d455e33f96051100c0b87de51e5bac836f87533 /doc
parent0646c6cd7337e44d731e67f130b4d0e3d5ce7890 (diff)
downloadxmobar-c294fe3149776f09c497e4d12f5d3eb125b30ca4.tar.gz
xmobar-c294fe3149776f09c497e4d12f5d3eb125b30ca4.tar.bz2
Allow predicate based kernel checks in PacmanUpdates
PacmanUpdates previously supported either no kernel update detection or matching a single kernel package name. That works for Arch's `linux` package, but not for Manjaro's series specific kernel packages such as `linux618` or `linux70`. Replace the Bool indexed API with an explicit kernel check kind and add `PacmanUpdatesPredicateK`, which accepts a `String -> Bool` predicate for detecting kernel updates from the package list.
Diffstat (limited to 'doc')
-rw-r--r--doc/plugins.org34
1 files changed, 33 insertions, 1 deletions
diff --git a/doc/plugins.org b/doc/plugins.org
index 442af34..4d14771 100644
--- a/doc/plugins.org
+++ b/doc/plugins.org
@@ -1367,7 +1367,7 @@
*** =PacmanUpdates (Zero, One, Many, Error) Rate=
- - *This constructor is deprecated. Use =PacmanUpdatesK= or =PacmanUpdatesNoK= instead.*
+ - *This constructor is deprecated. Use =PacmanUpdatesK=, =PacmanUpdatesPredicateK=, 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.
@@ -1407,6 +1407,38 @@
_ -> error "This is impossible"
#+end_src
+*** =PacmanUpdatesPredicateK Rate IsKernelUpdate (Bool -> Either String (Int, Bool) -> String)=
+
+ - Aliases to =pacman=
+ - =IsKernelUpdate=: a =String -> Bool= predicate that receives each available
+ package name and returns =True= for kernel packages. This is useful for
+ distributions with versioned kernel package names, such as Manjaro's
+ =linux618= or =linux70= packages.
+ - =(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
+ matches the kernel predicate (or an error message if =checkupdates= fails).
+ - Example:
+ This example requires =import Data.Char (isDigit)= and
+ =import Data.List (stripPrefix)= in your configuration.
+ #+begin_src haskell
+ PacmanUpdatesPredicateK
+ 600
+ ( \packageName ->
+ case stripPrefix "linux" packageName of
+ Just n -> not (null n) && all isDigit n
+ Nothing -> False
+ )
+ $ \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=