Dynamic configuring multiple x-screens using RandR (xrandr) in Linux

4

1

I can use a external physical Dell monitor at work connecting it through VGA port to my ThinkPad laptop. I have Debian testing installed, along with KDE5.5 and i3wm. See detailed information below.

Situation: I will use single monitor (laptop) at home, while I would like to use a dual monitor setup at work. Both XRandR and KDE now enable me to connect both physical displays (laptop and Dell monitor connected via VGA) into a single big extended x-screen, so that I can move windows and mouse between the physical monitors' display.

Problem: However, I want to export each physical monitor's display as a separate x-screen dynamically, preferably using xrandr if it can do it. By dynamically, I mean I can hot-plug the extended monitor at any time and there will be either 1 or 2 x-screens depending on whether extended monitor is connected. And I can disable either of the physical display while both are connected.

XRandR does almost all of the above; however, it only exports a single x-screen. I wanted 2 x-screens.

$ xrandr
Screen 0: minimum 320 x 200, current 2416 x 1680, maximum 8192 x 8192
VGA-0 connected 1050x1680+0+0 left (normal left inverted right x axis y axis) 474mm x 296mm
   1680x1050     59.95*+
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1024x768      75.08    60.00  
   800x600       75.00    60.32  
   640x480       75.00    60.00  
   720x400       70.08  
HDMI-0 disconnected (normal left inverted right x axis y axis)                                        
LVDS connected primary 1366x768+1050+0 (normal left inverted right x axis y axis) 345mm x 194mm       
   1366x768      59.64*+  50.00                                                                       
   1280x720      59.86                                                                                
   1152x768      59.78                                                                                
   1024x768      59.92                                                                                
   800x600       59.86                                                                                
   848x480       59.66                                                                                
   720x480       59.71                                                                                
   640x480       59.38              

So, instead of what I see above, I wanted an output like this, preferably with minimal or no configuration in xorg.conf:

$ xrandr
Screen 0: minimum 320 x 200, current 1050 x 1680, maximum 8192 x 8192
VGA-0 connected 1050x1680+0+0 left (normal left inverted right x axis y axis) 474mm x 296mm
   1680x1050     59.95*+
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1024x768      75.08    60.00  
   800x600       75.00    60.32  
   640x480       75.00    60.00  
   720x400       70.08  
HDMI-0 disconnected (normal left inverted right x axis y axis)                                        
Screen 1: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
LVDS connected primary 1366x768+1050+0 (normal left inverted right x axis y axis) 345mm x 194mm       
   1366x768      59.64*+  50.00                                                                       
   1280x720      59.86                                                                                
   1152x768      59.78                                                                                
   1024x768      59.92                                                                                
   800x600       59.86                                                                                
   848x480       59.66                                                                                
   720x480       59.71                                                                                
   640x480       59.38              

Note that in this case, I would have $DISPLAY of 0 and 1.

hyiltiz

Posted 2016-02-10T02:33:26.820

Reputation: 276

I need this too! I'm setting up a machine with two full-screen applications (cash register/kiosk), and they have problems sharing a single X display. – Skylar Ittner – 2016-09-14T01:37:58.877

No answers