From 8c33b8156f83e6a9e35f50ac130b53fc31b13964 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?=
 <yps@yaroslavps.com>
Date: Fri, 1 Nov 2024 11:26:27 +0300
Subject: niri: turn off screen while idle in lock script

---
 dotfiles/.local/bin/lock-color | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'dotfiles/.local/bin')

diff --git a/dotfiles/.local/bin/lock-color b/dotfiles/.local/bin/lock-color
index 0611c29..fbf678f 100755
--- a/dotfiles/.local/bin/lock-color
+++ b/dotfiles/.local/bin/lock-color
@@ -1,10 +1,16 @@
 #!/bin/sh
 
-if [ -n "$SWAYSOCK"]; then
+if [ -n "$SWAYSOCK" ]; then
 	swaymsg input type:keyboard xkb_switch_layout 0
 
 	if [ "$1" != "screenon" ]; then
-  	  swayidle timeout 30 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' &
+  	  	echo idling
+  	  	swayidle timeout 30 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' &
+	fi
+elif [ -n "$NIRI_SOCKET" ]; then
+	if [ "$1" != "screenon" ]; then
+  	  	echo idling
+  	  	swayidle timeout 3 'niri msg action power-off-monitors' resume 'niri msg action power-on-monitors' &
 	fi
 fi
 
-- 
cgit v1.2.3