configurable polling intervals and thresholds per module

This commit is contained in:
Damocles 2026-04-12 17:44:52 +02:00
parent 0eaba947f4
commit 7a4e1859a9
11 changed files with 64 additions and 32 deletions

View file

@ -69,6 +69,13 @@ in
} // extra;
};
};
intervalOpt = default: {
interval = lib.mkOption {
type = lib.types.int;
inherit default;
description = "Polling interval in milliseconds.";
};
};
simpleModules = lib.genAttrs [
"workspaces"
"tray"
@ -77,20 +84,18 @@ in
"notifications"
"mpris"
"volume"
"bluetooth"
"network"
"powerProfile"
"idleInhibitor"
"temperature"
"cpu"
"memory"
"disk"
"battery"
"power"
] (name: moduleOpt name { });
in
simpleModules
// {
bluetooth = moduleOpt "bluetooth" (intervalOpt 5000);
network = moduleOpt "network" (intervalOpt 5000);
powerProfile = moduleOpt "powerProfile" (intervalOpt 5000);
cpu = moduleOpt "cpu" (intervalOpt 1000);
memory = moduleOpt "memory" (intervalOpt 2000);
disk = moduleOpt "disk" (intervalOpt 30000);
backlight = moduleOpt "backlight" {
step = lib.mkOption {
type = lib.types.int;
@ -98,7 +103,31 @@ in
description = "Brightness adjustment step (%).";
};
};
weather = moduleOpt "weather" {
temperature = moduleOpt "temperature" ((intervalOpt 2000) // {
warm = lib.mkOption {
type = lib.types.int;
default = 60;
description = "Temperature threshold for warm state (°C).";
};
hot = lib.mkOption {
type = lib.types.int;
default = 80;
description = "Temperature threshold for hot state (°C).";
};
});
battery = moduleOpt "battery" {
warning = lib.mkOption {
type = lib.types.int;
default = 25;
description = "Battery percentage for warning notification.";
};
critical = lib.mkOption {
type = lib.types.int;
default = 15;
description = "Battery percentage for critical notification and blink.";
};
};
weather = moduleOpt "weather" ((intervalOpt 3600000) // {
args = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "--nerd" ];
@ -109,7 +138,7 @@ in
"Berlin"
];
};
};
});
};
theme = lib.mkOption {