Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
1  
@terdon - have updated. thank you – cipricus Oct 12 '13 at 15:06
    
Related question: unix.stackexchange.com/questions/78313/… – landroni Jan 4 '15 at 17:05

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.

share|improve this answer
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. – cipricus Feb 7 at 20:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.