13

I am confronted with a problem when connecting the external monitor while the computer is open.

At that point it seems that xrandr adopts one of the combinations that do not work.

As a workaround to the other larger problem, I want to be able to modify the default display settings that xrandr has upon connecting the external monitor while the computer is running. (So that I may put a setting that avoids the problem: either by a combination of resolutions that works, or by starting just one of the monitors).

If I connect the external monitor before starting the system, xrandr selects mirror display at a certain rather low resolution that works.


Update:

xrandr
Screen 0: minimum 320 x 200, current 1360 x 768, maximum 4096 x 4096
VGA-0 connected 1360x768+0+0 (normal left inverted right x axis y axis) 580mm x 320mm
   1360x768       60.0*+
   1280x720       60.0  
   1024x768       60.0  
   800x600        60.3  
   640x480        60.0  
DVI-0 disconnected (normal left inverted right x axis y axis)
LVDS connected (normal left inverted right x axis y axis)
   1680x1050      60.1 +
   1400x1050      60.0  
   1280x1024      59.9  
   1440x900       59.9  
   1280x960       59.9  
   1280x854       59.9  
   1280x800       59.8  
   1280x720       59.9  
   1152x768       59.8  
   1024x768       59.9  
   800x600        59.9  
   848x480        59.7  
   720x480        59.7  
   640x480        59.4  
S-video disconnected (normal left inverted right x axis y axis)

When I connect the external desktop I want to use it at its best resolution (which, considering my other problem, excludes the use of the internal monitor). I can set from GUI the resolution for dual monitor. But upon connecting the cable for the external monitor, I want the internal to go off and the external to have 1360x768 - just like they were when I ran the xrandr command above.

  • 1
    You'll need to create an /etc/X11/xorg.conf file. Please post the output of xrandr (I know its in the other question but repeat it here so the Q is self contained). Also specify which screen you want to the right of which and what resolution they each should have. – terdon Oct 12 '13 at 14:00
  • Related question: unix.stackexchange.com/questions/78313/… – landroni Jan 4 '15 at 17:05
0

I don't know exactly how to write a default setting for xrandr when you connect an external monitor, but you can easily write a custom script and then associate it to a shortcut key, such as meta + P.

Example

> nano  /usr/bin/custom-xrandr
#!/bin/bash
xrandr --output VGA1 --off --output HDMI1 --auto

> chmod u+x /usr/bin/custom-xrandr

Then associate some shortcut to /usr/bin/custom-xrandr and every time you connect an external monitor just press that keys.

This should achieve exactly what you want.

  • 2
    I am not confronted with such problems at the present, but for people that may still have them (depending probably on some outdated software), your solution is good. - What I see now is the Linux systems that I use is that the proper resolution is adopted automatically for the external display when connected or when the displays are cycled with Meta-P key. If that is not done by default, my favorite solution is to cycle displays with one key using disper - more here. – user32012 Feb 7 '16 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy