Skip to content

Instantly share code, notes, and snippets.

@wecacuee
Last active January 9, 2024 02:17
Show Gist options
  • Save wecacuee/88956bf671b9d2b8b2bdadeadc42a9f5 to your computer and use it in GitHub Desktop.
Save wecacuee/88956bf671b9d2b8b2bdadeadc42a9f5 to your computer and use it in GitHub Desktop.
VNC with i3

Using existing display

But default x11vnc on Ubuntu 18.04 also crashes with many Qt applications.

Compile x11vnc with a patch using instructions here: https://gist.github.com/mangoliou/407d6a39a60d128610c20c4143f39f0d

Create a password for vncserver

mkdir -p ~/.vnc
vncpasswd ~/.vnc/passwd

If you have a user logged in,then:

x11vnc -noxdamage -rfbauth ~/.vnc/passwd  -display :0 -forever -bg -repeat -nowf -o ~/.vnc/x11vnc.log

If no user logged in then,

sudo x11vnc -noxdamage -rfbauth ~/.vnc/passwd  -display :0 -forever -bg -repeat -nowf -o ~/.vnc/x11vnc.log -auth /var/run/lightdm/root/:0

You might have to replace -auth for different display manager like gdm, kdm, xfce

Allow a pass-through mode for i3 keybindings to reach the vncserver. Add the following lines in your ~/.config/i3/config

# Helps pass through vnc mode
mode "pass-through" {
    bindsym $mod+t mode "default"
}

bindsym $mod+t mode "pass-through"

I use remmina client for VNC which allows for ssh tunnel to the host. Use hostname:5900 for the host and use the same host as the ssh tunnel.

If you are using tightvncviewer, you have to setup a ssh tunnel yourself

ssh hostname -L5900:hostname:5900

And then connect to localhost:5900 using tightvncviewer.

Using VirtualGL display

Use TurboVNC + VirtualGL

Installation

https://gist.github.com/cyberang3l/422a77a47bdc15a0824d5cca47e64ba2

/opt/TurboVNC/bin/vncserver -vgl -rfbauth ~/.vnc/passwd

~/.vnc/xstartup contains

unset SESSION_MANAGER
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
dbus-launch --exit-with-session i3 &

Gnome session processes

Make sure to kill all gnome- processes from the real display because gnome likes to manage one session per user and remembers the old display.

Check what processes are running.

pgrep -fa gnome-

Kill the processes

pkill -f gnome-

Check if they were killed

pgrep -fa gnome-

Typically the annoying processes are gnome-keyring-daemon and gnome-terminal-server. The former will launch the password asking dialogue onto the original display and the later will launch it on do the same with new gnome-terminals.

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