Skip to content

Instantly share code, notes, and snippets.

@bfroehle
Created July 16, 2013 21:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bfroehle/6015501 to your computer and use it in GitHub Desktop.
Save bfroehle/6015501 to your computer and use it in GitHub Desktop.
RealVNC xstartup script for Ubuntu 13.04. To use, save this file to `/etc/vnc/xstartup.custom` and make it executable. Then ensure that you have installed the `gnome-session-fallback` package.
#!/bin/sh
# VNC Server (Virtual-Mode) start-up script.
unset XDG_RUNTIME_DIR
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
if [ -f /usr/bin/gnome-session ]; then
# Some gnome session types won't work with Xvnc, try to pick a sensible
# default.
for SESSION in "gnome-fallback" "ubuntu-2d" "2d-gnome"; do
if [ -f /usr/share/gnome-session/sessions/$SESSION.session ]; then
DESKTOP_SESSION=$SESSION; export DESKTOP_SESSION
GDMSESSION=$SESSION; export GDMSESSION
STARTUP="/usr/bin/gnome-session --session=$SESSION"; export STARTUP
fi
done
fi
if [ -x /etc/X11/Xsession ]; then /etc/X11/Xsession
elif [ -x /etc/X11/xdm/Xsession ]; then /etc/X11/xdm/Xsession
elif [ -x /etc/X11/xinit/Xsession ]; then /etc/X11/xinit/Xsession
elif [ -x /etc/gdm/Xsession ]; then /etc/gdm/Xsession gnome-session
elif [ -x /etc/kde/kdm/Xsession ]; then /etc/kde/kdm/Xsession
elif [ -x /usr/dt/bin/Xsession ]; then
XSTATION=1 DTXSERVERLOCATION=local /usr/dt/bin/Xsession
elif [ -x /usr/dt/bin/dtsession ]; then /usr/dt/bin/dtsession
else
if which twm > /dev/null 2>&1; then
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm
else
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop"
fi
fi
vncserver-virtual -kill $DISPLAY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment