How to change to other desktop environment on VNC sessions?

http://askubuntu.com/questions/352232/how-to-change-to-other-desktop-environment-on-vnc-sessions

 

On my system I will use VNC to login. But at this time, after connect to the pc, I get the automatic login with unity desktop. What I have to do, to have gnome desktop on VNC connection instead of unity?

shareimprove this question
 

2 Answers

It should be sufficient to create a suitable ~/.vnc/xstartup file in your account on the remote host, including the line

gnome-session --session=your-preferred-session &

For example, a minimal file for a gnome-classic session might be

#!/bin/sh

#Uncommment this line if using Gnome and your keyboard mappings are incorrect.
#export XKL_XMODMAP_DISABLE=1

# Load X resources (if any)
if [ -r "$HOME/.Xresources" ]
then
        xrdb "$HOME/.Xresources"
fi

gnome-session --session=gnome-classic &

The text of your-preferred-session will depend on what desktop packages you have installed - which you can check by looking in the /usr/share/xsessions directory i.e.

$ ls /usr/share/xsessions/
awesome.desktop        gnome-classic.desktop  gnome-fallback.desktop
gnome.desktop          gnome-shell.desktop     ubuntu-2d.desktop     xfce.desktop

The xstartup file can also be used to start non-gnome desktop sessions, for example

if which startxfce4 > /dev/null; then
    exec startxfce4 
fi
shareimprove this answer
 
    
Thanks steeldriver, but it isn´t working. I have still unity on vnc sessions. All gnome packages are installed. I think, maybe the "HOME" variable will not set. –  Roger Smith Oct 2 '13 at 8:54
    
Did you remember to make the ~/.vnc/xstartup file executable e.g. chmod u+x ~/.vnc/xstartup? –  steeldriver Oct 2 '13 at 10:29
    
Yes, it is executable. But i saw after logout from the local desktop session - for very short time - following: "vncserver: the HOME environment variable is not set". And now i cannot shutdown or reboot the host directly from graphical login screen or when i am logged in via vnc. I must login first local to shutdown the machine. –  Roger Smith Oct 2 '13 at 11:26
    
Hmm... never seen that error before - what vncserver are you running and how did you install / configure it? How are you invoking it? FWIW think it's normal not to be able to shut down from the GUI when other sessions are active. –  steeldriver Oct 2 '13 at 11:36
    
I am using tightvnc. I installed it over the synaptic package manager. Starting it in the /etc/rc.local with following param: su -c "/usr/bin/vncserver -geometry 1280x1024 -depth 24" roger Unfortunatelly i can´t check the log with the message about, because i can´t find the log which was displayed after logout. Maybe do you known which log this is? –  Roger Smith Oct 2 '13 at 13:00

Try using --replace in xstartup with the session you want to use. It works on Fedora.

shareimprove this answer
 
posted @ 2015-06-30 17:56  alxe_yu  阅读(243)  评论(0)    收藏  举报