Skip to content

Instantly share code, notes, and snippets.

@rbreaves
Last active December 4, 2023 09:12
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 rbreaves/87059f92f030ee4e068f911ddb56a4dd to your computer and use it in GitHub Desktop.
Save rbreaves/87059f92f030ee4e068f911ddb56a4dd to your computer and use it in GitHub Desktop.
#/bin/bash
# Clone, compile & install
git clone --single-branch --branch Super-with-Scrolling https://github.com/rbreaves/x11vnc.git
# Enable all sources
sudo sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list"
cd ./x11vnc
sudo apt update
sudo apt-get build-dep x11vnc
autoreconf -fiv
./configure
make
sudo make install
# Get your keyboard and mouse event id's
ls -l /dev/input/by-id
# or if not available
ls -l /dev/input/by-path
ls -l /dev/input/
# Alternatively you can sudo cat your inputs to figure out which is your keyboard and which is your mouse
sudo cat /dev/input/eventX
# Use mouse event id for direct_abs below
# Use keybord event id for direct_key below
# Make sure you update my id's to your id's in the command below
# Command is now revised to fix cursor as well (vnc client may need tweaking to avoid double cursors, or dots)
sudo /usr/local/bin/x11vnc -forever -display :0 -auth guess -rfbport 5900 -noxdamage -pipeinput UINPUT:direct_key=/dev/input/event1,direct_abs=/dev/input/event7 -overlay -repeat -cursor_drag -nocursorshape -usepw
# If combined w/ xrdp then you may need to update an ini file
# to pass all modifier keys properly, not sure.
# https://github.com/neutrinolabs/xrdp/issues/2169#issuecomment-1059792757
@rbreaves
Copy link
Author

rbreaves commented Jun 14, 2022

Just to note the best VNC client to use, whether you are on Windows, Mac or Linux is RealVNC imo. You may need to disable some remapping that RealVNC attempts to do under macOS & also disable the local cursor under all OS's when using RealVNC. UltraVNC is fast and interesting, but ultimately I felt RealVNC did a better job overall and is cross platform.

Can't really think of anything else to note here. Of course it is best to tunnel your correction or use secure means of using VNC. This solution appears to work surprisingly well over all.

Other things to note I guess is that under Virtualization of Vmware workstation vs HyperV.. HyperV appears to perform better, but I need to do more extensive tests and make sure it wasn't HyperV that caused the slow downs for Vmware in the first place. Either way it is very positive to see it perform well with a virtualization solution like HyperV imo, it is not preferred and usually due to a lack of performance, but responsiveness has been very good.

Oh other thing to note about HyperV is that your keyboard inputs event id will often change.. so on the server end if you create a service you may be best off querying and parsing the event id on each boot. I will follow this up later with more info.

Reading online some Linux DEs or compositors like Marco might be better off disabled while using VNC? I am not sure, I have not tried that, and I tend to use Budgie any ways, so not a DE that uses Marco any ways (Mate, xfce, etc).

@rbreaves
Copy link
Author

On macOS Jump Desktop is actually better than RealVNC - Jump Desktop is the only one that will allow you to go full screen without creating a new Space (edit in preferences). This makes it easier to switch to apps in your dock vs being kicked out of your "Space" as fullscreen apps often don't allow other apps to overlay on top of your fullscreen app.

@learex
Copy link

learex commented Dec 4, 2023

I've gotten almost everything to work, except for the x11vnc that ist redirecting my input.
At first it said that /root/.XAuthoritiy didn't exist, so I touched it, but now it still fails. Any idea why?

Setup: macOS via Jump Desktop (latest, respectively) using RDP to Ubuntu 22.04 with xrdp.

sudo /usr/local/bin/x11vnc -forever -display :0 -auth guess -rfbport 5900 -noxdamage -pipeinput UINPUT:direct_key=/dev/input/event2,direct_abs=/dev/input/event3 -overlay -repeat -cursor_drag -nocursorshape -usepw
04/12/2023 09:56:16 passing arg to libvncserver: -rfbport
04/12/2023 09:56:16 passing arg to libvncserver: 5900
04/12/2023 09:56:16 -usepw: found /root/.vnc/passwd
04/12/2023 09:56:16 x11vnc version: 0.9.16 lastmod: 2019-01-05  pid: 22063
/tmp/fd.m0hJQo: 320: [: -a: unexpected operator
04/12/2023 09:56:17 -auth guess: failed for display=':0'
04/12/2023 09:56:17 -auth guess: since we are root, retrying with FD_XDM=1
/tmp/fd.hvK4pX: 320: [: -a: unexpected operator
04/12/2023 09:56:17 -auth guess: failed for display='0'

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