How to enable shutdown from the lock screen?

Hello everyone!

I have OpenSUSE Leap 15.2 with Xfce desktop running on a laptop. Is there any way to enable/allow it to be shut down by the power button of the laptop while a session is locked?
I’ve activated ‘Shutdown when button is pressed’ in Power manager, but it works only when I’m logged in.

Thanks!

You can always shutdown:

Goto a terminal with STRG+ALT+F2, login as root, now:

shutdown -h -P now

But maybe this is blocked when an session is locked, because this will be used when someone is absent and do not want to shut down.

Hi
Likely controlled by logind, check the options set in /etc/systemd/logind.conf how long do you hold the power button, > 5 seconds?

The power button shuts down the system correctly when I’m logged in (and ‘menu > log out’ is available too). I’m trying to find an option to send shutdown command from the locked screen.

Nope, I just make a short press - that was enough to shut down the system when I’m logged in. I didn’t know there any differences when trying to do that from the lock screen.
In the logind.conf I’ve already tried to uncomment

HandlePowerKey=poweroff

, but without any noticeable effect.

Hi
Try holding for 5 seconds or more at the lock screen, does that work?

The commented lines are the defaults, so uncommenting would make no change… :wink: I do use the handlelidswitch and set to ignore, that would be an option to set this to powerdown if you don’t want to suspend/hibernate?

Thanks, I’ll know these are defaults!

Tried holding for 5 second - with no reaction at all.
Speaking of the lid switch, that would be the last option to consider, because in my usage scenario the pc is sometimes left working on background tasks with closed lid, so I used to use this trigger to shut down the display and lock the session.
But I still need an option that allows anyone living in the house to shut the laptop down correctly, not just by the 10-seconds-press-power cutoff.

Hi
Not sure if this may be of interest? Add new buttons to xfce4-session-logout / Desktop / Xfce Forums

Thanks!
Do I get it right that this thread explains how to create a software button to shutdown the pc, but doesn’t speak about the hardware one?
(Sorry, I’m a rather inexperienced user, so I may be omitting something)
May be very useful, I guess I’ll try this way in case there’s no possibility to use hardware button specifically

Hi
As far as I understand it yes a software button… worth a shot…