Skip to content

Instantly share code, notes, and snippets.

@ppoffice
Last active April 5, 2024 04:03
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ppoffice/53347bc47edb1c5903c70a79f0a5e290 to your computer and use it in GitHub Desktop.
Save ppoffice/53347bc47edb1c5903c70a79f0a5e290 to your computer and use it in GitHub Desktop.
VNC xstartup for Ubuntu Desktop (Gnome)
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
export DESKTOP_SESSION=/usr/share/xsessions/ubuntu.desktop
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
dbus-launch --exit-with-session /usr/bin/gnome-session --systemd --session=ubuntu
@jecs
Copy link

jecs commented Dec 9, 2022

I had to comment out the --systemd flag for Ubuntu 18.04, but otherwise it works beautifully. Thanks!

@meng-jiajun
Copy link

It works! Thank you!

@rabbull
Copy link

rabbull commented Aug 11, 2023

works fine to me. it's a huge help!

@duserqq
Copy link

duserqq commented Sep 27, 2023

Thank you very much!!!

@slhck
Copy link

slhck commented Feb 16, 2024

What I had to do under Ubuntu 22.04:

sudo apt-get install ubuntu-gnome-desktop
sudo apt-get install tightvncserver xtightvncviewer tightvnc-java
sudo locale-gen de_DE.UTF-8
sudo apt-get install xfonts-75dpi
sudo apt-get install xfonts-100dpi
sudo apt-get install gnome-panel
sudo apt-get install metacity
sudo apt-get install light-themes
touch ~/.Xresources
vncpasswd

Then in ~/.vnc/xstartup:

export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
export XDG_MENU_PREFIX="gnome-flashback-"

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

#dbus-launch --exit-with-session gnome-session --debug &
dbus-launch --exit-with-session gnome-session --builtin --session=gnome-flashback-metacity --disable-acceleration-check --debug &
#gnome-session --builtin --session=gnome-flashback-metacity --disable-acceleration-check --debug &
gnome-panel &
#gnome-settings-daemon &
metacity &
nautilus &

Source: https://superuser.com/questions/1596545/how-to-properly-configure-xstartup-file-for-tightvnc-with-ubuntu-20-04-lts-gnome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment