summaryrefslogtreecommitdiff
path: root/modules/home-manager/swayidle.nix
diff options
context:
space:
mode:
authorDevin Finlinson <devin.finlinson@pm.me>2024-02-02 13:37:54 -0700
committerDevin Finlinson <devin.finlinson@pm.me>2024-02-02 13:37:54 -0700
commite776c8fb5aed61d0f5f27a87c9c419dc07a13480 (patch)
treebce36bc077042d60c0cc162205440df6b783acdf /modules/home-manager/swayidle.nix
parent930ed23a02259a35c404f2fef0ab61ca620a0e4b (diff)
parent60568d28f263c74847f06ec6bc4c8ba7f7125dce (diff)
merge
Diffstat (limited to 'modules/home-manager/swayidle.nix')
-rw-r--r--modules/home-manager/swayidle.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/home-manager/swayidle.nix b/modules/home-manager/swayidle.nix
new file mode 100644
index 0000000..19cd171
--- /dev/null
+++ b/modules/home-manager/swayidle.nix
@@ -0,0 +1,30 @@
+{ pkgs, ... }: {
+ services.swayidle = {
+ enable = true;
+ systemdTarget = "hyprland-session.target";
+ timeouts =
+ let
+ dpmsCommand = "${pkgs.hyprland}/bin/hyprctl dispatch dpms";
+ brightnessCommand = "${pkgs.brightnessctl}/bin/brightnessctl -s %% brightnessctl s";
+ in
+ [
+ { #timeout 180
+ timeout = 3;
+ command = "${brightnessCommand} 15%";
+ resumeCommand = "brightnessctl -r";
+ }
+ {
+ #timeout 300
+ timeout = 5;
+ command = "${dpmsCommand} off && swaylock";
+ resumeCommand = "${dpmsCommand} on";
+ }
+ { #timeout 420
+ timeout = 7;
+ command = "${brightnessCommand} 0%";
+ resumeCommand = "brightnessctl -r";
+ }
+ ];
+ # events.before-sleep.event = "swaylock";
+ };
+}