Keyboard shortcut to log out

In Gnome Shell, the keyboard shortcut to log out is specified in Settings, but this brings up the option to restart or shutdown. Is there a way to log out instead?

1 Like

From the cursory search it looks like there’s no shortcut to log off by default in Gnome. And the shortcut that says “Logout” is actually used for restarting/turning off the system.

But the good news is you can easily add a logout shortcut yourself. In the same Setting dialog with all the shortcuts you add a new entry, name it as you see fit, enter the following command:

gnome-session-quit --logout

then add the key combination you want and save it. It works right away, checked right now.

If you don’t want logout confirmation dialog showing up, you can also add --no-prompt (I personally wouldn’t to save myself from accidental keypresses, but it’s up to you).

If you need more detailed instructions for adding new shortcut – please tell so.

5 Likes

@nightromantic @fasulia

Adding some information to your answer, You can create a alias in your .bashrc, edit it and add in any place:

alias name=“command”

alias out="gnome-session-quit --logout"

NOTE

all shortcut availables:

Regards.,

2 Likes

Unfortunately, the shortcut list does say “logout”, but it brings up the “power off” bits. I think that is what @fasulia is referring to:

gnome-settings-logout

2 Likes

@FranciscoD, thanks, I’ve changed the wording to avoid confusion. I’ve actually meant “there’s no such shortcut as you want”, and I did understand which one confused @fasulia.

2 Likes

Thanks @nightromantic that solution is perfect.

It is confusing that the Settings have a mis-named Log Out keyboard shortcut. Especially since Log Out and Shutdown(Restart) are common keyboard shortcuts that both existed before on Gnome, and still do on MATE.

Was there a screen overlay that showed keyboard shortcuts? I think some distro or window manager had that, not sure if it was Gnome.

1 Like

@fasulia, you’re welcome!

I totally wholeheartedly agree))

Interesting detail is that Design page on gnome’s wiki lists two shortcuts, current one as “Power Off” – which it really is, and another one for “Log Off” – which has no shortcut assigned.

I assume they somehow got confused with labels.

I first heard about screen overlay with keyboard shortcuts in connection with Unity desktop of Ubuntu. Not sure if it was done somewhere else before or after that.

1 Like