aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Beckers <timo@incline.eu>2022-01-14 14:43:32 +0100
committerTimo Beckers <timo@incline.eu>2022-01-14 14:43:32 +0100
commit1093ce51e69dcefb2da8f2cbca02f0f8fa11ad40 (patch)
treea85e9e78db1f96e2f5f66c6f84eb472538fcda02
parentc625f8b8a179d42ef6acd5b46de044283d0c6552 (diff)
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().
-rwxr-xr-xbetterlockscreen4
1 files changed, 2 insertions, 2 deletions
diff --git a/betterlockscreen b/betterlockscreen
index ffa9dfe..40d9589 100755
--- a/betterlockscreen
+++ b/betterlockscreen
@@ -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