1. Overview

Splitting a display into multiple virtual screens can be helpful while multitasking. By splitting, we can view multiple windows with different information on a single physical monitor. This can significantly contribute to the productivity.

In this tutorial, we’ll discuss how to split a display into two virtual screens using the xrandr command in Linux.

2. Installing xrandr

xrandr is a command-line tool in Linux. It provides a flexible option for users to tune display settings:

Further, the xrandr tool is readily accessible in most Linux distributions as it’s a part of the X Window System utilities.

Still, if it’s not available on our system, we can install it via the package manager directly from the terminal using, for example, the apt command:

$ sudo apt-get install x11-xserver-utils

Now, let’s run xrandr to verify our installation:

$ xrandr
Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 8192 x 8192
LVDS-1 connected primary 1366x768+1920+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1366x768  	60.05*+  40.01  
   1280x720  	60.05  
   1024x768  	60.05 

As we can see, using the xrandr command, we extract information regarding the current display parameters. Here, Screen 0 denotes the index, and LVDS-1 refers to the name of the physical monitor as they’re both defined in the system.

3. Setting Display Parameters With xrandr

To split the display, first, we need to create two virtual screens and set the resolution parameters for them.

First, let’s create two virtual screens using the –setmonitor option:

$ xrandr --setmonitor RIGHT 683/172x768/193+683+0 none
$ xrandr --setmonitor LEFT 683/172x768/193+0+0 LVDS-1

Here, LEFT is the chosen name for the virtual screen on the left part of the display, and RIGHT is the chosen name for the virtual screen on the right part of the display.

Furthermore, we set the screen dimension for each virtual screen as 683/172×768/193. There’s a general format for setting these dimensions:

width/width(in millimeters) × height/height(in millimeters)

Along with the dimension of the screen, we also set the position of the screen as 683+0. Here, 683 is the value of the horizontal offset from the left edge of the primary display, while 0 is the vertical offset from the top edge.

Importantly, LEFT virtual screen is associated with the LVDS-1 display, and RIGHT virtual screen isn’t associated with any physical display.

Next, we refresh the desktop environment using the –fb option in the xrandr command. While refreshing, we also set the size of the framebuffer as four times the height and width of the original physical display. Further, the framebuffer allows us to control display resolution and increases accessibility:

$ xrandr --fb 5464x3072
$ xrandr --fb 5464x3072

After we refresh the desktop environment, we can list the active displays by using the –listactivemonitors option:

$ xrandr --listactivemonitors
output list LVDS-1
add monitor LVDS-1
output name LVDS-1
Monitors: 2
 0: LEFT 683/172x768/193+0+0  LVDS-1
 1: RIGHT 683/172x768/193+683+0

Let’s check the result visually:

Splitting a display into two virtual screens in Linux

As we can see, we successfully split the displays into two virtual screens. Furthermore, we can quickly delete the virtual screens using the –delmonitor option:

$ xrandr --delmonitor LEFT
$ xrandr --delmonitor RIGHT

Finally, let’s refresh the desktop environment again:

$ xrandr --fb 5465x768
$ xrandr --fb 5464x768

Now, if we list the active displays using the –listactivemonitors option, we’d see that the virtual screens created earlier are deleted.

4. Using Aliases

We can define aliases in the .bashrc file to split the display into two virtual screens. Additionally, with the grep command, we can examine the current system configuration by searching for specific text or patterns within the .bashrc file:

$ grep xrandr .bashrc
alias createmon='xrandr --setmonitor LEFT 683/172x768/193+0+0 LVDS-1; xrandr --setmonitor RIGHT 683/172x768/193+683+0 none; xrandr --fb 5464x3072; xrandr --fb 5465x3072; xrandr --listactivemonitors'
alias delmon='xrandr --delmonitor LEFT;xrandr --delmonitor RIGHT; xrandr --fb 5465x3072; xrandr --fb 5464x3072'

Here, we created two aliases: createmon and delmon.

Now, running the createmon alias, we can split the display into two virtual screens:

$ createmon
output list LVDS-1
add monitor LVDS-1
output name LVDS-1
Monitors: 2
 0: LEFT 683/172x768/193+0+0  LVDS-1
 1: RIGHT 683/172x768/193+683+0

Similarly, we can delete the virtual screen by running the delmon alias:

$ delmon

The main advantage of this method is that the we can use this approach without knowing the complete commands. We can split the display into two virtual screens by executing a single command.

5. Conclusion

In this article, we discussed two methods using the xrandr command to split a display into two virtual screens in Linux.

The first method is prone to errors as this approach heavily depends on hardware and can lead to inconsistencies for different systems. The second method is suited for environments with regular users, but the users need certain rights to execute it successfully.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.