2

This is a folow-up to a previous question (Saving monitor settings?), where we learned that the configuration is saved in file ~/.config/monitors.xml.

My problem is that my configuration is usually, but not always restored. I.e., quite often I have to call the display capplet to reconfigure the 3 monitors when I come to work. This is tedious and I want to avoid that.

I can save the monitors.xml file so that even when ubuntu overwrites it I can restore it. However, the question is: how do I tell ubuntu to read the file? I don't want to logout or reboot.

PS. System76 Gazelle Pro, Ubuntu 15.10, Unity.

PPS. The configuration is:

  <configuration>
      <clone>no</clone>
      <output name="eDP1">
          <vendor>CMN</vendor>
          <product>0x15bb</product>
          <serial>0x00000000</serial>
          <width>1920</width>
          <height>1080</height>
          <rate>60</rate>
          <x>1080</x>
          <y>0</y>
          <rotation>normal</rotation>
          <reflect_x>no</reflect_x>
          <reflect_y>no</reflect_y>
          <primary>yes</primary>
      </output>
      <output name="HDMI1">
          <vendor>DEL</vendor>
          <product>0xa07a</product>
          <serial>0x354c3553</serial>
          <width>1920</width>
          <height>1200</height>
          <rate>60</rate>
          <x>3000</x>
          <y>0</y>
          <rotation>left</rotation>
          <reflect_x>no</reflect_x>
          <reflect_y>no</reflect_y>
          <primary>no</primary>
      </output>
      <output name="VGA1">
          <vendor>DEL</vendor>
          <product>0x4071</product>
          <serial>0x414b314c</serial>
          <width>1920</width>
          <height>1080</height>
          <rate>60</rate>
          <x>0</x>
          <y>0</y>
          <rotation>left</rotation>
          <reflect_x>no</reflect_x>
          <reflect_y>no</reflect_y>
          <primary>no</primary>
      </output>
      <output name="VIRTUAL1">
      </output>
  </configuration>

PPPS. xrandr output:

$ xrandr
Screen 0: minimum 8 x 8, current 4200 x 1920, maximum 32767 x 32767
eDP1 connected primary 1920x1080+1080+0 (normal left inverted right x axis y axis) 344mm x 194mm
   1920x1080     60.01*+  59.93  
   1680x1050     59.95    59.88  
   1600x1024     60.17  
   1400x1050     59.98  
   1600x900      60.00  
   1280x1024     60.02  
   1440x900      59.89  
   1280x960      60.00  
   1368x768      60.00  
   1360x768      59.80    59.96  
   1152x864      60.00  
   1280x720      60.00  
   1024x768      60.00  
   1024x576      60.00  
   960x540       60.00  
   800x600       60.32    56.25  
   864x486       60.00  
   640x480       59.94  
   720x405       60.00  
   640x360       60.00  
HDMI1 connected 1200x1920+3000+0 left (normal left inverted right x axis y axis) 518mm x 324mm
   1920x1200     59.95*+
   1920x1080     60.00  
   1600x1200     60.00  
   1680x1050     59.88  
   1280x1024     60.02  
   1280x960      60.00  
   1024x768      60.00  
   800x600       60.32  
   640x480       60.00  
   720x400       70.08  
VGA1 connected 1080x1920+0+0 left (normal left inverted right x axis y axis) 510mm x 287mm
   1920x1080     60.00*+
   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  
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
4
  • If you tell us what your monitor settings are, you can (re-) set the any time with xrandr, even have different settings under shortcut keys or in a quicklist (if it's Unity). Nov 24, 2015 at 14:52
  • Could you, for readability, add it as the output of xrandr, and also what you have changed from the default? Nov 24, 2015 at 15:05
  • This is the content of monitors.xml. Shouldn't it be enough?
    – sds
    Nov 24, 2015 at 15:37
  • As mentioned, usually not all settings need to be set/confirmed in a command, since most of them are pretty much the default. It would make a long script. I'd like like to know what you changed in the configuration. Also, I (and most of us) are used to read xrandr, which reads more comfortably IMO. Nov 24, 2015 at 15:46

1 Answer 1

2

Assuming you did not have to change the monitor resolution (if so, just mention it), and your setup exists from arranging them from left to right, the (quite long :) )command:

xrandr --output VGA1 --pos 0x0  --rotate left &&\
xrandr --output eDP1 --pos 1080x0 --rotate normal &&\
xrandr --output HDMI1 --pos 3000x0 --rotate left

should create the arrangement like you want.

Explanation:

From the output of xrandr, for every screen, there is a string, looking like:

VGA-1 connected 1280x1024+1680+0

Which gives us information on how the screen is situated in the "whole picture" as explained here. Subsequently, you can arrange your screen(s) by the command:

xrandr --output <screenname> --pos <xxy> 

and to rotate:

xrandr --output <screenname> --rotate left

for two of the three screens. The --rotate normal for screen 1 should not be necessary, but to make sure...

like used in the command in the (this) answer.

Important note

If you make the setup like this, it is important that you set up your screens from left to right, meaning that the commands need to be arranged in that order.

Adding the command to a shortcut key

For convenience reasons, you can add the command to a shortcut key: choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:

/bin/bash -c "xrandr --output VGA1 --pos 0x0  --rotate left && xrandr --output eDP1 --pos 1080x0 --rotate normal && xrandr --output HDMI1 --pos 3000x0 --rotate left"

to a shortcut.

8
  • I think you are missing screen rotation in the commands
    – sds
    Nov 24, 2015 at 16:38
  • @sds ah, you're right of course, wait a minute... Nov 24, 2015 at 16:42
  • @sds done, please try for typos. Nov 24, 2015 at 16:50
  • thanks, can't I set rotation and position in the same command?
    – sds
    Nov 24, 2015 at 17:00
  • @sds you're right of course. edited. Nov 24, 2015 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .