#776674 xfce4-session: xflock4 does not turn off screen due to xset dpms race condition

Package:
xfce4-session
Source:
xfce4-session
Description:
Xfce4 Session Manager
Submitter:
Chris Bainbridge
Date:
2025-07-09 12:07:01 UTC
Severity:
normal
Tags:
#776674#5
Date:
2015-01-30 21:47:49 UTC
From:
To:
Dear Maintainer,

/usr/bin/xflock4 does:

for lock_cmd in \
  "xlock -mode blank" \
  "slock"
   set -- $lock_cmd
    if command -v -- $1 >/dev/null 2>&1; then
        $lock_cmd >/dev/null 2>&1 &
        # turn off display backlight:
        xset dpms force off
        exit
    fi
done

But it does not work (presumably xset runs too quickly and slock turns the
monitor back on?)

It appears the xset call should be something like:

        sleep 1; xset dpms force off

Using a hardcoded sleep does not seem elegant, but it is the suggested fix at
http://askubuntu.com/questions/38776/trigger-screensaver-off-monitor and
https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling

(Also, is there a purpose for doing "set -- $lock_cmd" when the process then
immediately calls exit?)