6

From a currently running X11 session, I would like to provide/run a VNC server such that it appears to my system as a second, “virtual” monitor – i.e. so that I can position it using xrandr and drag/position windows onto it.

How, if at all, could I achieve that?

Edit: More info from OP in comments: "Also asked here, without an answer. "

5

tl;dr: Force a "virtual" output of your gfx card to a display mode, and export that with x11vnc.


You can achieve this, but there are a few prerequisites:

  • A graphics card with multi-head capabilities (= can render several "desktop" surfaces). Which is most cards these days.
  • x11vnc, a mature software () to export X11 surfaces (among others) to VNC clients.

Most consumer cards these days can render several different outputs. Mine can do 3, out of the 5 that xrandr shows (eDP1,HDMI[12],DP[12]).

  • Pick an unused output from , in my example HDMI2.
  • Pick a resolution for the screen of the vnc client, and generate a mode:

    $ cvt 1920 1080
    # 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
    Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync

  • Add that mode to xrandr

    xrandr --newmode "1920x1080_60" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync

  • Put e.g. HDMI2 in that mode, and attach to the right of eDP1 (Main screen)

    xrandr --addmode HDMI2 1920x1080_60
    --output HDMI2 --mode 1920x1080_60 --right-of eDP1

  • Now export that with x11vnc, choosing the appropriate offset:

    x11vnc -display :0 -clip 1920x1080+1600+0 <other options>

    Note: Add desired encryption/authentication/other options to that command.

  • Now connect to with a VNC client to your "virtual monitor". (or modify above command to connect to a "listening" VNC-client.

  • 1
    With the notebook screen and a VGA monitor it fails saying xrandr: Configure crtc 2 failed. If I use only one screen (either VGA or embedded one) it works. How can I make it work with both screens? – Zhigalin Oct 13 '17 at 18:50
2

See this answer to be able to use VIRTUAL1 instead of a real output like HDMI2, and be able to manage it (select resolution, arrange desktop geometry, clone or extend) in the desktop environment screen settings like any other physical monitor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.