Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to quick switch (preferably from command line) between one desktop environment to other; say, from Unity to classical GNOME without having to close any of the running applications in the same desktop session?

(Please note that it's not about installing the environments.)

share|improve this question
2  
Let's see who steps up with an authoritative answer but my feeling is that, as far as Ubuntu and the official flavors go, you need to log out and log back in. There was/is something called Hybryde Fusion 13.04 which seems to offer something related but that would be off-topic here. –  user25656 Feb 5 at 17:26
    
yeah that seems to offer some HY-D-V1 Desktop environment.. the appearance seems to be quite close to GNOME3, but I hope it offers better experience.. –  rusty Feb 5 at 17:50
    
And then I think Zorin also offers something similar. That too would be OT :D I've decided a pure Openbox session with no desktop is good enough for me ;) –  user25656 Feb 5 at 18:05

3 Answers 3

This is a hypothetical answer, but perhaps someone with more knowledge on the subject can build upon my statements. If they are run under a differen't xserver output then you could switch between them by simply pressing Ctrl+Alt+F1, Ctrl+Alt+F2,...etc. Where F1 is X1, F2 is X2,..etc. I'm guessing the commands would be along the lines of:

  1. In terminal type: sudo xhost +

    Please note this presents a security risk because you've just allowed any of your x outputs to access.

  2. Ctrl+Alt+F1

    This takes you to X output 1, the default desktop is on f7

  3. Type: export DISPLAY=localhost:1

    1 because you are on x output 1, the default is on 0, and for additional outputs you will use higher numbers eg: 2,3,4 etc.

  4. Type: startxfce4 (XFCE), startkde (KDE) or startlxde (LXDE) to get the desktop to open in the new X output.

This doesn't work for me yet, I believe it's because you must be running it as a different user, because when I try it says the desktop is already running on the other localhost? This is as far as I've been able to get with this.

share|improve this answer
    
I gave it a try, I have only Gnome/Unity. startx didn't work. So I run it in background startx &, it works and created new gnome (my default) session with same user on tty8 (Ctrl+Alt+F8). I tried again with sudo xhost - as I though it's the same user why not, It works too. Logout brings me back to tty1. –  Sneetsher Feb 7 at 15:36

I got a nice trick while I was looking for WM key-binding, reading man pages.

man dm-tool

dm-tool is a tool to communicate with the LightDM display manager.

   list-seats
          List the active seats and sessions that are running.

   add-nested-seat
          Start an X server inside a session and connect it to a display manager.

   add-local-x-seat DISPLAY_NUMBER
          Connect an existing X server to the display manager.

   add-seat TYPE [NAME=VALUE...]
          Add a dynamic seat.
  • Run:

    $ dm-tool add-nested-seat
    /org/freedesktop/DisplayManager/Seat2
    
  • Got new window with new session (titled Xephyr on):

    enter image description here

  • Then login using other desktop (LXDE):

    enter image description here

  • Check seat list:

    $ dm-tool list-seats
    Seat2
      CanSwitch=false
      HasGuestAccount=true
      Session2
        UserName='sneetsher'
    Seat0
      CanSwitch=true
      HasGuestAccount=true
      Session0
        UserName='sneetsher'
    

  • To run in full screen:

    Xephyr :1 -br -fullscreen &
    dm-tool add-local-x-seat 1
    

Reference: Using_Xephyr

share|improve this answer
    
it's not exactly what I'm looking for, but Xephyr is a good tool to know about.. more than +1.. only dm-tool add-nested-seat seems to be working for me, can't start with a specified resolution or fullscreen with Xephyr.. and shut down doesn't close the slave X; I have to click close button (is that good?).. –  rusty Feb 11 at 15:58
    
dm-tool add-nested-seat works with some defaults thats why I run Xephyr as full screen in new display then run dm-tool to that display. "Shut down doesn't close the slave X" because it's not system visualization, but not sure if there better way. That session can even be closed as any window with Alt+F4. And you can switch between as any window Alt+Tab. –  Sneetsher Feb 11 at 16:06

Alternative point of view

It is possible to run another xsession, for another user.

Just create new user

sudo useradd test_test

Now you only need to lock your account Ctrl+Alt+L, then switch to a new added user and login. In login menu you can choose between installed Desktop Environment.

It will automatically starts new xsession in new tty. For me it is tty8. Now using Ctrl+Alt+F7, I can return to my user xsession. Using Ctrl+Alt+F8 back to new user xsession.

share|improve this answer
    
that's simply switching between user accounts.. I'm looking for a way to change to a different environment in the same session where my applications should preserve their state between the switch... –  rusty Feb 11 at 16:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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