Using xrandr to create a virtual display (Linux)

Author: crisszkutnikCreated Jan 25, 2021Updated Feb 24, 2025

Creating a virtual display with xrandr that can be broadcasted as an extra monitor is fairly easy on Linux. I think that this method should be implemented as a guide as it is a viable method for Linux users without the need of extra drivers or a dummy plug. To achieve this I did the following:

First, run the following command:

xrandr

Command output
    DisplayPort-0 disconnected (normal left inverted right x axis y axis)
            DisplayPort-1 disconnected (normal left inverted right x axis y axis)
            DisplayPort-2 disconnected (normal left inverted right x axis y axis)
    HDMI-A-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 521mm x 293mm
             1920x1080     60.00*+  71.91    50.00    59.94  
             1680x1050     59.88  
             1600x900      60.00  
             1280x1024     60.02  
             1440x900      59.90  
             1280x800      59.91  
             1280x720      60.00    50.00    59.94  
             1024x768      70.07    60.00  
             800x600       72.19    60.32    56.25  
             720x576       50.00  
             720x480       60.00    59.94  
             640x480       72.81    66.67    60.00    59.94  
             720x400       70.08  
    DVI-D-0 disconnected (normal left inverted right x axis y axis)
             1920x1080     60.00  
    DP-1-4 disconnected (normal left inverted right x axis y axis)
    HDMI-1-2 disconnected (normal left inverted right x axis y axis)
    DP-1-5 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 531mm x 299mm
             1920x1080     60.00*+
             1680x1050     59.88  
             1280x1024     75.02    60.02  
             1440x900      74.98    59.90  
             1280x960      60.00  
             1280x800      59.91  
             1152x864      75.00  
             1024x768      75.03    70.07    60.00  
             832x624       74.55  
             800x600       72.19    75.00    60.32    56.25  
             640x480       75.00    72.81    66.67    59.94  
             720x400       70.08  
    DP-1-6 disconnected (normal left inverted right x axis y axis)
    HDMI-1-3 disconnected (normal left inverted right x axis y axis)
            1920x1080 (0x5b) 148.500MHz +HSync +VSync
                                    h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
                                    v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
            1680x1050 (0x5f) 119.000MHz +HSync -VSync
                                    h: width  1680 start 1728 end 1760 total 1840 skew    0 clock  64.67KHz
                                    v: height 1050 start 1053 end 1059 total 1080           clock  59.88Hz
            1280x1024 (0x61) 108.000MHz +HSync +VSync
                                    h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
                                    v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
            1440x900 (0x62) 88.750MHz +HSync -VSync
                                    h: width  1440 start 1488 end 1520 total 1600 skew    0 clock  55.47KHz
                                    v: height  900 start  903 end  909 total  926           clock  59.90Hz
            1280x800 (0x63) 71.000MHz +HSync -VSync
                                    h: width  1280 start 1328 end 1360 total 1440 skew    0 clock  49.31KHz
                                    v: height  800 start  803 end  809 total  823           clock  59.91Hz
            1024x768 (0x67) 75.000MHz -HSync -VSync
                                    h: width  1024 start 1048 end 1184 total 1328 skew    0 clock  56.48KHz
                                    v: height  768 start  771 end  777 total  806           clock  70.07Hz
            1024x768 (0x68) 65.000MHz -HSync -VSync
                                    h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
                                    v: height  768 start  771 end  777 total  806           clock  60.00Hz
            800x600 (0x69) 50.000MHz +HSync +VSync
                                    h: width   800 start  856 end  976 total 1040 skew    0 clock  48.08KHz
                                    v: height  600 start  637 end  643 total  666           clock  72.19Hz
            800x600 (0x6a) 40.000MHz +HSync +VSync
                                    h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
                                    v: height  600 start  601 end  605 total  628           clock  60.32Hz
            800x600 (0x6b) 36.000MHz +HSync +VSync
                                    h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
                                    v: height  600 start  601 end  603 total  625           clock  56.25Hz
            640x480 (0x6f) 31.500MHz -HSync -VSync
                                    h: width   640 start  664 end  704 total  832 skew    0 clock  37.86KHz
                                    v: height  480 start  489 end  492 total  520           clock  72.81Hz
            640x480 (0x70) 30.240MHz -HSync -VSync
                                    h: width   640 start  704 end  768 total  864 skew    0 clock  35.00KHz
                                    v: height  480 start  483 end  486 total  525           clock  66.67Hz
            640x480 (0x72) 25.175MHz -HSync -VSync
                                    h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
                                    v: height  480 start  490 end  492 total  525           clock  59.94Hz
            720x400 (0x73) 28.320MHz -HSync +VSync
                                    h: width   720 start  738 end  846 total  900 skew    0 clock  31.47KHz
                                    v: height  400 start  412 end  414 total  449           clock  70.08Hz

Here I selected one of the disconnected outputs. For this example I am going to use DVI-D-0

If there is no output mode, one can be added with

bash
xrandr --addmode DVI-D-0 1920x1080

# you may use the output you selected and the resolution you want

Next step is to identify the display you are going to use to position your new display. For example, I want to place my virtual display to the left of my primary display, which is HDMI-A-0, so I run the following command:

bash
xrandr --output DVI-D-0 --mode 1920x1080 --left-of HDMI-A-0

# replace DVI-D-0 with the virtual output you selected
# and 1920x1080 with the resolution you chose on the previous command

# other options are --right-of, --above and --below

Finally, when running deskreen:

deskreen_working

The virtual display is available (Screen 2).

If you want to disconnect the display, just run:

xrandr --output DVI-D-0 --off

I am willing to do a complete guide and open a pull request if you think it is a good enough method.