Introduction
Introduction Statistics Contact Development Disclaimer Help
Adding an example script for slock. - xssstate - a simple utility to get the X …
git clone git://git.suckless.org/xssstate
Log
Files
Refs
README
LICENSE
---
commit c30b12c8e9d20225f69014d3fe60c0c0c4476773
parent f91e73ae451c1137da79019bb5a08daaca5f6323
Author: Christoph Lohmann <[email protected]>
Date: Sat, 8 Dec 2012 22:41:48 +0100
Adding an example script for slock.
Diffstat:
M Makefile | 2 +-
A README | 34 +++++++++++++++++++++++++++++…
A xsidle.sh | 28 ++++++++++++++++++++++++++++
3 files changed, 63 insertions(+), 1 deletion(-)
---
diff --git a/Makefile b/Makefile
@@ -30,7 +30,7 @@ clean:
dist: clean
@echo creating dist tarball
@mkdir -p xssstate-${VERSION}
- @cp -R LICENSE Makefile config.mk \
+ @cp -R LICENSE README Makefile config.mk xsidle.sh \
xssstate.1 arg.h ${SRC} xssstate-${VERSION}
@tar -cf xssstate-${VERSION}.tar xssstate-${VERSION}
@gzip xssstate-${VERSION}.tar
diff --git a/README b/README
@@ -0,0 +1,34 @@
+Xssstate
+========
+This is a simple utility to get the state of the X screensaver exten‐
+sion. These states include the idle time, the screensaver state and the
+time how long to wait until the screensaver should be active.
+
+The values for the states in X can be changed using xset(1).
+
+Turn off the screensaver:
+
+ % xset s 0
+
+Turn on the screensaver after 60 seconds inactivity:
+
+ % xset s 60
+
+Force the screensaver to be active:
+
+ % xset s blank
+
+For more options, see xset(1).
+
+
+Example script
+--------------
+In xsidle.sh is an example script how to use this for a background ser‐
+vice that will control your screensaver. This can be used to invoke
+slock(1) using following command:
+
+ % xsidle.sh slock &
+
+This should be useful in your $HOME/.xinitrc file.
+
+Have fun!
diff --git a/xsidle.sh b/xsidle.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Use xset s $time to control the timeout when this will run.
+#
+
+if [ $# -lt 1 ];
+then
+ printf "usage: %s cmd\n" "$(basename $0)" 2>&1
+ exit 1
+fi
+cmd="$1"
+
+while true
+do
+ if [ $(xssstate -s) != "disabled" ];
+ then
+ tosleep=$(($(xssstate -t) / 1000))
+ if [ $tosleep -le 0 ];
+ then
+ $cmd
+ else
+ sleep $tosleep
+ fi
+ else
+ sleep 10
+ fi
+done
+
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.