~charles/dotfiles

e25edf17b35e5bf050dbae39698f864b96e1cc93 — Charles Daniels 8 months ago 842fdab
dont kill xautolock while the screen is locked
2 files changed, 14 insertions(+), 6 deletions(-)

M overlay/bin/apply-dpms
M overlay/bin/locknow
M overlay/bin/apply-dpms => overlay/bin/apply-dpms +10 -6
@@ 76,12 76,16 @@ case "$config" in
		# settings need to be changed
		echo "set timeout to $config minutes" 1>&2

		# restart xautolock
		set +e
		killall xautolock
		set -e
		xautolock -time $config -locker "xset dpms force off && xtrlock -b" &
		disown
		if [ "$(ps aux | awk '$11 ~ /^xtrlock/' | wc -l)" -ne 0 ] ; then
			echo "screen locked, not kill xautolock"
		else
			# restart xautolock
			set +e
			killall xautolock
			set -e
			xautolock -time $config -locker "xset dpms force off && xtrlock -b" &
			disown
		fi

		# apply dpms settings
		timeout=$(expr $config '*' 60)

M overlay/bin/locknow => overlay/bin/locknow +4 -0
@@ 7,6 7,10 @@ if [ "$(uname)" = "OpenBSD" ] ; then
else
	~/bin/restore-sanity
	sleep "0.1"
	if [ "$(ps aux | awk '$11 ~ /^xtrlock/' | wc -l)" -ne 0 ] ; then
		echo "already locked"
		exit 0
	fi
	if xautolock -locknow 2>&1 | grep -q "Could not locate a running xautolock" ; then
		echo "restarting xautolock... "
		sleep 1