From 4975120fd27f1edc82bb89cb205a8e696667b8a4 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sun, 9 Apr 2023 20:36:56 +0530 Subject: [PATCH] dpms off on idle --- home/wm/addon/swayidle.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/home/wm/addon/swayidle.nix b/home/wm/addon/swayidle.nix index fe0e2c3..da36fc4 100644 --- a/home/wm/addon/swayidle.nix +++ b/home/wm/addon/swayidle.nix @@ -1,17 +1,27 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +let + swaylock = "${pkgs.swaylock}/bin/swaylock"; + hyprctl = "${pkgs.hyprland}/bin/hyprctl"; +in +{ services.swayidle = { enable = true; systemdTarget = "graphical-session.target"; events = [ { event = "before-sleep"; - command = "${pkgs.swaylock}/bin/swaylock -f -i /tmp/lockpaper.jpg"; + command = "${swaylock} -f -i /tmp/lockpaper.jpg"; } ]; timeouts = [ { timeout = 600; - command = "${pkgs.swaylock}/bin/swaylock -f -i /tmp/lockpaper.jpg"; + command = "${swaylock} -f -i /tmp/lockpaper.jpg"; + } + { + timeout = 900; + command = "${hyprctl} dispatch dpms off"; + resumeCommand = "${hyprctl} dispatch dpms on"; } ]; };