I am not talking about shutdown
and reboot
commands. I want to initiate the same routine from command line that would be performed if I would press the logout/reboot/shutdown button inside the KDE desktop.
I am not talking about shutdown
and reboot
commands. I want to initiate the same routine from command line that would be performed if I would press the logout/reboot/shutdown button inside the KDE desktop.
For KDE 5+:
The last option specifies which method gets called. It seems the options for KDE4 mentioned below are partially supported(reboot didnt work so I ended up using these newer methods).
Ref: Reddit
For KDE 4:
Note that this answer was written in 2010 for KDE 4. It may not apply to modern systems.
The three integer parameters are the
confirm
,sdtype
andsdmode
arguments to KWorkSpace::requestShutDown. Their values are explained at the top of the page. Since the page has disappeared, here are the values (still present in a cache).So I tried the answer presented by Gilles, but that only works for KDE4.
After a system-update with my graphics, I could no longer log out, reboot, or shutdown. Eventually found this command worked:
My source is from here, where they discuss it a bit more. I'm not sure about he other optoins. Forum topic discussion KDE5 shutdown options. The above command seems to have shutdown my system gracefully. All my programs came back that were expected, in the right layout order, and I did not seem to be missing anything. If this doesn't work, please comment and I will adjust my answer but so far this is all that has worked for a graceful KDE5 shutdown when my is locked. (I obviously could have used the shutdown command or called init, but those aren't graceful.)
For any version of KDE (maybe also GNOME and others):
In KDE Control Center (KDE3.5/trinity) you can set a keyboard shortcut for "halt without confirmation" (should be a complicated one to avoid tragedy, like Ctrl+Shift+Alt+Delete) and then run
xvkbd
(virtual keyboard):You can create an alias for this (e.g.
kdehalt
);My favourite one:
sleep 1h 20m && kdehalt
orwget "http://something" ; kdehalt
.