After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 612210 - Enhancement: gnome-display-properties seamless VGA hotplugging
Enhancement: gnome-display-properties seamless VGA hotplugging
Status: RESOLVED NOTGNOME
Product: gnome-control-center
Classification: Core
Component: Display
2.29.x
Other Linux
: Normal normal
: ---
Assigned To: Soren Sandmann Pedersen
Control-Center Maintainers
Depends on:
Blocks: randr-tracker
 
 
Reported: 2010-03-08 16:14 UTC by Richard Neill
Modified: 2010-10-22 13:55 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Richard Neill 2010-03-08 16:14:02 UTC
I'd like to have gnome-display-properties automatically reconfigure my desktop when I plug in (or unplug) a VGA cable. 

At the moment, I have to:

1. Use the Gnome monitor config tool, to put an icon in the panel.

2. Each time I plug/unplug the VGA cable:
    - open the applet  (or if already open, click "Detect monitors" again)
    - Click "Apply"; "Keep configuration"
    - Close the applet window.

This particular netbook gets hotplugged/unplugged multiple times daily, so
I'd like to make this process really automatic, so it runs without any manual intervention (or at least to do it from a single click of the panel-applet).

Asides:
 - this probably shouldn't be on by default, as sometimes it can go wrong, and the 30-second timer to undo the configuration is useful.

 - It would be nice to have a second taskbar automatically created/destroyed
   when the external monitor is plugged in/out.
 
 - the monitor properties window should *always* show up on the LVDS screen.
   Either use the logic of "internal LCD always" or maybe "the same screen that
   has the primary panel", but never default to the VGA output (even if the
   X driver lists it as the first one).
   #Otherwise, you could have this window appear on a screen which isn't 
   #actually connected at the time!
   #(An alternative would be to clone the monitor-properties window on all
   screens) 

Thanks - Richard
Comment 1 Richard Neill 2010-03-22 03:13:21 UTC
Just to let you know, it's so very very nearly there. Once I've set up the dual monitor configuration using the gnome monitor applet, then a trivial shell script will suffice to make the VGA hotplugging work (and move windows off the ext monitor when unplugged). Gnome correctly handles moving the windows around when screens appear/disappear.

All you have to do is:

while (true){
  
  #Check current xrandr status
  xrandr --prop > xrandr.new

  #Has it changed from 1 second ago?
  diff -q xrandr.save xrandr.new >/dev/null

  if [ $? == 1 ]; then
     #Apply the changes - activate or deactivate the monitor; move windows.
     xrandr --auto
  fi

  #Save status
  mv xrandr.new xrandr.save
  sleep 1
}


Please could you make the gnome-xrandr panel applet do this on its own?
Also, polling is a bit icky; there's probably a better way :-)

Tested on Ubuntu Lucid Beta; Acer Aspire One netbook.


[P.S. Am moving this from "enhancement" to "normal", since I think this is now more similar to a correction to the existing behaviour, rather than a new feature.]
Comment 2 Christopher Halse Rogers 2010-07-05 00:24:11 UTC
This is driver-dependent, in that polling whether VGA is connected will cause the displays to be turned off for a brief period on some systems, so the display will flicker black for a frame or two.

Drivers now support sending hotplug events - Intel, Radeon and Nouveau all send hotplug events (at least as of kernel 2.6.35, I'm not sure when they started).  The gnome-settings-daemon xrandr plugin picks these up, and will reconfigure displays based on what settings you last had.

In short, this Works For Me™ right now, in Ubuntu Maverick.
Comment 3 Bastien Nocera 2010-10-22 13:55:46 UTC
This is purely a driver problem.

The drivers are supposed to be the ones detecting the newly plugged in monitors. This wasn't done in the past for VGA outputs because it caused internal displays to flicker, and other interesting side effects that I don't remember on top of my head.

BTW, doing what you're doing will certainly have adverse effects with the performance of your machine.