Support desktop backgrounds.

This commit is contained in:
Gabriel Ebner 2018-10-28 14:53:19 +01:00
parent 91bedc6fc3
commit 463eacc886
2 changed files with 13 additions and 16 deletions

@ -146,9 +146,8 @@ bindsym $mod+Ctrl+l exec --no-startup-id loginctl lock-session
exec --no-startup-id xset s 300 exec --no-startup-id xset s 300
exec --no-startup-id xss-lock -lv /home/gebner/etc/lock.sh exec --no-startup-id xss-lock -lv /home/gebner/etc/lock.sh
exec_always --no-startup-id ifelse(hostname, exec_always --no-startup-id xsetroot -solid grey
[theba], [feh --bg-fill ~/Pictures/20140915-133957-DSC_7414.jpg], exec_always --no-startup-id feh --bg-fill /home/gebner/Desktop/background.png
[xsetroot -solid grey])
ifelse(hostname, [theba], [ ifelse(hostname, [theba], [
workspace 1 output eDP1 workspace 1 output eDP1

24
lock.sh

@ -1,17 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Options to pass to i3lock do_lock() {
i3lock_options="-c 777777" bg_file=$HOME/Desktop/background.png
if test -f $bg_file && which i3lock-color >/dev/null 2>&1; then
i3lock-color -i $bg_file "$@"
else
i3lock -c 777777 "$@"
fi
}
xset +dpms dpms 5 5 5 xset +dpms dpms 10 10 10
revert_dpms() { xset dpms 0 0 0; } revert_dpms() { xset dpms 0 0 0; }
trap revert_dpms EXIT trap revert_dpms EXIT
pre_xset_dpms_sleep=0.1
[ "$HOSTNAME" = decoysnail ] && pre_xset_dpms_sleep=0.5
# pre_lock
# We set a trap to kill the locker if we get killed, then start the locker and # We set a trap to kill the locker if we get killed, then start the locker and
# wait for it to exit. The waiting is not that straightforward when the locker # wait for it to exit. The waiting is not that straightforward when the locker
# forks, so we use this polling only if we have a sleep lock to deal with. # forks, so we use this polling only if we have a sleep lock to deal with.
@ -23,7 +24,7 @@ if [[ -e /dev/fd/${XSS_SLEEP_LOCK_FD:--1} ]]; then
trap kill_i3lock TERM INT trap kill_i3lock TERM INT
# we have to make sure the locker does not inherit a copy of the lock fd # we have to make sure the locker does not inherit a copy of the lock fd
i3lock $i3lock_options {XSS_SLEEP_LOCK_FD}<&- do_lock {XSS_SLEEP_LOCK_FD}<&-
# now close our fd (only remaining copy) to indicate we're ready to sleep # now close our fd (only remaining copy) to indicate we're ready to sleep
exec {XSS_SLEEP_LOCK_FD}<&- exec {XSS_SLEEP_LOCK_FD}<&-
@ -33,9 +34,6 @@ if [[ -e /dev/fd/${XSS_SLEEP_LOCK_FD:--1} ]]; then
done done
else else
trap 'kill %%' TERM INT trap 'kill %%' TERM INT
i3lock -n $i3lock_options & do_lock -n &
sleep $pre_xset_dpms_sleep; xset dpms force off
wait wait
fi fi
# post_lock