Run prelock and postlock synchronously to avoid race condition

As reported in issue #285, running postlock in a subshell and immediately
returning from lockselect() has a high chance of hitting `exit 0` before
xset and dunstctl get a chance to execute.

Run both prelock and postlock synchronously within lockselect().
This commit is contained in:
Timo Beckers 2022-01-14 14:43:32 +01:00
parent c625f8b8a1
commit 1093ce51e6
No known key found for this signature in database
GPG key ID: 4130D6AE4B962121

View file

@ -278,7 +278,7 @@ postlock() {
lockselect() {
echof act "Running prelock..."
prelock &
prelock
case "$1" in
dim) if [ -f "$CUR_L_DIM" ]; then lock "$CUR_L_DIM"; else failsafe; fi ;;
@ -291,7 +291,7 @@ lockselect() {
esac
echof act "Running postlock..."
postlock &
postlock
}
# calculate adjustments for hidpi displays