From f540f30f1f3c76b68922550dcf5f78f42732fd37 Mon Sep 17 00:00:00 2001 From: Silvio Ankermann Date: Mon, 23 Oct 2023 10:00:02 +0200 Subject: [PATCH] cbatticon: Add support for batteryId For devices with more than one battery, cbatticon allows to set the battery ID as optional positional argument. If this argument is not given, it default to the first battery it would list with `cbatticon -p`. This commit adds support for the batteryId option to the cbatticon module. --- modules/services/cbatticon.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/services/cbatticon.nix b/modules/services/cbatticon.nix index 1216878ca..1616b2dcd 100644 --- a/modules/services/cbatticon.nix +++ b/modules/services/cbatticon.nix @@ -24,7 +24,7 @@ let ++ optional (cfg.updateIntervalSeconds != null) "--update-interval ${toString cfg.updateIntervalSeconds}" ++ optional (cfg.hideNotification != null && cfg.hideNotification) - "--hide-notification"); + "--hide-notification" ++ optional (cfg.batteryId != null) cfg.batteryId); in { meta.maintainers = [ maintainers.pmiddend ]; @@ -94,6 +94,15 @@ in { default = null; description = "Hide the notification popups."; }; + + batteryId = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + ID of the battery to monitor. List with {command}`cbatticon -p`. + Defaults to the first entry in the list. + ''; + }; }; };