7

How can I run two instance of, e.g. GNOME, on my computer at once? I know how to change the virtual terminal, but I can't work out how to start a second instance of gnome - it just exits telling me that the X session is locked.

EDIT: The other thing that I would really like to know is how to run two different desktops at once - e.g. XFCE and GNOME. I know that I can change the default desktop in .xinitrc or something like that, but then I would have to do so every time - is there any way to select the desktop type when creating the new XSession?

3 Answers 3

6

The key is creating a new "screen" on which the xserver can run. Something along the lines of

 startx -- :1

where 1 is the increment of the number of screens you already have running (with the initial screen :0).

Fedora Forums has a good bit of information, but I'm not sure if its still accurate.

For information best suited to your distribution, be sure to look at the man page, man startx, from a terminal, or just Google "man startx" and go from one of the man page directories online.

1
  • Some display managers like lightdm do not support starting another server this way. In that case, see this answer that shows the commands to make it work: unix.stackexchange.com/a/617105/29716
    – dedeibel
    May 14, 2021 at 15:28
2

Use Xephyr to create an embedded X session.

$ Xephyr -ac -br -noreset -screen 800x600 :1

-ac disable access control restrictions
-br create root window with black background
-noreset don't reset after last client exists
-screen 800x600 Specify screen characteristics

Open the terminal and set the DISPLAY variable

DISPLAY=:1.0

Do not use export or all your programs will appear in the embedded session. Now, whenever you run a program from this terminal, it will appear in the embedded X session.

If you wonder, Xephyr will just create a new window with the given resolution, so you don't have to worry about getting back to your original session.

1

Use xnest. Xnest launches a new X server (:1, :2, etc) inside an X window. Very useful to log in as several users/with several different desktops at the same time. If you're using GDM, you can automatically log in as a new user (or environment) with

gdmflexiserver --xnest

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .