-
-
Save binarynoise/0be82483f99db89d5ef59a940bd182c0 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# https://github.com/dianariyanto/virtual-display-linux/ | |
# https://bbs.archlinux.org/viewtopic.php?id=180904 | |
# https://unix.stackexchange.com/questions/378373/add-virtual-output-to-xorg | |
set -euo pipefail | |
set -x | |
resolution="1920x1080" | |
screen="HDMI-2" | |
echo "Configuring monitor $screen to $resolution" | |
if ! ( xrandr | grep -Pzo ".*$screen'.*\n(\s+.*\n)+" | grep -E "\s$resolution\s" ); then | |
if ! ( xrandr | grep -E "\s$resolution\s" ); then | |
xrandr --newmode $resolution $(cvt ${resolution/x/ } 60.02 | grep "^Modeline" | sed -E 's/Modeline\s+"[^"]+"\s+//') | |
fi | |
xrandr --addmode $screen $resolution | |
fi | |
xrandr --output $screen --mode $resolution --right-of eDP-1 | |
echo "started display $screen to $resolution" | |
trap "xrandr --output $screen --off &" 0 1 3 6 14 15 | |
killall /usr/bin/x0vncserver || true | |
echo "starting x0vncserver" | |
x0vncserver \ | |
-rfbauth ~/.vnc/passwd \ | |
-AcceptKeyEvents=off -AcceptPointerEvents=off -AcceptSetDesktopSize=off \ | |
-Geometry=$resolution+1920+0 \ | |
# -FrameRate 15 \ | |
xrandr --output $screen --off |
Mmh. Seems it doesn't work for you. What does your vnc client display if you remove the geometry from the commandline when the virtual display is active?
Mmh. Seems it doesn't work for you. What does your vnc client display if you remove the geometry from the commandline when the virtual display is active?
My main screen only.
The problem is the virtual screen is never active. I never see it appear in my XFCE4 screen settings, nor can I move past my main screen boundaries.
It will appear as disconnected in xrandr but with an available video mode.
I never see it appear in my XFCE4 screen settings
I use cinnamon, but it won't appear in its display settings either. I can move windows over to the virtual monitor though, and in arandr
(like a gui for xrandr).
Maybe XFCE does some things different so it won't work. You maybe need a dummy HDMI plug
Removing
+1920+0
from line 19 fixes the VNC server from crashing (but of course, it is just a mirror of the main screen). The X server is not drawing anything at all over the bounds of the main screen, as the system is still seeing only 1 screen.