module(hypridle): add list of listeners
This commit is contained in:
parent
1c4127c1d4
commit
98bc758cb6
|
@ -4,7 +4,6 @@
|
|||
modules_base_path = ../../../modules;
|
||||
modules_hm_path = modules_base_path + "/home-manager";
|
||||
in [
|
||||
"${modules_hm_path}/swaylock"
|
||||
"${modules_hm_path}/looking-glass"
|
||||
"${modules_hm_path}/vscode"
|
||||
"${modules_hm_path}/tofi"
|
||||
|
@ -68,7 +67,10 @@
|
|||
dunst.enable = true;
|
||||
waybar.enable = true;
|
||||
ssh.enable = true;
|
||||
hypridle.enable = true;
|
||||
hypridle = {
|
||||
enable = true;
|
||||
enabledListeners.brightness = false;
|
||||
};
|
||||
|
||||
hyprlock = {
|
||||
enable = true;
|
||||
|
|
|
@ -4,6 +4,28 @@ let
|
|||
cfg = config.hm.hypridle;
|
||||
|
||||
enable = mkEnableOption "hypridle";
|
||||
enabledListeners = {
|
||||
brightness = mkOption {
|
||||
type = types.bool;
|
||||
description = "Enable brightness control";
|
||||
default = true;
|
||||
};
|
||||
lock = mkOption {
|
||||
type = types.bool;
|
||||
description = "Enable lock control";
|
||||
default = true;
|
||||
};
|
||||
monitors = mkOption {
|
||||
type = types.bool;
|
||||
description = "Enable monitors control";
|
||||
default = true;
|
||||
};
|
||||
suspend = mkOption {
|
||||
type = types.bool;
|
||||
description = "Enable suspend control";
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
timeouts = {
|
||||
lowerBrightness = mkOption {
|
||||
type = types.int;
|
||||
|
@ -29,7 +51,7 @@ let
|
|||
in
|
||||
{
|
||||
options.hm.hypridle = {
|
||||
inherit enable timeouts;
|
||||
inherit enable timeouts enabledListeners;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -40,24 +62,24 @@ in
|
|||
beforeSleepCmd = "loginctl lock-session";
|
||||
afterSleepCmd = "hyprctl dispatch dpms on";
|
||||
listeners = [
|
||||
{
|
||||
(mkIf cfg.enabledListeners.brightness {
|
||||
timeout = cfg.timeouts.lowerBrightness;
|
||||
onTimeout = "brightnessctl -s set 10";
|
||||
onResume = "brightnessctl -r";
|
||||
}
|
||||
{
|
||||
})
|
||||
(mkIf cfg.enabledListeners.lock {
|
||||
timeout = cfg.timeouts.lock;
|
||||
onTimeout = "loginctl lock-session";
|
||||
}
|
||||
{
|
||||
onTimeout = "pidof hyprlock || hyprlock";
|
||||
})
|
||||
(mkIf cfg.enabledListeners.monitors {
|
||||
timeout = cfg.timeouts.displaysOff;
|
||||
onTimeout = "hyprctl dispatch dpms off";
|
||||
onResume = "hyprctl dispatch dpms on";
|
||||
}
|
||||
{
|
||||
})
|
||||
(mkIf cfg.enabledListeners.suspend {
|
||||
timeout = cfg.timeouts.suspend;
|
||||
onTimeout = "systemctl suspend";
|
||||
}
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue