diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-06-03 22:07:43 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-06-04 10:14:48 +0530 |
commit | 45c9ec49e05daf1f0f4d8ba5ac6dc28b646622d1 (patch) | |
tree | 7156a0500b12086bef581601a560f42a89650a98 /home/wayland/modules/sway/swayidle.nix | |
parent | d4f7650cd0735d1fe9173530cc31c24b65ed44ff (diff) |
home/wayland/sway/swayidle: init
Diffstat (limited to 'home/wayland/modules/sway/swayidle.nix')
-rw-r--r-- | home/wayland/modules/sway/swayidle.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/home/wayland/modules/sway/swayidle.nix b/home/wayland/modules/sway/swayidle.nix new file mode 100644 index 0000000..1aa16c5 --- /dev/null +++ b/home/wayland/modules/sway/swayidle.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: let + swaylock = lib.getExe config.programs.swaylock.package; + brightnessctl = lib.getExe pkgs.brightnessctl; + swaymsg = "${pkgs.sway}/bin/swaymsg"; +in { + services.swayidle = { + enable = true; + systemdTarget = "sway-session.target"; + + timeouts = [ + { + timeout = 250; + command = + "${brightnessctl} --save; " + + "${brightnessctl} set 10%-"; + resumeCommand = "${brightnessctl} --restore"; + } + + { + timeout = 300; + command = swaylock; + } + + { + timeout = 600; + command = + "${swaymsg} --type command 'output * dpms off'; " + + "${brightnessctl} -c leds -d platform::kbd_backlight --save; " + + "${brightnessctl} -c leds -d platform::kbd_backlight set 0"; + resumeCommand = + "${brightnessctl} -c leds -d platform::kbd_backlight --restore; " + + "${swaymsg} --type command 'output * dpms on'"; + } + ]; + }; +} |