2025-04-01 20:10:43 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2018-12-01 17:32:21 +01:00
|
|
|
let
|
|
|
|
cfg = config.services.dwm-status;
|
|
|
|
|
2025-06-12 20:51:24 +03:00
|
|
|
format = pkgs.formats.toml { };
|
2018-12-01 17:32:21 +01:00
|
|
|
|
2025-06-12 20:51:24 +03:00
|
|
|
configFile = format.generate "dwm-status.toml" cfg.settings;
|
2018-12-01 17:32:21 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2025-06-12 20:51:24 +03:00
|
|
|
imports = [
|
|
|
|
(lib.mkRenamedOptionModule
|
|
|
|
[ "services" "dwm-status" "order" ]
|
|
|
|
[ "services" "dwm-status" "settings" "order" ]
|
|
|
|
)
|
|
|
|
(lib.mkRemovedOptionModule [
|
|
|
|
"services"
|
|
|
|
"dwm-status"
|
|
|
|
"extraConfig"
|
|
|
|
] "Use services.dwm-status.settings instead.")
|
|
|
|
];
|
2018-12-01 17:32:21 +01:00
|
|
|
|
|
|
|
options = {
|
|
|
|
services.dwm-status = {
|
2024-08-24 22:05:42 +02:00
|
|
|
enable = lib.mkEnableOption "dwm-status user service";
|
2018-12-01 17:32:21 +01:00
|
|
|
|
2024-08-24 22:05:42 +02:00
|
|
|
package = lib.mkPackageOption pkgs "dwm-status" {
|
2023-11-27 01:19:27 +01:00
|
|
|
example = "dwm-status.override { enableAlsaUtils = false; }";
|
2018-12-01 17:32:21 +01:00
|
|
|
};
|
|
|
|
|
2025-06-12 20:51:24 +03:00
|
|
|
settings = lib.mkOption {
|
|
|
|
type = lib.types.submodule {
|
|
|
|
freeformType = format.type;
|
|
|
|
options.order = lib.mkOption {
|
|
|
|
type = lib.types.listOf (
|
|
|
|
lib.types.enum [
|
|
|
|
"audio"
|
|
|
|
"backlight"
|
|
|
|
"battery"
|
|
|
|
"cpu_load"
|
|
|
|
"network"
|
|
|
|
"time"
|
|
|
|
]
|
|
|
|
);
|
|
|
|
default = [ ];
|
|
|
|
description = ''
|
|
|
|
List of enabled features in order.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
order = [
|
2025-04-01 20:10:43 +02:00
|
|
|
"battery"
|
|
|
|
"cpu_load"
|
|
|
|
"time"
|
2025-06-12 20:51:24 +03:00
|
|
|
];
|
|
|
|
time = {
|
|
|
|
format = "%F %a %r";
|
|
|
|
update_seconds = true;
|
|
|
|
};
|
|
|
|
};
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2025-06-12 20:51:24 +03:00
|
|
|
Config options for dwm-status, see https://github.com/Gerschtli/dwm-status#configuration
|
|
|
|
for available options.
|
2018-12-01 17:32:21 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-24 22:05:42 +02:00
|
|
|
config = lib.mkIf cfg.enable {
|
2025-06-12 20:51:24 +03:00
|
|
|
services.upower.enable = lib.mkIf (lib.elem "battery" cfg.settings.order) true;
|
2018-12-01 17:32:21 +01:00
|
|
|
|
|
|
|
systemd.user.services.dwm-status = {
|
|
|
|
description = "Highly performant and configurable DWM status service";
|
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
partOf = [ "graphical-session.target" ];
|
2025-05-27 18:59:36 +02:00
|
|
|
serviceConfig.ExecStart = "${cfg.package}/bin/dwm-status ${configFile} --quiet";
|
2018-12-01 17:32:21 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|