summaryrefslogtreecommitdiff
path: root/modules/home-manager
diff options
context:
space:
mode:
authorDevin Finlinson <devin.finlinson@pm.me>2024-01-13 10:02:37 -0700
committerDevin Finlinson <devin.finlinson@pm.me>2024-01-13 10:02:37 -0700
commita3aa87695d3b7fb141489cb3eaa137a2f4f6549b (patch)
treeeb46db089b3d7a8dc7a03f60677d80262a7615a5 /modules/home-manager
parent7b9864af9e84a3809ca8b29e38ec92270559470a (diff)
added config for swayidle
Diffstat (limited to 'modules/home-manager')
-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..14c6831
--- /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.hyprctl}/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 --screenshots --clock --indicator-idle-visible --grace 10";
+ resumeCommand = "${dpmsCommand} on";
+ }
+ { #timeout 420
+ timeout = 7;
+ command = "${brightnessCommand} 0%";
+ resumeCommand = "brightnessctl -r";
+ }
+ ];
+ events.before-sleep.event = "swaylock";
+ };
+}