summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.forgejo/workflows/test.yml32
-rw-r--r--.woodpecker.yml20
-rw-r--r--changelog.md19
-rw-r--r--doc/plugins.org83
-rw-r--r--etc/notify-once.sh31
-rw-r--r--nix/readme.org4
-rw-r--r--readme.org30
-rw-r--r--src/Xmobar.hs9
-rw-r--r--src/Xmobar/App/Compile.hs8
-rw-r--r--src/Xmobar/App/Opts.hs6
-rw-r--r--src/Xmobar/Plugins/Accordion.hs99
-rw-r--r--src/Xmobar/Plugins/ArchUpdates.hs41
-rw-r--r--src/Xmobar/Plugins/EWMH.hs2
-rw-r--r--src/Xmobar/Plugins/MarqueePipeReader.hs2
-rw-r--r--src/Xmobar/Plugins/Monitors/Disk/FreeBSD.hsc2
-rw-r--r--src/Xmobar/Plugins/Monitors/MPD.hs5
-rw-r--r--src/Xmobar/Plugins/Monitors/Mpris.hs10
-rw-r--r--src/Xmobar/Plugins/Monitors/Swap/FreeBSD.hsc5
-rw-r--r--src/Xmobar/Plugins/Monitors/Top.hs6
-rw-r--r--src/Xmobar/Plugins/PacmanUpdates.hs149
-rw-r--r--src/Xmobar/Run/Loop.hs2
-rw-r--r--src/Xmobar/Run/Template.hs21
-rw-r--r--src/Xmobar/Run/Types.hs4
-rw-r--r--src/Xmobar/X11/Loop.hs6
-rw-r--r--xmobar.cabal13
25 files changed, 422 insertions, 187 deletions
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
new file mode 100644
index 0000000..f67eda7
--- /dev/null
+++ b/.forgejo/workflows/test.yml
@@ -0,0 +1,32 @@
+on:
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+ push:
+ branches:
+ - 'master'
+
+jobs:
+ actions:
+ strategy:
+ matrix:
+ - version: [9.6, 9.4, 8]
+
+ runs-on: docker
+ container:
+ image: haskell:${{ matrix.version }}
+
+ steps:
+ - name: apt ${{ matrix.version }}
+ run: |
+ apt-get update
+ apt-get install -y xorg-dev libxrandr-dev libpango1.0-dev
+ apt-get install -y libasound2-dev libxpm-dev libmpd-dev
+ apt-get install -y hspec-discover hlint
+ - name: hlint ${{ matrix.version }}
+ run: hlint ./src
+ - name: cabal tests ${{ matrix.version }}
+ run: |
+ cabal update
+ cabal test --enable-tests -fall_extensions
+ cabal test --enable-tests -fall_extensions -f-with_xrender
diff --git a/.woodpecker.yml b/.woodpecker.yml
deleted file mode 100644
index f8aeae3..0000000
--- a/.woodpecker.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-matrix:
- GHC_VERSION:
- - 9.6
- - 9.4
- - 8
-
-steps:
- test:
- image: haskell:${GHC_VERSION}
- commands:
- - apt-get update
- - apt-get install -y xorg-dev libxrandr-dev libpango1.0-dev
- - apt-get install -y libasound2-dev libxpm-dev libmpd-dev
- - apt-get install -y hspec-discover hlint
-
- - hlint src
-
- - cabal update
- - cabal test --enable-tests -fall_extensions
- - cabal test --enable-tests -fall_extensions -f-with_xrender
diff --git a/changelog.md b/changelog.md
index 2e82e6e..aeb07e3 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,24 @@
-## Version 0.49 (unreleased)
+## Version 0.51 (unrelease)
+
+- base dependency relaxed to 4.21
+
+## Version 0.50 (June, 2025)
+
+- New plugins: `PacmanUpdates` (thanks, Alexander)
+- `ArchUpdates` deprecated in favor of `PacmanUpdates`
+ - a deprecation notice will be shown to users of that plugin in the bar in
+ the zero updates case
+- `Accordion`: new constructor to allow short version to have plugins too
+- `Swap`: update for FreeBSD 15
+- `MPD` compiled again by default with `all_extensions`.
+
+## Version 0.49 (April, 2025)
- New plugins: `ArchUpdates` and `Accordion` (thanks, Enrico Maria)
- New template variable `weatherS` for `WeatherX`.
+- New Nix flake (thanks, refaelsh)
+- `MPRIS`: Fix for duration reported by Spotify (thanks, Claudio)
+- Base dep up to 4.20 (thanks, Alexander)
## Version 0.48.1 (May, 2024)
diff --git a/doc/plugins.org b/doc/plugins.org
index 21a9452..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=
@@ -1353,21 +1365,67 @@
the display of those numeric fields.
- Default template: =Up: <days>d <hours>h <minutes>m=
-*** =ArchUpdates (Zero, One, Many) Rate=
+*** =PacmanUpdates (Zero, One, Many, Error) Rate=
- - Aliases to =arch=
+ - *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 must contain
+ - =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
- ArchUpdates ("<fc=green>up to date</fc>",
- "<fc=yellow>1 update</fc>,
- "<fc=red>? updates</fc>")
+ 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:
@@ -1390,6 +1448,11 @@
- =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
diff --git a/etc/notify-once.sh b/etc/notify-once.sh
new file mode 100644
index 0000000..1c46401
--- /dev/null
+++ b/etc/notify-once.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+help() {
+ echo "notify-send: send deduplicated notifications"
+ echo "Usage: notify-once <name> [ARGS]"
+ echo " ARGS are arguments passed directly to notify-send"
+}
+
+if [ $# -lt 1 ]; then
+ echo "Should get at least one argument, a name" >&2
+ help
+ exit 1
+fi
+APPNAME="$1"
+shift
+
+ID_PATH="/tmp/notify-state-$APPNAME"
+
+if [ -e "$ID_PATH" ]; then
+ # Exists, replace
+ ID=$(cat "$ID_PATH")
+ ID=$(notify-send -r "$ID" -p "$@")
+else
+ # Doesn't exist, create
+ ID=$(notify-send -p "$@")
+fi
+
+# Store new ID
+echo "$ID" >"$ID_PATH"
diff --git a/nix/readme.org b/nix/readme.org
index d83d232..6a492e5 100644
--- a/nix/readme.org
+++ b/nix/readme.org
@@ -29,7 +29,7 @@ Here is how to set it up:
home.stateversion = "24.05";
imports = [
- inputs.nixmobar.homemodules.mainmodule
+ inputs.nixmobar.homeModules.mainmodule
# Other imports go here.
];
@@ -67,7 +67,7 @@ Here is how to set it up:
Run MultiCoreTemp ["-t", "<fc=#bd93f9><fn=1>\xf2c9</fn></fc><avg>°", "-L", "60", "-H", "95", "-l", "white", "-n", "white", "-h", "red"] 50,
Run CatInt 0 "/sys/class/hwmon/hwmon4/fan1_input" [] 50,
Run MultiCpu ["-t", "<fc=#bd93f9><fn=1>\xf4bc</fn></fc> <vbar0><vbar1><vbar2><vbar3><vbar4><vbar5><vbar6><vbar7>", "-w", "99", "-L", "3", "-H", "50", "--normal", "green", "--high", "red"] 10,
- Run BatteryP ["BAT0"] ["-t", "<fc=#bd93f9><fn=1>󱊣</fn></fc><left>%", "-L", "10", "-H", "80", "-p", "3", "--", "-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", "3"] 600,
+ Run BatteryP ["BAT0"] ["-t", "<fc=#bd93f9><fn=1>󱊣</fn></fc><left>%", "-L", "10", "-H", "80", "-p", "3", "--", "-O", "<fc=green>On</fc> - ", "-i", "", "-L", "-15", "-H", "-5", "-l", "red", "-m", "blue", "-h", "green", "-a", "notify-once \"xmobar\" -u critical 'Battery running out!!'", "-A", "3"] 600,
Run Alsa "default" "Master" ["-t", "<fc=#bd93f9><fn=1>\xf028</fn></fc> <volume>%"],
Run Date "%a %_d %b %H:%M:%S" "date" 10,
Run Load ["-t", "<fc=#bd93f9><fn=0>L</fn></fc><load1>", "-L", "1", "-H", "3", "-d", "2"] 300,
diff --git a/readme.org b/readme.org
index 0db5051..fb2260a 100644
--- a/readme.org
+++ b/readme.org
@@ -5,9 +5,6 @@
<a href="http://hackage.haskell.org/package/xmobar">
<img src="https://img.shields.io/hackage/v/xmobar.svg" alt="hackage"/>
</a>
- <a href="https://ci.codeberg.org/xmobar/xmobar">
- <img src="https://ci.codeberg.org/api/badges/xmobar/xmobar/status.svg" alt="ci"/>
- </a>
</p>
#+end_export
@@ -31,13 +28,6 @@ channel, ~#xmobar~, at [[ircs://irc.libera.chat][Libera]].
* Breaking news
- - Starting with version 0.47.1, we are excluding MPD from the extensions
- included with ~all_extensions~ when GHC version is 9.4 or greater, because
- that seems to break cabal compilation. However, it's been reported that
- in some installations compilation with ~libmpd~ works fine: just add
- explicitly the ~with_mpd~ flag to include MPD and check for yourself.
- Compilation with stack has also been reported to work. Please see the
- comments in issue #679 for details.
- Starting with version 0.45, we use cairo/pango as our drawing engine
(instead of plain X11/Xft). From a user's point of view, that change
should be mostly transparent, except for the facts that it's allowed
@@ -182,15 +172,15 @@ channel, ~#xmobar~, at [[ircs://irc.libera.chat][Libera]].
Lennart Kolmodin, Krzysztof Kosciuszkiewicz, Dmitry Kurochkin, Todd Lunter,
Vanessa McHale, Robert J. Macomber, Dmitry Malikov, David McLean, Ulrik de
Muelenaere, Joan Milev, Marcin Mikołajczyk, Dino Morelli, Tony Morris, Eric
- Mrak, Thiago Negri, Edward O'Callaghan, Svein Ove, Martin Perner, Jens
- Petersen, Alexander Polakov, Sibi Prabakaran, Pavan Rikhi, Petr Rockai,
- Andrew Emmanuel Rosa, Sackville-West, Amir Saeid, Markus Scherer, Daniel
- Schüssler, Olivier Schneider, Alexander Shabalin, Valentin Shirokov, Peter
- Simons, Alexander Solovyov, Will Song, John Soo, John Soros, Felix Springer,
- Travis Staton, Artem Tarasov, Samuli Thomasson, Edward Tjörnhammar, Sergei
- Trofimovich, Thomas Tuegel, John Tyree, Jan Vornberger, Anton Vorontsov,
- Daniel Wagner, Zev Weiss, Phil Xiaojun Hu, Nikolay Yakimov, Edward Z. Yang,
- Leo Zhang, Norbert Zeh, and Michał Zielonka.
+ Mrak, Thiago Negri, Edward O'Callaghan, Svein Ove, Martin Perner, Alexander
+ Pankoff, Jens Petersen, Alexander Polakov, Sibi Prabakaran, Pavan Rikhi,
+ Petr Rockai, Andrew Emmanuel Rosa, Sackville-West, Amir Saeid, Markus
+ Scherer, Daniel Schüssler, Olivier Schneider, Alexander Shabalin, Valentin
+ Shirokov, Peter Simons, Alexander Solovyov, Will Song, John Soo, John Soros,
+ Felix Springer, Travis Staton, Artem Tarasov, Samuli Thomasson, Edward
+ Tjörnhammar, Sergei Trofimovich, Thomas Tuegel, John Tyree, Jan Vornberger,
+ Anton Vorontsov, Daniel Wagner, Zev Weiss, Phil Xiaojun Hu, Nikolay Yakimov,
+ Edward Z. Yang, Leo Zhang, Norbert Zeh, and Michał Zielonka.
Andrea wants to thank Robert Manea and Spencer Janssen for their help in
understanding how X works. They gave him suggestions on how to solve many
@@ -203,6 +193,6 @@ channel, ~#xmobar~, at [[ircs://irc.libera.chat][Libera]].
This software is released under a BSD-style license. See [[https://codeberg.org/xmobar/xmobar/src/branch/master/license][license]] for more
details.
- Copyright © 2010-2024 Jose Antonio Ortega Ruiz
+ Copyright © 2010-2025 Jose Antonio Ortega Ruiz
Copyright © 2007-2010 Andrea Rossato
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index 5aa748a..5a31d80 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Xmobar
--- Copyright : (c) 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2019, 2022 Jose Antonio Ortega Ruiz
+-- Copyright : (c) 2011-2015, 2017-2019, 2022, 2025 Jose Antonio Ortega Ruiz
-- (c) 2007 Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -19,15 +19,13 @@ module Xmobar (xmobar
, xmobarMain
, defaultConfig
, configFromArgs
- , tenthSeconds
, Runnable (..)
- , Exec (..)
, Command (..)
, SignalType (..)
+ , module Xmobar.Run.Exec
, module Xmobar.Config.Types
, module Xmobar.Config.Parse
, module Xmobar.Plugins.Accordion
- , module Xmobar.Plugins.ArchUpdates
, module Xmobar.Plugins.BufferedPipeReader
, module Xmobar.Plugins.CommandReader
, module Xmobar.Plugins.Date
@@ -45,6 +43,7 @@ module Xmobar (xmobar
#endif
, module Xmobar.Plugins.NotmuchMail
, module Xmobar.Plugins.Monitors
+ , module Xmobar.Plugins.PacmanUpdates
, module Xmobar.Plugins.PipeReader
, module Xmobar.Plugins.MarqueePipeReader
, module Xmobar.Plugins.StdinReader
@@ -56,7 +55,6 @@ import Xmobar.Run.Exec
import Xmobar.Config.Types
import Xmobar.Config.Parse
import Xmobar.Plugins.Accordion
-import Xmobar.Plugins.ArchUpdates
import Xmobar.Plugins.Command
import Xmobar.Plugins.BufferedPipeReader
import Xmobar.Plugins.CommandReader
@@ -74,6 +72,7 @@ import Xmobar.Plugins.Mail
import Xmobar.Plugins.MBox
#endif
import Xmobar.Plugins.Monitors
+import Xmobar.Plugins.PacmanUpdates
import Xmobar.Plugins.PipeReader
import Xmobar.Plugins.StdinReader
import Xmobar.Plugins.MarqueePipeReader
diff --git a/src/Xmobar/App/Compile.hs b/src/Xmobar/App/Compile.hs
index 5d1f48d..e5b08b7 100644
--- a/src/Xmobar/App/Compile.hs
+++ b/src/Xmobar/App/Compile.hs
@@ -3,7 +3,7 @@
------------------------------------------------------------------------------
-- |
-- Module: Xmobar.App.Compile
--- Copyright: (c) 2018 Jose Antonio Ortega Ruiz
+-- Copyright: (c) 2018, 2026 Jose Antonio Ortega Ruiz
-- License: BSD3-style (see LICENSE)
--
-- Maintainer: jao@gnu.org
@@ -20,8 +20,8 @@
module Xmobar.App.Compile(recompile, trace, xmessage) where
import Control.Monad.IO.Class
-import Control.Exception.Extensible (bracket, SomeException(..))
-import qualified Control.Exception.Extensible as E
+import Control.Exception (SomeException(..))
+import qualified Control.Exception as E
import Control.Monad (filterM, when)
import Data.List ((\\))
import System.FilePath((</>), takeExtension)
@@ -141,7 +141,7 @@ recompile confDir dataDir execName force verb = liftIO $ do
else shouldRecompile verb src bin lib
if sc
then do
- status <- bracket (openFile err WriteMode) hClose $
+ status <- withFile err WriteMode $
\errHandle ->
waitForProcess =<<
if useScript
diff --git a/src/Xmobar/App/Opts.hs b/src/Xmobar/App/Opts.hs
index 36da745..e148898 100644
--- a/src/Xmobar/App/Opts.hs
+++ b/src/Xmobar/App/Opts.hs
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- |
-- Module: Xmobar.App.Opts
--- Copyright: (c) 2018, 2019, 2020, 2022, 2023, 2024 Jose Antonio Ortega Ruiz
+-- Copyright: (c) 2018, 2019, 2020, 2022, 2023-2026 Jose Antonio Ortega Ruiz
-- License: BSD3-style (see LICENSE)
--
-- Maintainer: jao@gnu.org
@@ -61,7 +61,7 @@ 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"] (OptArg TextOutput "color")
+ , Option "T" ["text"] (OptArg TextOutput "format")
"Write text-only output to stdout. Plain/Ansi/Pango/Swaybar"
, Option "f" ["font"] (ReqArg Font "font name") "Font name"
, Option "N" ["add-font"] (ReqArg AddFont "font name")
@@ -116,7 +116,7 @@ usage = usageInfo header options ++ footer
info :: String
info = "xmobar " ++ showVersion version
- ++ "\n (C) 2010 - 2024 Jose A Ortega Ruiz"
+ ++ "\n (C) 2010 - 2025 Jose A Ortega Ruiz"
++ "\n (C) 2007 - 2010 Andrea Rossato\n "
++ mail ++ "\n" ++ license ++ "\n"
diff --git a/src/Xmobar/Plugins/Accordion.hs b/src/Xmobar/Plugins/Accordion.hs
index 6377928..ce15cee 100644
--- a/src/Xmobar/Plugins/Accordion.hs
+++ b/src/Xmobar/Plugins/Accordion.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE TupleSections, FlexibleContexts #-}
+{-# LANGUAGE RecordWildCards #-}
-----------------------------------------------------------------------------
-- |
@@ -15,18 +16,19 @@
--
-----------------------------------------------------------------------------
-module Xmobar.Plugins.Accordion (defaultTuning, makeAccordion, Tuning(..)) where
+module Xmobar.Plugins.Accordion (defaultTuning, makeAccordion, makeAccordion', Tuning(..)) where
-import Control.Concurrent.Async (withAsync)
+import Control.Concurrent.Async (concurrently_, mapConcurrently_)
import Control.Exception (finally)
-import Control.Monad (forever, join, when)
-import Control.Monad.IO.Class (liftIO)
-import Control.Monad.Reader (runReaderT, ask)
-import Control.Monad.State.Strict (evalStateT, get, modify')
-import Data.IORef (atomicModifyIORef', newIORef, readIORef)
-import Data.Maybe (isJust)
+import Control.Monad.Extra (whenM)
+import Control.Monad (forever, join)
+import Control.Monad.IO.Class (liftIO, MonadIO)
+import Control.Monad.Reader (MonadReader, runReaderT, ask)
+import Control.Monad.State.Strict (MonadState, evalStateT, get, modify')
+import Data.IORef (atomicModifyIORef', newIORef, readIORef, IORef)
+import GHC.IO.Handle.FD (withFileBlocking)
import System.Directory (removeFile)
-import System.Exit (ExitCode(..))
+import System.IO (IOMode(ReadMode), hGetContents')
import System.Process (readProcessWithExitCode)
import Xmobar.Run.Exec (Exec(..), tenthSeconds)
@@ -38,10 +40,14 @@ import Xmobar.Run.Exec (Exec(..), tenthSeconds)
data Accordion a = Accordion {
tuning :: Tuning
, plugins :: [a]
+ , shortPlugins :: [a]
} deriving (Show, Read)
makeAccordion :: Exec a => Tuning -> [a] -> Accordion a
-makeAccordion t rs = Accordion { tuning = t, plugins = rs }
+makeAccordion t rs = Accordion { tuning = t, plugins = rs, shortPlugins = [] }
+
+makeAccordion' :: Exec a => Tuning -> [a] -> [a] -> Accordion a
+makeAccordion' t rs rs' = Accordion { tuning = t, plugins = rs, shortPlugins = rs' }
data Tuning = Tuning {
alias' :: String
@@ -58,40 +64,49 @@ defaultTuning = Tuning {
, shrink = "><"
}
-instance (Exec a, Read a, Show a) => Exec (Accordion a) where
- alias (Accordion Tuning { alias' = name } _) = name
- start (Accordion Tuning { initial = initial'
- , expand = expand'
- , shrink = shrink' }
- runnables)
- cb = do
- clicked <- newIORef Nothing
+instance Exec a => Exec (Accordion a) where
+ alias (Accordion Tuning{..} _ _) = alias'
+ start (Accordion Tuning{..} runnables shortRunnables) cb = do
+ clicked <- newIORef False
(_, n, _) <- readProcessWithExitCode "uuidgen" [] ""
let pipe = "/tmp/accordion-" ++ removeLinebreak n
(_, _, _) <- readProcessWithExitCode "mkfifo" [pipe] ""
- withAsync (forever $ do (ret, _, _) <- readProcessWithExitCode "cat" [pipe] ""
- case ret of
- ExitSuccess -> atomicModifyIORef' clicked (const (Just (), ()))
- ExitFailure _ -> error "how is this possible?")
- (const $ do
- srefs <- mapM (newIORef . const "") runnables
- foldr (\(runnable, sref) acc -> withAsync (start runnable (writeToRef sref)) (const acc))
- (forever (do liftIO (tenthSeconds 1)
- clicked' <- liftIO $ readIORef clicked
- when (isJust clicked')
- (do liftIO $ clear clicked
- modify' not)
- b <- get
- if b then loop pipe else liftIO $ cb (click pipe expand'))
- `runReaderT` srefs `evalStateT` initial')
- (zip runnables srefs))
+ concurrently_ (forever $ do "" <- withFileBlocking pipe ReadMode hGetContents'
+ atomicModifyIORef' clicked (const (True, ())))
+ (do
+ strRefs <- mapM (newIORef . const "") runnables
+ strRefs' <- mapM (newIORef . const "") shortRunnables
+ let processClick = forever (do liftIO (tenthSeconds 1)
+ whenM (liftIO $ readIORef clicked)
+ (do liftIO $ clear clicked
+ modify' not)
+ get >>= loop pipe)
+ `runReaderT` (strRefs, strRefs')
+ `evalStateT` initial
+ let startRunnables = zipWith start
+ (runnables ++ shortRunnables)
+ (map writeToRef $ strRefs ++ strRefs')
+ parallel_ $ processClick:startRunnables)
`finally` removeFile pipe
where
- click file icon = "<action=`echo 1 > " ++ file ++ "`>" ++ icon ++ "</action>"
- clear = (`atomicModifyIORef'` const (Nothing, ()))
- removeLinebreak = init
- writeToRef strRef = atomicModifyIORef' strRef . const . (,())
- loop p = do
- srefs <- ask
- text <- join <$> mapM (liftIO . readIORef) srefs
- liftIO $ cb $ text ++ click p shrink'
+ loop :: (MonadIO m,
+ MonadState Bool m,
+ MonadReader ([IORef String], [IORef String]) m)
+ => String -> Bool -> m ()
+ loop pipe bool = do
+ (strRefs, strRefs') <- ask
+ text <- join <$> mapM (liftIO . readIORef) (if bool then strRefs else strRefs')
+ liftIO $ cb $ text ++ attachClick pipe (if bool then shrink else expand)
+ parallel_ = mapConcurrently_ id
+
+writeToRef :: IORef a -> a -> IO ()
+writeToRef strRef = atomicModifyIORef' strRef . const . (,())
+
+clear :: IORef Bool -> IO ()
+clear = (`atomicModifyIORef'` const (False, ()))
+
+removeLinebreak :: [a] -> [a]
+removeLinebreak = init
+
+attachClick :: String -> String -> String
+attachClick file icon = "<action=`echo -n > " ++ file ++ "`>" ++ icon ++ "</action>"
diff --git a/src/Xmobar/Plugins/ArchUpdates.hs b/src/Xmobar/Plugins/ArchUpdates.hs
deleted file mode 100644
index f803d0f..0000000
--- a/src/Xmobar/Plugins/ArchUpdates.hs
+++ /dev/null
@@ -1,41 +0,0 @@
-{-# LANGUAGE CPP #-}
-
------------------------------------------------------------------------------
--- |
--- Module : Plugins.Monitors.ArchUpdates
--- Copyright : (c) 2024 Enrico Maria De Angelis
--- License : BSD-style (see LICENSE)
---
--- Maintainer : Enrico Maria De Angelis <enricomaria.dean6elis@gmail.com>
--- Stability : unstable
--- Portability : unportable
---
--- An ArchLinux updates availablility plugin for Xmobar
---
------------------------------------------------------------------------------
-
-module Xmobar.Plugins.ArchUpdates (ArchUpdates(..)) where
-
-import System.Exit (ExitCode(..))
-import System.Process (readProcessWithExitCode)
-import Xmobar.Run.Exec
-import Xmobar.Plugins.Command (Rate)
-
-data ArchUpdates = ArchUpdates (String, String, String) Rate
- deriving (Read, Show)
-
-instance Exec ArchUpdates where
- alias (ArchUpdates _ _) = "arch"
- rate (ArchUpdates _ r) = r
- run (ArchUpdates (z, o, m) _) = do
- (exit, stdout, _) <- readProcessWithExitCode "checkupdates" [] ""
- return $ case exit of
- ExitFailure 2 -> z--ero updates
- ExitFailure 1 -> "pacman: Unknown cause of failure."
- ExitSuccess -> case length $ lines stdout of
- 0 -> impossible
- 1 -> o
- n -> m >>= \c -> if c == '?' then show n else pure c
- _ -> impossible
- where
- impossible = error "This is impossible based on pacman manpage"
diff --git a/src/Xmobar/Plugins/EWMH.hs b/src/Xmobar/Plugins/EWMH.hs
index 78f1cc0..9b583ea 100644
--- a/src/Xmobar/Plugins/EWMH.hs
+++ b/src/Xmobar/Plugins/EWMH.hs
@@ -232,7 +232,7 @@ updateClientList _ = do
where
unmanage w = asks display >>= \d -> liftIO $ selectInput d w 0
listen w = asks display >>= \d -> liftIO $ selectInput d w propertyChangeMask
- update w = mapM_ (($ w) . snd) clientHandlers
+ update w = mapM_ (`snd` w) clientHandlers
modifyClient :: Window -> (Client -> Client) -> M ()
modifyClient w f = modify (\s -> s { clients = Map.alter f' w $ clients s })
diff --git a/src/Xmobar/Plugins/MarqueePipeReader.hs b/src/Xmobar/Plugins/MarqueePipeReader.hs
index 075503c..a6d590e 100644
--- a/src/Xmobar/Plugins/MarqueePipeReader.hs
+++ b/src/Xmobar/Plugins/MarqueePipeReader.hs
@@ -60,7 +60,7 @@ writer txt sep len rate chan cb = do
Nothing -> tenthSeconds rate >> writer (drop 1 txt) sep len rate chan cb
toInfTxt :: String -> String -> String
-toInfTxt line sep = concat (repeat $ line ++ " " ++ sep ++ " ")
+toInfTxt line sep = cycle (line ++ " " ++ sep ++ " ")
checkPipe :: FilePath -> IO ()
checkPipe file = handle (\(SomeException _) -> waitForPipe) $ do
diff --git a/src/Xmobar/Plugins/Monitors/Disk/FreeBSD.hsc b/src/Xmobar/Plugins/Monitors/Disk/FreeBSD.hsc
index 296ba6c..b5530f1 100644
--- a/src/Xmobar/Plugins/Monitors/Disk/FreeBSD.hsc
+++ b/src/Xmobar/Plugins/Monitors/Disk/FreeBSD.hsc
@@ -39,7 +39,7 @@ import Xmobar.Plugins.Monitors.Disk.Common (
, Path
)
-import qualified Control.Exception.Extensible as E
+import qualified Control.Exception as E
import qualified Data.List as DL
import qualified Data.Map as DM
import qualified Data.Set as DS
diff --git a/src/Xmobar/Plugins/Monitors/MPD.hs b/src/Xmobar/Plugins/Monitors/MPD.hs
index 7ecbc0c..b091147 100644
--- a/src/Xmobar/Plugins/Monitors/MPD.hs
+++ b/src/Xmobar/Plugins/Monitors/MPD.hs
@@ -109,8 +109,9 @@ parseMPD (Right st) song opts = do
si = stateGlyph s opts
vol = int2str $ fromMaybe 0 (M.stVolume st)
(p, t) = fromMaybe (0, 0) (M.stTime st)
- [lap, len, remain] = map showTime
- [floor p, floor t, max 0 (floor t - floor p)]
+ lap = showTime $ floor p
+ len = showTime $ floor t
+ remain = showTime $ max 0 (floor t - floor p)
b = if t > 0 then realToFrac $ p / t else 0
plen = int2str $ M.stPlaylistLength st
ppos = maybe "" (int2str . (+1)) $ M.stSongPos st
diff --git a/src/Xmobar/Plugins/Monitors/Mpris.hs b/src/Xmobar/Plugins/Monitors/Mpris.hs
index ee30ad3..eb9595b 100644
--- a/src/Xmobar/Plugins/Monitors/Mpris.hs
+++ b/src/Xmobar/Plugins/Monitors/Mpris.hs
@@ -28,7 +28,7 @@ import qualified DBus.Client as DC
import Control.Arrow ((***))
import Data.Maybe ( fromJust )
import Data.Int ( Int32, Int64 )
-import Data.Word ( Word32 )
+import Data.Word ( Word32, Word64 )
import System.IO.Unsafe ( unsafePerformIO )
import Control.Exception (try)
@@ -136,17 +136,17 @@ makeList version md = map getStr (fieldsList version) where
"xesam:trackNumber" -> printf "%02d" num
_ -> (show::Int32 -> String) num
pw32 v = printf "%02d" (fromVar v::Word32)
- plen str v = let num = fromVar v in
- case str of
+ plen str num = case str of
"mpris:length" -> formatTime (num `div` 1000000)
- _ -> (show::Int64 -> String) num
+ _ -> show num
getStr str = case lookup str md of
Nothing -> ""
Just v -> case variantType v of
TypeString -> fromVar v
TypeInt32 -> pInt str v
TypeWord32 -> pw32 v
- TypeInt64 -> plen str v
+ TypeWord64 -> plen str (fromVar v :: Word64)
+ TypeInt64 -> plen str (fromVar v :: Int64)
TypeArray TypeString ->
let x = arrayItems (fromVar v) in
if null x then "" else fromVar (head x)
diff --git a/src/Xmobar/Plugins/Monitors/Swap/FreeBSD.hsc b/src/Xmobar/Plugins/Monitors/Swap/FreeBSD.hsc
index 9c74e36..90c58c1 100644
--- a/src/Xmobar/Plugins/Monitors/Swap/FreeBSD.hsc
+++ b/src/Xmobar/Plugins/Monitors/Swap/FreeBSD.hsc
@@ -71,11 +71,10 @@ instance Storable SwapData where
poke _ _ = pure ()
-
isEnabled :: IO Bool
isEnabled = do
- enabled <- sysctlReadUInt "vm.swap_enabled"
- return $ enabled == 1
+ nswapdev <- sysctlReadUInt "vm.nswapdev"
+ return $ nswapdev > 0
parseMEM' :: Bool -> IO [Float]
parseMEM' False = return []
diff --git a/src/Xmobar/Plugins/Monitors/Top.hs b/src/Xmobar/Plugins/Monitors/Top.hs
index 3bfe6fd..b2e573b 100644
--- a/src/Xmobar/Plugins/Monitors/Top.hs
+++ b/src/Xmobar/Plugins/Monitors/Top.hs
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Plugins.Monitors.Top
--- Copyright : (c) 2010, 2011, 2012, 2013, 2014, 2018, 2022 Jose A Ortega Ruiz
+-- Copyright : (c) 2010-2014, 2018, 2022, 2025 Jose A Ortega Ruiz
-- License : BSD-style (see LICENSE)
--
-- Maintainer : Jose A Ortega Ruiz <jao@gnu.org>
@@ -20,7 +20,7 @@ import Xmobar.Plugins.Monitors.Common
import Data.IORef (newIORef, readIORef, writeIORef)
import Data.List (sortBy)
-import Data.Ord (comparing)
+import Data.Ord (comparing, Down (..))
import Data.Time.Clock (getCurrentTime, diffUTCTime)
import Xmobar.Plugins.Monitors.Top.Common (
@@ -66,7 +66,7 @@ showInfo nm sms mms = do
sortTop :: [(String, Float)] -> [(String, Float)]
-sortTop = sortBy (flip (comparing snd))
+sortTop = sortBy (comparing (Down . snd))
showMemInfo :: Float -> MemInfo -> Monitor [String]
showMemInfo scale (nm, rss) =
diff --git a/src/Xmobar/Plugins/PacmanUpdates.hs b/src/Xmobar/Plugins/PacmanUpdates.hs
new file mode 100644
index 0000000..03b556f
--- /dev/null
+++ b/src/Xmobar/Plugins/PacmanUpdates.hs
@@ -0,0 +1,149 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeFamilyDependencies #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE ViewPatterns #-}
+
+-----------------------------------------------------------------------------
+
+-----------------------------------------------------------------------------
+
+{- |
+Module : Plugins.Monitors.PacmanUpdates
+Copyright : (c) 2024, 2026 Enrico Maria De Angelis
+ , (c) 2025 Alexander Pankoff
+ , (c) 2026 Enrico Maria De Angelis
+License : BSD-style (see LICENSE)
+
+Maintainer : Enrico Maria De Angelis <enricomaria.dean6elis@gmail.com>
+Stability : unstable
+Portability : unportable
+
+A Pacman updates availablility plugin for Xmobar. It also informs whether a kernel update is
+available (provided the name of the kernel package), and whether the running kernel is older
+than the installed one.
+-}
+module Xmobar.Plugins.PacmanUpdates (
+ {-# DEPRECATED "This ctor is DEPRECATED; please use `PacmanUpdates` type and `PacmanUpdatesK` and `PacmanUpdatesNoK` constructors instead." #-}
+ pattern PacmanUpdates
+ , PacmanUpdates ()
+ , pattern PacmanUpdatesK
+ , pattern PacmanUpdatesNoK) where
+
+import System.Exit (ExitCode (..))
+import System.Process (readProcessWithExitCode)
+import Xmobar.Plugins.Command (Rate)
+import Xmobar.Run.Exec
+import Data.Tuple.Extra (fst3)
+import Data.Kind (Type)
+import Data.Functor ((<&>))
+import Data.Void (Void)
+import Control.Arrow ((&&&))
+import qualified Data.Vector as V
+
+-- | Deprecated plugin ctor (will be deleted in 2027).
+-- Use `PacmanUpdatesK` or `PacmanUpdatesNoK` instead.
+pattern PacmanUpdates :: (String, String, String, String) -- ^ `String`s to be shown for 0, 1, ≥ 2 updates,
+ -- and for error respectively (in the 3rd string, for
+ -- ≥ 2 updates, any occurrence of the '?' character
+ -- is a placeholder for the number of available updates).
+ -> Rate -- ^ `Rate` of update (see [Xmobar doc](https://codeberg.org/xmobar/xmobar/src/commit/39fd70308c3aef5402abe7152ade76ff7bb331bb/src/Xmobar/Plugins/Command.hs#L34)).
+ -> PacmanUpdates False
+pattern PacmanUpdates irrelevant <- (error "PacmanUpdates: PacmanUpdates is a build-only pattern synonym (a ctor synonym)." -> irrelevant)
+ where PacmanUpdates zome r
+ = let (z, o, m, e) = zome
+ printer = const
+ $ (++ deprecationNote)
+ . \case Left _ -> e
+ Right 0 -> z
+ Right 1 -> o
+ Right n -> m >>= \c -> if c == '?'
+ then show n
+ else pure c
+ deprecationNote = " <fc=#ff0000>(<action=`xdg-open https://codeberg.org/xmobar/xmobar/pulls/765`>"
+ ++ "deprecated plugin, click here</action>)</fc>"
+ in PacmanUpdatesNoK r printer
+
+-- | PacmanUpdates plugin parametrized over `Bool` kind: if `True` the plugin
+-- will detect if there's pending update(s) for the kernel package; if `False`
+-- it wont.
+data PacmanUpdates (b :: Bool)
+ = Make -- ^ Constructor.
+ Rate -- ^ `Rate` of update (see [Xmobar doc](https://codeberg.org/xmobar/xmobar/src/commit/39fd70308c3aef5402abe7152ade76ff7bb331bb/src/Xmobar/Plugins/Command.hs#L34)).
+ (Arg b) -- ^ Optional further argument. See instances of `Updates`.
+ (Printer b) -- ^ Printer. See instances of `Updates` for its signature.
+
+instance Show (PacmanUpdates b) where
+ show = error "PacmanUpdates: Show instance is stub"
+
+instance Read (PacmanUpdates b) where
+ readsPrec = error "PacmanUpdates: Read instance is stub"
+
+instance Updates b => Exec (PacmanUpdates (b :: Bool)) where
+ alias = const "pacman"
+ rate (Make r _ _) = r
+ run = Xmobar.Plugins.PacmanUpdates.run'
+
+class Updates (b :: Bool) where
+ -- | See `Updates`'s instances.
+ type Arg b = (a :: Type) | a -> b
+ -- | See `Updates`'s instances.
+ type Printer b = (p :: Type) | p -> b
+ -- | This is the implementation of `Xmobar.Run.Exec.run`.
+ run' :: PacmanUpdates b -> IO String
+
+-- | No additional argument required for constructing the plugin;
+-- the user-provided printer is fed with a `Bool` telling whether
+-- the system is running an outdated kernel, and an `Int` telling
+-- the number of available updates (or `Left` if an error occurred
+-- when calling `checkupdates`).
+instance Updates False where
+ type Arg False = Void
+ type Printer False = Bool -> Either String Int -> String
+ run' (Make _ _ printer)
+ = printer
+ <$> kernIsOld
+ <*> (fmap V.length <$> checkUpdates)
+
+-- | Constructing the plugin requires an additional `String` telling the name
+-- name of the kernel package; the user-provided printer is fed with a `Bool`
+-- telling whether the system is running an outdated kernel, and an `(Int,
+-- Bool)` pair telling the number of available updates and whether one of these
+-- is a kernel update (or `Left` if an error occurred when calling
+-- `checkupdates`).
+instance Updates True where
+ type Arg True = String
+ type Printer True = Bool -> Either String (Int, Bool) -> String
+ run' (Make _ kernName printer)
+ = printer
+ <$> kernIsOld
+ <*> (fmap (V.length &&& elem kernName) <$> checkUpdates)
+
+-- | Pattern synonym used to construct a `PacmanUpdates True`.
+pattern PacmanUpdatesK :: Rate -> Arg True -> Printer True -> PacmanUpdates True
+pattern PacmanUpdatesK r a p = Make r a p
+
+-- | Pattern synonym used to construct a `PacmanUpdates False`.
+pattern PacmanUpdatesNoK :: Rate -> Printer False -> PacmanUpdates False
+pattern PacmanUpdatesNoK r p <- Make r _ p
+ where PacmanUpdatesNoK r p = Make r undefined p
+
+checkUpdates :: IO (Either String (V.Vector String))
+checkUpdates = readProcessWithExitCode "checkupdates" [] ""
+ <&> \case (ExitFailure 2, "", "") -> Right V.empty
+ (ExitSuccess, stdout, "")
+ -> let pkgName = takeWhile (/= ' ')
+ pkgs = V.fromList $ fmap pkgName $ lines stdout
+ in case V.length pkgs of
+ 0 -> impossible
+ _ -> Right pkgs
+ (ExitFailure 1, _, _) -> Left "checkupdates: unknown cause of failure."
+ _ -> impossible
+
+kernIsOld :: IO Bool
+kernIsOld = (/= ExitSuccess) . exitCode <$> readProcessWithExitCode "modinfo" ["-n", "i915"] ""
+ where exitCode = fst3
+
+impossible :: a
+impossible = error "This is impossible, according to my knowledge."
diff --git a/src/Xmobar/Run/Loop.hs b/src/Xmobar/Run/Loop.hs
index bda41ff..6775961 100644
--- a/src/Xmobar/Run/Loop.hs
+++ b/src/Xmobar/Run/Loop.hs
@@ -57,7 +57,7 @@ type LoopFunction = TMVar SignalType -> TVar [String] -> IO ()
loop :: Config -> LoopFunction -> IO ()
loop conf looper = withDeferSignals $ do
- cls <- mapM (parseTemplate (commands conf) (sepChar conf))
+ let cls = map (parseTemplate (commands conf) (sepChar conf))
(splitTemplate (alignSep conf) (template conf))
let confSig = unSignalChan (signal conf)
sig <- maybe newEmptyTMVarIO pure confSig
diff --git a/src/Xmobar/Run/Template.hs b/src/Xmobar/Run/Template.hs
index 68feacb..0e066dc 100644
--- a/src/Xmobar/Run/Template.hs
+++ b/src/Xmobar/Run/Template.hs
@@ -50,21 +50,20 @@ templateParser s = many $ templateStringParser s
-- | Actually runs the template parsers over a (segment of) a template
-- string, returning a list of runnables with their prefix and suffix.
-parseTemplate :: [Runnable] -> String -> String -> IO [(Runnable,String,String)]
+parseTemplate :: [Runnable] -> String -> String -> [(Runnable,String,String)]
parseTemplate c sepChar s =
- do str <- case parse (templateParser sepChar) "" s of
- Left _ -> return [("", s, "")]
- Right x -> return x
- let cl = map alias c
- m = Map.fromList $ zip cl c
- return $ combine c m str
+ let str = case parse (templateParser sepChar) "" s of
+ Left _ -> [("", s, "")]
+ Right x -> x
+ cl = map alias c
+ m = Map.fromList $ zip cl c
+ in combine m str
-- | Given a finite "Map" and a parsed template produce the resulting
-- output string.
-combine :: [Runnable] -> Map.Map String Runnable -> [(String, String, String)]
- -> [(Runnable,String,String)]
-combine _ _ [] = []
-combine c m ((ts,s,ss):xs) = (com, s, ss) : combine c m xs
+combine :: Map.Map String Runnable -> [(String, String, String)] -> [(Runnable,String,String)]
+combine _ [] = []
+combine m ((ts,s,ss):xs) = (com, s, ss) : combine m xs
where com = Map.findWithDefault dflt ts m
dflt = Run $ Com ts [] [] 10
diff --git a/src/Xmobar/Run/Types.hs b/src/Xmobar/Run/Types.hs
index bb573c8..8b9caa4 100644
--- a/src/Xmobar/Run/Types.hs
+++ b/src/Xmobar/Run/Types.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE TypeOperators, CPP #-}
+{-# LANGUAGE DataKinds #-}
------------------------------------------------------------------------------
-- |
-- Module: Xmobar.Run.Types
@@ -19,7 +20,7 @@
module Xmobar.Run.Types(runnableTypes) where
import {-# SOURCE #-} Xmobar.Run.Runnable()
-import Xmobar.Plugins.ArchUpdates
+import Xmobar.Plugins.PacmanUpdates
import Xmobar.Plugins.Command
import Xmobar.Plugins.Monitors
import Xmobar.Plugins.Date
@@ -60,7 +61,6 @@ infixr :*:
runnableTypes :: Command :*: Monitors :*: Date :*: PipeReader :*:
BufferedPipeReader :*: CommandReader :*: StdinReader :*:
XMonadLog :*: EWMH :*: Kbd :*: Locks :*: NotmuchMail :*:
- ArchUpdates :*:
#ifdef INOTIFY
Mail :*: MBox :*:
#endif
diff --git a/src/Xmobar/X11/Loop.hs b/src/Xmobar/X11/Loop.hs
index 2dfb34d..0425cff 100644
--- a/src/Xmobar/X11/Loop.hs
+++ b/src/Xmobar/X11/Loop.hs
@@ -170,7 +170,7 @@ updateConfigPosition disp cfg =
runActions :: D.Actions -> A.Button -> X11.Position -> IO ()
runActions actions button pos =
mapM_ A.runAction $
- filter (\(A.Spawn b _) -> button `elem` b) $
- concatMap (\(a,_,_) -> a) $
- filter (\(_, from, to) -> pos' >= from && pos' <= to) actions
+ concatMap
+ (filter (\ (A.Spawn b _) -> button `elem` b) . (\ (a, _, _) -> a))
+ (filter (\ (_, from, to) -> pos' >= from && pos' <= to) actions)
where pos' = fromIntegral pos
diff --git a/xmobar.cabal b/xmobar.cabal
index 0b548b1..5d4dd07 100644
--- a/xmobar.cabal
+++ b/xmobar.cabal
@@ -1,5 +1,5 @@
name: xmobar
-version: 0.49
+version: 0.51
homepage: https://codeberg.org/xmobar/xmobar
synopsis: A Minimalistic Text Based Status Bar
description: Xmobar is a minimalistic text based status bar.
@@ -26,6 +26,7 @@ extra-source-files: readme.org, changelog.md,
etc/xmobar.hs,
etc/xmonadpropwrite.hs,
etc/xmobar.el
+ etc/notify-once.sh
source-repository head
type: git
@@ -150,7 +151,6 @@ library
Xmobar.X11.Text,
Xmobar.X11.Types,
Xmobar.X11.Window,
- Xmobar.Plugins.ArchUpdates,
Xmobar.Plugins.Command,
Xmobar.Plugins.BufferedPipeReader,
Xmobar.Plugins.CommandReader,
@@ -158,6 +158,7 @@ library
Xmobar.Plugins.EWMH,
Xmobar.Plugins.HandleReader,
Xmobar.Plugins.QueueReader,
+ Xmobar.Plugins.PacmanUpdates,
Xmobar.Plugins.PipeReader,
Xmobar.Plugins.MarqueePipeReader,
Xmobar.Plugins.StdinReader,
@@ -200,14 +201,13 @@ library
build-depends:
aeson >= 1.4.7.1,
async,
- base >= 4.11.0 && < 4.20,
+ base >= 4.11.0 && < 4.22,
bytestring >= 0.10.8.2,
cairo >= 0.13,
colour >= 2.3.6,
containers,
directory,
extra,
- extensible-exceptions == 0.1.*,
filepath,
mtl >= 2.1 && < 2.4,
old-locale,
@@ -221,6 +221,7 @@ library
transformers,
unix,
utf8-string >= 0.3 && < 1.1,
+ vector,
X11 >= 1.6.1
if impl(ghc < 8.0.2)
@@ -265,8 +266,8 @@ library
cereal >= 0.5.8.1
cpp-options: -DUSE_NL80211
- if flag(with_mpd) || (flag(all_extensions) && impl(ghc < 9.4))
- build-depends: libmpd >= 0.9.2.0
+ if flag(with_mpd) || flag(all_extensions)
+ build-depends: libmpd >= 0.10.0.1
other-modules: Xmobar.Plugins.Monitors.MPD
cpp-options: -DLIBMPD