[hackers] [xssstate][PATCH] Avoid triggering if current window is on fullscreen

From: Roberto Polverelli Monti <rpolverelli_AT_gmail.com>
Date: Tue, 9 Jun 2020 18:21:15 +0200

Locking the screen when the currently active window is on fullscreen is
generally undesired behaviour. While it is possibile that not everybody
has xdotool, I was unable to find a simpler way of detecting fullscreen
mode. I made sure to suppress any unnecessary output/singal.
---
 xsidle.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff --git a/xsidle.sh b/xsidle.sh
index cc3b2a4..fe5aaf1 100755
--- a/xsidle.sh
+++ b/xsidle.sh
_AT_@ -10,6 +10,16 @@ then
 fi
 cmd="$_AT_"
 
+isFullscreen() {
+	if command -v xdotool >/dev/null && command -v xprop >/dev/null;
+	then
+		xprop -id $(xdotool getactivewindow) | grep "_NET_WM_STATE_FULLSCREEN" >/dev/null
+		return
+	else
+		return 1
+	fi
+}
+
 while true
 do
 	if [ $(xssstate -s) != "disabled" ];
_AT_@ -19,6 +29,7 @@ do
 		then
 			$cmd
 		else
+			isFullscreen && xset s reset
 			sleep $tosleep
 		fi
 	else
-- 
2.27.0
Received on Tue Jun 09 2020 - 18:21:15 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 09 2020 - 18:36:33 CEST