Change VNC client into a secondary display for Linux

Tuesday, May 12, 2020

iPad VNC

My Environment

  • Intel i5-7200u (KabyLake) and HD Graphics 620
  • Debian GNU/Linux bullseye(testing) linux kernel 5.6.7
  • I have both Wayland and Xorg on my laptop and chose Gnome on Xorg from GDM login interface
  • Laptop built-in screen (1920 x 1080 60Hz)
  • iPad mini5 (2048 x 1356 60Hz)

Requirement

  • x11vnc (only works for Xorg, hasn’t supported Wayland yet)
  • xrandr
  • cvt

Step

0x00: add a virtual monitor

I took this snippet from StackOverflow

Create and edit /etc/X11/xorg.conf.d/01-dummy-monitor.conf

Section "Device"
    Identifier      "Configured Video Device"
    Driver "intel"         #CHANGE THIS
    Option "TearLess"   "1"
EndSection

Section "Monitor"
    Identifier      "Configured Monitor"
EndSection

Section "Screen"
    Identifier      "Default Screen"
    Monitor         "Configured Monitor"
    Device          "Configured Video Device"
EndSection

Then REBOOT

0x01: config xrandr

$ xrandr

Output should have something like

eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 
VIRTUAL1 connected (normal left inverted right x axis y axis)

eDP1 is usually your primary (built-in for laptop) display

Then

$ cvt 2048 1536

should get

# 2048x1536 59.95 Hz (CVT 3.15M3) hsync: 95.45 kHz; pclk: 267.25 MHz
Modeline "2048x1536_60.00"  267.25  2048 2208 2424 2800  1536 1539 1543 1592 -hsync +vsync

After that

$ xrandr --newmode "2048x1536-60" 267.25  2048 2208 2424 2800  1536 1539 1543 1592 -hsync +vsync

and

$ xrandr --addmode VIRTUAL1 2048x1536-60 

Here type

$ xrandr

you can find a new mode has been added to the virtual monitor

VIRTUAL1 connected (normal left inverted right x axis y axis)
   2048x1536-60  59.95  

Then you can adjust your display settings with gnome-control-center or those equivalents from other DE

0x02: start VNC server

$ x11vnc -display :0 -clip 2048x1536 -multiptr

add --multiptr to make sure your cursor can been seen from the secondary display

If you don’t know your server ip, use

$ ip addr

x11vnc takes 5900 as default port

0x03: connect to server

I use a free client VNC Viewer (provided by RealVNC) which can be easily got from AppStore(Japan).

Misc

Lower the virtual display DPI (making interface lager)

$ xrandr --output VIRTUAL1 --scale 0.5x0.5 

or make it smaller

xrandr --output VIRTUAL1 --scale 2x2 
linux
CC BY 4.0

Producer-consumer problem

comments powered by Disqus