The command qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logoutAndShutDown
shuts down the computer sucessfully when I run it in Konsole.
However, when I run it from a widget (kmenu), it does nothing. Curiously, an analogical command for logging off qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
logs me off as intended from the widget (and Konsole). systemctl poweroff
powers off the computer both from Konsole and from the widget. However, the qdbus method is prefered if I understand this post correctly: Logout, reboot and shutdown using the terminal - #9 by David_Edmundson
Any idea why this might be? I tried running Plasma in terminal to see if there are any log messages, but no. This is on Fedora 42 (computer is Thinkpad Extreme 1 gen 2, but I doubt that matters).
I’m not sure I would say preferred. They’re different.
The KDE one will allow apps to cancel shutdown if they’re busy, it will follow other inhibitions and prompts, and potentially save state for next reboot if applicable.
systemctl poweroff, will still tear everything down nicely, but with none of the other hooks.
As for why it doesn’t work, the answer is almost certainly that it’s not sending the same DBus call.
Bustle is a good tool for debugging DBus traffic.
Well, I do appreciate being told about unsaved work somewhere, so for me it is preferred.
Turns out the problem was with whitespace, the widget was emitting the calls with a newline, which was in effect just giving “HELLO” calls. I filled a bug: Strip whitespace from commands · Issue #13 · 51n7/kMenu · GitHub
@David_Edmundson Is there a way to ask kde to modify its reboot command, i.e. to do kexec reboot or reboot to UEFI setup?
Right now I use sudo systemctl kexec
* and systemctl reboot --firmware-setup
. This works but does not prompt me to save my work etc. KDE itself can boot to UEFI from a KCM: https://phabricator.kde.org/D19560 but I am not sure if this method is exposed anywhere?
* I had to add a file to /etc/sudoers.d/
to make this work from the GUI, not sure why it needs root priviledges.