Created
August 29, 2022 14:39
-
-
Save binarynoise/0be82483f99db89d5ef59a940bd182c0 to your computer and use it in GitHub Desktop.
Virtual Display VNC-Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?