How can I have two user graphical sessions open at the same time and switch between them using a shortcut similar to how I can switch workspaces?

I’m using Manjaro Linux and I’m wondering if there is a way to have two user graphical sessions open simultaneously on the same computer and switch between them using a shortcut, similar to how I can switch between workspaces. I know that it’s possible to log in to multiple concurrent non-X Linux terminals, but I’m specifically looking for a solution that allows each user to have a full X session. I’ve checked the Main Menu options and I only see the option to log out of the current user, but nothing for switching users. Is there a simple way to achieve this? Any help or suggestions would be greatly appreciated.
Thank you!

It is possible, but you’ll have to start the second session manually from a tty. Something along the lines of… :arrow_down:

startx -- :1

If I’m not mistaken — I run Plasma here, not Cinnamon — then your normal GUI session runs at tty7. The new session will then run at tty8. As such, you can then switch back and forth between them by pressing Ctrl+Alt+F7 and Ctrl+Alt+F8.

At least, that’s how it has always worked. :wink:

4 Likes

Remember to use a different login.

Weird things will happen when the same login runs in two different X sessions.

4 Likes

Logging in as the new user and starting the X session with startx -- :1, I’ve successfully started the new X session, but the Cinnamon desktop environment is not loaded correctly. There are no background, panel, or window buttons. All I see are the computer and home folders in the desktop.

I’ve tried the command cinnamon --replace. This command attempts to start the Cinnamon desktop environment, replacing the current window manager if necessary. But nothing happens.

Well, that sounds like a Cinnamon-specific problem then, probably related to the absence of configuration files for the new account — normally, those should have been copied over from /etc/skel when the new account was created, as a template from which you can then start customizing your environment if so desired.

The fact that you managed to start the new session proves that the X11 display server still works as it used to on account of concurrently supporting multiple sessions.

Things you could try…

  1. Close the manually started session, switch to your normal session, log out from there and log in as the other user. See if the panels and background load correctly then.

  2. If the above gives you the same result as in the manually loaded session, hunt down the missing files, copy them over from your normal account into the new user’s account as root, and chown them to the new user account and its group. (chown newuser:newuser filename-here).

I don’t know who maintains the Cinnamon edition of Manjaro — it’s a community edition — but maybe they can pitch in. :thinking:

Edit: The Cinnamon packages are maintained by @Yochanan, but as I gather, they are simply taken over from Arch without any modifications. By consequence, there won’t be any Cinnamon-specific files in /etc/skel. :thinking:

1 Like

If switching between two sessions is what you are looking for, you can find it in the top right applet called “User Applet”, there you will find the *SwitchUser* menu item to allow you to quickly switch between two or more users.

If it is not there, just right click on the top bar and click Applets, you can add it from there.

John

1 Like

Wouldn’t it be better to start the display manager a second time making it grab an extra tty and display the login screen on?
I think that should be possible in the case of sddm and gdm, no idea what cinamon uses…

I presume this could be done by changing the configuration, but I have no experience with that.

I’m not sure, but I think it uses lightdm. :man_shrugging:

This wasn’t working for me and I couldn’t figure out why. I believe the cause was my dotfiles installation script where I have some code that would make all users try to use the same configuration.

INSTALL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
DOT="$(dirname "$INSTALL_DIR")"
source "$INSTALL_DIR"/helpers.sh || exit
source "$DOT"/config/zsh/.zshenv

has_sudo() {
  if [[ "$EUID" = 0 ]]; then
    return 0
  else
    sudo -k # make sure to ask for password on next sudo
    if sudo true; then
      return 0
    else
      return 1
    fi
  fi
}

append_zshenv_to_global_files() {
  if [ ! -e /etc/zshenv ]; then
    sudo tee -a /etc/profile /etc/zshenv /etc/zsh/zshenv &>/dev/null <<EOF
export XDG_CONFIG_HOME=$XDG_CONFIG_HOME
export ZDOTDIR=$ZDOTDIR
EOF
  fi
}

link_zshenv_to_home_directory() {
  if ! grep -q "export XDG_CONFIG_HOME=" || \
     ! grep -q "export ZDOTDIR="; then
    tee -a $HOME/.profile &>/dev/null <<EOF
export XDG_CONFIG_HOME=$XDG_CONFIG_HOME
export ZDOTDIR=$ZDOTDIR
EOF
  fi
}

load_zshenv_on_startup() {
  if has_sudo; then
    append_zshenv_to_global_files
  else
    link_zshenv_to_home_directory
  fi
}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.