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.
This commit is contained in:
Silvio Ankermann 2023-10-23 10:00:02 +02:00 committed by Robert Helgesson
parent 219d268a69
commit f540f30f1f
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -24,7 +24,7 @@ let
++ optional (cfg.updateIntervalSeconds != null) ++ optional (cfg.updateIntervalSeconds != null)
"--update-interval ${toString cfg.updateIntervalSeconds}" "--update-interval ${toString cfg.updateIntervalSeconds}"
++ optional (cfg.hideNotification != null && cfg.hideNotification) ++ optional (cfg.hideNotification != null && cfg.hideNotification)
"--hide-notification"); "--hide-notification" ++ optional (cfg.batteryId != null) cfg.batteryId);
in { in {
meta.maintainers = [ maintainers.pmiddend ]; meta.maintainers = [ maintainers.pmiddend ];
@ -94,6 +94,15 @@ in {
default = null; default = null;
description = "Hide the notification popups."; 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.
'';
};
}; };
}; };