13

I share my home computer with my wife, and we often switch between our two accounts.
I'm considering using Ubuntu on my next computer, and I'm evaluation different desktop environments (E.g. Gnome, Unity, or Xfce).
Fast user switching is a deal breaker for me on most of the desktop environments. In Unity it is best - you always have a menu with all users, and you can switch with a single click (assuming no passwords):

Unity user switching

On Gnome and Xfce it's quite bad. I need to click on "Switch User", select the other user, and click "Login" - all involving tiny buttons on different positions of the screen.

Is there a way of switching users quickly - preferably with a single click and/or a hotkey? Is there anything that would work regardless of desktop environment?

I've found a similar question: Keyboard shortcut to switch user accounts - but it only goes as far as the display manager. I want to skip it and switch to the other user's session.

20

Not a single click, but I can give you a keyboard shortcut solution.

Go into the menu to set custom keyboard shortcuts

and add a new one with this command:

dm-tool switch-to-user suzi

Assuming suzi is your wife's username, and set a shortcut of your choice by clicking where is says "disabled" and then pressing the key combination you want to use (for example, super+alt+S if the user's initial is S). Set another shortcut to switch to your own account (with your own username in the command).

  • Thanks! I knew there should be something simple, but couldn't find it. This is working very nicely in Xfce an Unity (I'm testing in VirtualBox). Gnome is less happy but I can probably get it to work as well. – Kobi Oct 18 '16 at 6:39
  • 3
    @Kobi ah awesome - I just learned about this yesterday when digging through old questions so perfect timing. I'm finding it very useful too (I use MATE) – Zanna Oct 18 '16 at 6:42
  • Another note - this works in desktop environments that have lightdm installed. If I understand correctly, I wouldn't want to install it in systems like KDE, it might break something (?). It works in my case, but just because I tend to prefer these desktop environments. Thanks again. – Kobi Oct 18 '16 at 10:53
  • @Kobi good point, not tested it with any other dm – Zanna Oct 18 '16 at 10:54
7

You can us a Function Key combination. F1 is the first DISPLAY, then F2, F3, etc.

If you were the first one logged in your DISPLAY would be F1. The next user's DISPLAY would be F2.

So you can quickly swwitch between user's by hitting Alt+Ctrl+F#

With this method you can save having to login when switching between sessions.

  • This also works. F6-F7 worked for me, F1-F5 were terminals. I prefer something more deterministic though. – Kobi Oct 18 '16 at 10:56
  • 1
    TTY1-TTY6 are text terminals, only TTY7-TTY12 are usedfor graphical sessions normally, starting with TTY7 for the first session and adding more on demand. – Byte Commander Oct 18 '16 at 12:30
  • @Kobi I had mentioned the defaults in my answer. Linux is full of surprises. So it's possible to program alternate configurations for the mappings. – L. D. James Oct 18 '16 at 12:40
  • @L.D.James I have never seen a distribution where the assignments of terminals you describe was the default. That's not to say they don't exist. I just haven't seen them. – kasperd Oct 18 '16 at 22:18
  • @Kobi It is deterministic already. Unless you change configuration files to change the behavior, it should remain the same as you have now. Of course it is possible that it will change when you upgrade to the next Ubuntu version. – kasperd Oct 18 '16 at 22:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.