Bugzilla – Bug 1148128
xfce4-power-manager doesn't lock screen on laptop lid close with xlock
Last modified: 2019-10-07 11:08:29 UTC
I like to use i3lock instead of xscreensaver, so I removed xscreensaver from my TW 20190822 and installed i3lock and i3lock-xlock-compat. I also set xfce's LockCommand to /usr/bin/xlock in order to use it: xfconf-query -c xfce4-session -p /general/LockCommand -s "/usr/bin/xlock" --create -t string Now the xfce action buttons lock my screen perfectly fine, but closing my laptop's lid does nothing. Laptop lid actions set in the Power Manager settings are "Lock screen" for both battery and plugged in. Running the power manager in debug mode and opening/closing the lid twice produces this: xfce4-power-manager --no-daemon --debug > pm.log 2>&1 [...] TRACE[xfpm-power-common.c:189] get_device_icon_name(): icon_suffix -symbolic, icon_base_length 20, upower_icon battery-full-charged-symbolic TRACE[xfpm-manager.c:725] xfpm_manager_tray_update_icon(): updating icon TRACE[xfpm-manager.c:709] xfpm_manager_tray_update_tooltip(): updating tooltip TRACE[xfpm-manager.c:442] xfpm_manager_lid_changed_cb(): LID close event: ((XfpmLidTriggerAction) LID_TRIGGER_LOCK_SCREEN) TRACE[xfpm-manager.c:475] xfpm_manager_lid_changed_cb(): LID opened: ((XfpmLidTriggerAction) LID_TRIGGER_LOCK_SCREEN) TRACE[xfpm-dpms.c:279] xfpm_dpms_force_level(): start TRACE[xfpm-dpms.c:311] xfpm_dpms_force_level(): No need to change DPMS mode, current_level=0 requested_level=0 TRACE[xfpm-manager.c:442] xfpm_manager_lid_changed_cb(): LID close event: ((XfpmLidTriggerAction) LID_TRIGGER_LOCK_SCREEN) TRACE[xfpm-manager.c:475] xfpm_manager_lid_changed_cb(): LID opened: ((XfpmLidTriggerAction) LID_TRIGGER_LOCK_SCREEN) TRACE[xfpm-dpms.c:279] xfpm_dpms_force_level(): start TRACE[xfpm-dpms.c:311] xfpm_dpms_force_level(): No need to change DPMS mode, current_level=0 requested_level=0 [...] Running xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-lid-switch gives: false Looks to me like xfce4-power-manager doesn't use /general/LockCommand? Is there a workaround to tell xfce4-power-manager to use xlock to lock the screen on laptop lid close?
> Is there a workaround to tell xfce4-power-manager to use xlock to lock the > screen on laptop lid close? I'm not familiar with i3 lock nor xlock but I believe it should work. The script called for locking is in /usr/bin/xflock4. You could place a custom version of such script in /usr/local/bin/xflock4 Please report this upstream at https://bugzilla.xfce.org/ for xfce4-session Seife, do you have any input?
No, but I think it works for me (will have to test when I'm back at home). I have also installed i3lock and i3lock-xlock-compat and uninstalled xscreensaver, gnome-screensaver, light-locker (because the old xflock4 before 4.14 would try these first, then fall back to "xlock -mode blank" which then engages i3lock-xlock-compat. Now the new xflock4 does first try LOCK_CMD=$(xfconf-query -c xfce4-session -p /general/LockCommand), then xfce4-screensaver-command, xscreensaver-command, light-locker. If these all fail, it will still fall back to xlock and slock. So I'd suggest to uninstall xfce4-screensaver, xscreensaver and light-locker, then remove the /general/LockCommand and try again. If it works now, then we need to investigate what is wrong with the LockCommand handling in xflock4. If it still does not work, then apparently xfce4-power-manager is *not* using xflock4. Another thing you could try is running a custom script in /general/LockCommand that logs its invocation time to a file and then check if it is actually called on lid close.
Sorry for ignoring this for so long :-/ When testing this out the last time, my laptop completely crashed repeatedly, so I wasn't as diligent in testing it out as I should have been... In any case, I tried again today and seems the issue is resolved now. I could set the power manager settings back to "lock screen if lid is closed" and it did correctly start i3lock and did *not* crash the system. /var/log/zypp/history shows me new packages relating to xfce4-power-manager were installed on my system on 2019-08-23, 2019-08-26, 2019-10-02 and 2019-10-04. I'm guessing one of those updates fixed the problem. Thanks a lot for taking time to look at it :-)