30

Is there a way to split a single monitor in two, so that the two halves will be treated as separate monitors? This means that windows should fill half the screen when maximized. Also, gnome panels should fill half the screen.

Kalle Elmér
  • 7,658
  • 5
  • 26
  • 42

4 Answers4

29

The accepted answer did not work for me. What has worked though was adding virtual monitors in XRandR 1.5.

To split the monitor do the following:

  1. Enter xrandr into the terminal to check the output name and current resolution of the display you want to split.
    On my system the result was:

    Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
    HDMI1 disconnected (normal left inverted right x axis y axis)
    HDMI2 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm
       1920x1080     60.00*+  50.00    59.94
       1920x1080i    60.00    50.00    59.94  
       1600x900      60.00  
       1280x1024     75.02    60.02  
       1152x864      75.00  
       1280x720      60.00    50.00    59.94  
       1024x768      75.08    60.00  
       800x600       75.00    60.32  
       720x576       50.00  
       720x576i      50.00
       720x480       60.00    59.94
       720x480i      60.00    59.94
       640x480       75.00    60.00    59.94
       720x400       70.08
    VGA1 disconnected (normal left inverted right x axis y axis)
    VIRTUAL1 disconnected (normal left inverted right x axis y axis)
    

We can see that my monitor is connected to HDMI2 and the resolution is set to 1920x1080.

  1. Add 2 virtual monitors with the xrandr --setmonitor command ensuring that they overlap with your physical display and are placed next to each other. The syntax of the command is (without quotes):

    xrandr --setmonitor "monitor_name" "width_px"/"width_mm"x"height_px"/"height_mm"+"x_offset_px"+"y_offset_px" "output_name" 
    

For my system it was:

    xrandr --setmonitor HDMI2~1 960/254x1080/286+0+0 HDMI2
    xrandr --setmonitor HDMI2~2 960/255x1080/286+960+0 none
  1. While the above has already configured the virtual monitors on my system the changes haven't been applied until I have executed (it seems to refresh xrandr):

    xrandr --fb 1921x1080
    xrandr --fb 1920x1080
    
  2. Try to use both "monitors" in your preferred display setup tool, if needed, setup manually like this:

xrandr --output HDMI2~1 --mode 960x1080 --output HDMI2~2 --mode 960x1080 --right-of HDMI2~1

To persist the changes after reboot you would want to execute these commands when you login. You can do so by appending the commands at the end of your ~/.profile file.

higuita
  • 2,081
  • 1
  • 18
  • 12
Strachu
  • 411
  • 1
  • 4
  • 4
  • 6
    Want to +1 b/c would be a window-manager-agnostic way to simulate a multi-monitor setup, but is there a missing step? Using Kubuntu, the commands execute successfully. Both `xrandr --listmonitors` and `xrandr --listactivemonitors` show the added monitors, but `kwin` doesn't see them and everything behaves the same as before. – xiota Jun 07 '18 at 18:26
  • 1
    @xiota Unfortunately I can't help you as these steps were enough on my Xubuntu - I have executed them again as they are in the answer and the screen has correctly split into 2 parts. In Xfce's display settings I still see only 1 monitor but the screen is split and when I, for example, maximize a window it takes only half of screen. Ensure that in first command on step 3 you enter different resolution than is already set on your display otherwise the command will be ignored and nothing will happen. – Strachu Aug 11 '18 at 20:38
  • @xiota `kwin` does not respect xrandr's monitor settings. I use openbox kde session. It works. (No need to running `xrandr --fb`.) Though, the KDE taskbar still does not repect xrandr's monitor settings, which I consider as a feature. – weakish Apr 13 '19 at 10:26
  • This works perfectly for what I want to achieve with i3-wm. It can also be put into a script to quickly swap between setups – Post Self Jul 18 '20 at 08:25
  • This solution worked for me. Nonetheless, I would like to know how I can undo the change to be able to switch from two virtual screens back to one single default screen. Does anyone know any quick way to get back to the default single screen? – thosecars82 Jan 05 '21 at 01:15
  • @thosecars82 Try `xrandr --delmonitor HDMI2~2` (replace HDMI2~2 with the identifier you used in second --setmonitor call) and then the `xrandr --fb` hack (mentioned in the answer) to refresh xrandr. For example: `xrandr --delmonitor HDMI2~2 && xrandr --fb 1921x1080 && xrandr --fb 1920x1080` – Strachu Jan 18 '21 at 23:15
  • Thanks, that worked! – thosecars82 Jan 20 '21 at 13:49
  • 1
    Any idea how to get this working on Ubuntu 21.04? `xrandr` shows two monitors, but no changes in GUI. Resetting Gnome shell with `Alt+F2` and `R` too doesn't help. – Urmil Parikh Sep 23 '21 at 06:42
  • Did anyone figure out how to get this to work with kwin? I'm trying to use its tiling feature on a 55" 4K to make tiling work on a 4x4 grid as if it were 4 monitors arranged 2x2. Just as @weakish commented, I can see them in xrandr but kwin ignores this. Plasma/KDE has had feature requests for virtual monitors, but they have been ignored because "tiling". Please improve tiling then lol Edit: I'm going to use this solution for myself, won't add virtual monitors but should accomplish my goal. https://store.kde.org/p/1276605/ – MaKR May 03 '22 at 22:43
  • I've created a tool which may come in handy for managing your virtual displays called [xrandream](https://github.com/allfro/xrandream) on GitHub. It's a first cut but it works :) – Nadeem Douba May 07 '22 at 04:18
  • Ubuntu 20.04. I have the same issue, I see the active monitors in the list, but GUI is not changing at all. The only I found, that when you try to share screen in Google Meet you can see those created monitors. – Kostanos Jul 07 '22 at 19:07
13

It seems compiz has support for this. Under "General Options" in CompizConfig, on the "Display Settings" tab, it is possible to manually specify the "monitors" to use for maximizing windows. There is an issue with Adobe Flash and fullscreen, but overall it works quite well.

Since my graphics card merges three monitors into a single large one, this is very useful

Step by step instructions:

  1. Open a terminal by pressing Ctrl+Alt+T.
  2. Enter sudo apt-get install compizconfig-settings-manager and press enter. Fill out your password when requested. No asterisks will be displayed when entering the password.
  3. When the installation is done, launch the application "CompizConfig Settings Manager".
  4. Click "General Options" under the section "General".
  5. Select the tab "Display Settings".
  6. Uncheck "Detect Outputs".
  7. Edit the list of outputs as desired. Each line is one monitor. The syntax is WIDTHxHEIGHT+X+Y.
  8. See if works right away. You might need to log in and log out again.

Sample configuration for three classic 19-inch monitors in a horizontal row:

1280x1024+0+0
1280x1024+1280+0
1280x1024+2560+0
Kalle Elmér
  • 7,658
  • 5
  • 26
  • 42
  • For flash and fullscreen see http://al.robotfuzz.com/workaround-for-flash-on-linux-multihead-desktops/ – Alistair Buxton Jul 20 '12 at 19:09
  • 1
    Do you have any further details about how to do this? My graphics card merges two of my three monitors. – Tom Busby Mar 22 '17 at 21:54
  • I've edited my answer and added detailed instructions. – Kalle Elmér Apr 04 '17 at 20:22
  • Interestingly, while fiddling with CompizConfig my setup broke and the settings had no effect. Doing everything in this answer helped: http://askubuntu.com/questions/705414/desktop-manager-compiz-not-working – Kalle Elmér Apr 04 '17 at 20:59
  • This works but it seems now my screen blanks after like 20 seconds of inactivity - which is suboptimal for reading anything. Any ideas how to prevent that? Also, I made a script to automate this - my usecase is actually merging two monitors into one virtual. Sometimes it works without restsarting compiz, sometimes it needs to be restarted, not sure which is when. – sup Sep 29 '19 at 09:38
  • #!/bin/bash ; state=`gsettings get org.compiz.core:/org/compiz/profiles/unity/plugins/core/ detect-outputs`` ; if [ $state = "true" ] ; then gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ detect-outputs false ; gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ outputs "['2560x1440+0+0', '2880x2560+2560+0']" ; else gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ detect-outputs true ; fi – sup Sep 29 '19 at 09:38
2

This is fundamentally impossible in X11 architecture unless you rewrite the video drivers. I know this from bitter experience.

The only way you could do is by running multiple windowed virtual desktops (ie vnc or xnest/xephyr) in borderless windows. You'll then lose all graphics acceleration.

Alistair Buxton
  • 6,651
  • 3
  • 34
  • 65
  • While this isn't true anymore, this response is also quite old, so not technically wrong for that time... but still relevant, as vnc, xnest and specially xephyr are still valid solutions for certain setups – higuita Dec 30 '22 at 02:17
1

You might try using a tiling window manager.

KDE supports limited tiling out of the box. It will allow you to split you screen into two halves, though.

On the other end of the spectrum are Xmonad and Awesome. These are more difficult to set up, but some people swear by them. I used Xmonad for a long time and you get very adept at keyboard navigation. Reducing mouse usage, is the reason most people switch in the first place. I now use KDE because a few programs I use regularly don't tile very well and were a pain to use in Xmonad.

A happy medium might be to replace Gnome's window manager with Xmonad if you are a Gnome user.

AndrewJesaitis
  • 233
  • 1
  • 9