The dialogs of the KDE user interface for logging off, restarting and shutting down give 30 seconds to think about by default and wait for confirmation. But that need not be.
Under KDE you can control programs and components remotely via the qdbus interface. This interface defines a protocol for process communication.
Desktop users rarely come into contact with it, but it is a useful means of remotely controlling KDE. With the help of the qdbus command line tool, you can then set up a link in the KDE panel to log off immediately. The command to do this is as follows:
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
To store an abbreviation for this in the panel, first create a temporary link in your home directory using the Dolphin file manager. To do this, click in the file manager with the right mouse button in the file window and select “Create new> Shortcut to program”. Under “Program> Name” enter the desired name of the action (for example “Log off”) and in the “Command” field enter the qdbus call mentioned with its parameters. You can also specify a suitable symbol under “General”. Once the link has been created, drag it with the mouse to the desired position in the panel. A click on the finished button will log you out immediately without any further questions. You can also shut down the system without delay. The qdbus command for this is
qdbus org.kde.ksmserver /KSMServer logout 0 2 2
and for a restart this command is
qdbus org.kde.ksmserver /KSMServer logout 0 1 1