Since this is a terminal-centric distro, you might want to logout from your Plasma session using the terminal. I just discovered this so I wanted to share it.
This command does that:
qdbus org.kde.ksmserver /KSMServer logout 0 0 1
If you replace 0 0 0
in that command with 1 0 1
, it will display the logout window giving you the option to cancel it, shutdown or restart your computer. This does exactly the same thing as clicking on the Log out button, saves your session and everything.
Of course, that is a lot of typing, so we can set an alias.
If you’re using bash, add this to your .bashrc
:
alias logout="shopt -q login_shell && logout || qdbus org.kde.ksmserver /KSMServer logout 0 0 1"
Or if you’re using zsh, add this to your .zshrc
:
alias logout="[[ -o login ]] && logout || qdbus org.kde.ksmserver /KSMServer logout 0 0 1"
Then you can logout by running:
logout
The alias overrides the normal logout
command which you’d use in the TTY to log out of a login session. To retain the original functionality, it first tests whether you’re in a login shell (in which case it runs the normal logout
command) or, if you’re not in a login shell, it runs that long qdbus
command that logs you out of your Plasma session.
I have not tested the bash version, but the zsh version works like a charm.