File heartbeat of Package xss-lock
#!/bin/bash
: ${DISPLAY=:0}
export DISPLAY
: ${XDG_CONFIG_HOME=$HOME}
typeset -i xset=1
typeset -a screens=($(xvinfo -display ${DISPLAY} 2>/dev/null |sed -rn 's/^screen\s+#([0-9]+)$/\1/p'))
if test -s ${XDG_CONFIG_HOME}/xss-lock/xset
then
. ${XDG_CONFIG_HOME}/xss-lock/xset
else
xset s blank
xset s on
xset s 600 300
xset +dpms
xset dpms 1200 1800 2400
fi
checkFullscreen()
{
local scr
local activ_win_id
for scr in ${screens[*]}
do
activ_win=($(xprop -display ${DISPLAY}.${scr} -root _NET_ACTIVE_WINDOW 2>/dev/null))
if test -n "$(xwininfo -id ${activ_win[4]} -display ${DISPLAY}.${scr} -wm 2>/dev/null | grep Fullscreen)"
then
xset s reset
if ((xset > 0))
then
xset s noblank
xset s off
xset -dpms
let xset=0
fi
else
if ((xset == 0))
then
if test -s ${XDG_CONFIG_HOME}/xss-lock/xset
then
. ${XDG_CONFIG_HOME}/xss-lock/xset
else
xset s blank
xset s on
xset s 600 300
xset +dpms
xset dpms 1200 1800 2400
fi
let xset++
fi
fi
done
}
while sleep 10
do
checkFullscreen
done