55//! - `pacman` for Arch based system
66//! - `aur` for Arch based system
77//! - `dnf` for Fedora based system
8+ //! - `xbps` for Void Linux
89//!
910//! # Configuration
1011//!
2829//! `pacman` | Number of updates available in Arch based system | Number | -
2930//! `aur` | Number of updates available in Arch based system | Number | -
3031//! `dnf` | Number of updates available in Fedora based system | Number | -
32+ //! `xbps` | Number of updates available in Void Linux | Number | -
3133//! `total` | Number of updates available in all package manager listed | Number | -
3234//!
3335//! # Apt
146148//! cmd = "dnf list -q --upgrades | tail -n +2 | rofi -dmenu"
147149//! ```
148150//!
151+ //!
152+ //! Xbps only config:
153+ //!
154+ //! ```toml
155+ //! [[block]]
156+ //! block = "packages"
157+ //! package_manager = ["xbps"]
158+ //! interval = 1800
159+ //! format = " $icon $xbps.eng(w:1) updates available "
160+ //! format_singular = " $icon One update available "
161+ //! format_up_to_date = " $icon system up to date "
162+ //! [[block.click]]
163+ //! # shows dmenu with available updates. Any dmenu alternative should also work.
164+ //! button = "left"
165+ //! cmd = "xbps-install -Mun | dmenu -l 10"
166+ //! ```
167+ //!
149168//! Multiple package managers config:
150169//!
151170//! Update the list of pending updates every thirty minutes (1800 seconds):
152171//!
153172//! ```toml
154173//! [[block]]
155174//! block = "packages"
156- //! package_manager = ["apt", "pacman", "aur","dnf"]
175+ //! package_manager = ["apt", "pacman", "aur", "dnf", "xbps "]
157176//! interval = 1800
158- //! format = " $icon $apt + $pacman + $aur + $dnf = $total updates available "
177+ //! format = " $icon $apt + $pacman + $aur + $dnf + $xbps = $total updates available "
159178//! format_singular = " $icon One update available "
160179//! format_up_to_date = " $icon system up to date "
161180//! # If a linux update is available, but no ZFS package, it won't be possible to
@@ -179,6 +198,9 @@ use pacman::{Aur, Pacman};
179198pub mod dnf;
180199use dnf:: Dnf ;
181200
201+ pub mod xbps;
202+ use xbps:: Xbps ;
203+
182204use regex:: Regex ;
183205
184206use super :: prelude:: * ;
@@ -206,6 +228,7 @@ pub enum PackageManager {
206228 Pacman ,
207229 Aur ,
208230 Dnf ,
231+ Xbps ,
209232}
210233
211234pub async fn run ( config : & Config , api : & CommonApi ) -> Result < ( ) > {
@@ -232,6 +255,7 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> {
232255 let aur = any_format_contains ! ( "aur" ) ;
233256 let pacman = any_format_contains ! ( "pacman" ) ;
234257 let dnf = any_format_contains ! ( "dnf" ) ;
258+ let xbps = any_format_contains ! ( "xbps" ) ;
235259
236260 if !config. package_manager . contains ( & PackageManager :: Apt ) && apt {
237261 config. package_manager . push ( PackageManager :: Apt ) ;
@@ -245,6 +269,9 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> {
245269 if !config. package_manager . contains ( & PackageManager :: Dnf ) && dnf {
246270 config. package_manager . push ( PackageManager :: Dnf ) ;
247271 }
272+ if !config. package_manager . contains ( & PackageManager :: Xbps ) && xbps {
273+ config. package_manager . push ( PackageManager :: Xbps ) ;
274+ }
248275
249276 let warning_updates_regex = config
250277 . warning_updates_regex
@@ -275,6 +302,7 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> {
275302 config. aur_command . clone ( ) . error ( "aur_command is not set" ) ?,
276303 ) ) ,
277304 PackageManager :: Dnf => Box :: new ( Dnf :: new ( ) ) ,
305+ PackageManager :: Xbps => Box :: new ( Xbps :: new ( ) ) ,
278306 } ) ;
279307 }
280308
0 commit comments