xss-lock: tentative to use transparency to notify

This commit is contained in:
Vincent Bernat 2020-01-24 21:54:03 +01:00
parent c2128a109d
commit 78512cf93a

View file

@ -20,24 +20,21 @@ case "$1" in
;;
dim|notify)
echo "notify: start"
redshift=$(systemctl --user show \
--property MainPID \
--value redshift@$(systemd-escape -- "$DISPLAY").service)
[ x$redshift = x ] || kill -STOP $redshift
trap "[ x$redshift = x ] || kill -CONT $redshift" EXIT
trap 'kill %% 2> /dev/null; exit 0' HUP # user activity
trap 'sleep 0.2s; kill %% 2> /dev/null; exit 0' TERM # locker started
outputs=($(xrandr -q | sed -n 's/\([^ ]*\) connected .*/\1/p'))
for i in $(seq 0.7 -0.01 0.1); do
for out in ${outputs[@]}; do
xrandr --output $out --brightness $i || \
outputs=("${outputs[@]/$out}")
done
sleep 0.1
trap 'echo notify: user activity; kill %% 2> /dev/null; exit 0' HUP # user activity
trap 'echo notify: locker started; kill %% 2> /dev/null; exit 0' TERM # locker started
for i in $(seq 1.0 -0.1 0.1); do
awesome-client <<EOF
for _, c in ipairs(client.get()) do
if c:isvisible() then
c.opacity=$i
end
end
EOF
sleep 0.2
done
echo "notify: end"
sleep infinity &
wait
echo "notify: end"
;;
lock)
# Something may have mendled with screensaver settings