[ltp] VGA hotplugging

Pedro Ribeiro linux-thinkpad@linux-thinkpad.org
Mon, 8 Mar 2010 12:51:56 +0000


On 8 March 2010 04:46, Richard Neill <rn214@hermes.cam.ac.uk> wrote:
> Dear all,
>
> Just wondering - has anyone got VGA hotplugging to really work elegantly =
and
> seamlessly?
>
> So far, the gnome-xrandr tool (under Lucid) does a wonderful job of letti=
ng
> me manually reconfigure the desktop after I plug/unplug a monitor.
>
> But what I really want is for the following:
>
> =A01. Plug in VGA cable
> =A0 =A0 =A0 =A0-> Automatically configures dual-monitors as a larger
> =A0 =A0 =A0 =A0 =A0 screen (*)
> =A0 =A0 =A0 =A0-> Ideally, adds a 2nd taskbar to the other screen.
> =A0 =A0 =A0 =A0 =A0 so that each monitor has its own taskbar.
>
> =A02. Unplug VGA cable:
> =A0 =A0 =A0 =A0-> reconfigures virtual desktop back to the original
> =A0 =A0 =A0 =A0 =A0 size. The mouse is now constrained to the actual scre=
en area
> =A0 =A0 =A0 =A0-> All windows are moved back to the visible existing scre=
en
> =A0 =A0 =A0 =A0 =A0 and resized.
>
>
> (*) Depending on the user and the use-case, we may want to:
> =A0- =A0clone the two displays (what happens if the aspect ratios differ)=
,
> =A0- =A0extend the desktop for dual-head
> =A0- =A0clone the two displays, and make the internal resolution/aspect
> =A0 =A0match the external one (when giving presentations)
>
>
> Is there any way to do this already? Has anyone written any scripts to do
> it?
>
> Thanks,
>
> Richard
> --
> The linux-thinkpad mailing list home page is at:
> http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
>

Hi Richard,

I have this working on Debian, so I believe it should work on Linux.

However you have to manually configure it once and can only have it
configured for one monitor at a time.

1) Connect VGA monitor
2) Open gnome-display-properties and set the monitor configuration you want

3) From now on, every time you connect the same monitor, either login
to GNOME with it connected (and gets set up to your preference
automatically) or
4) Use Fn+F7 to cycle through: mirror, extended desktop, or VGA output
only (with LCD panel disconnected)
5) When you disconnect the monitor, just re-login to GNOME or use
Fn+F7 to turn back the LCD on or disable the extended desktop.

The magic is done with gnome-settings-daemon. Keep in mind you can
have g-s-d running without using GNOME itself - I'm using openbox.

I'm afraid the advanced functionality you want is possible, but it
requires some bash script programming abilities coupled with an acpid
event on the Fn+F7 key. It would have to detect the maximum resolution
of the external monitor and set xrandr accordingly, allowing you to
cycle between the 3 modes at each Fn+F7.

I've been wanting to do it for some time now, but I haven't had the
time, since I only use one external monitor (my own) and do not need
to connect to other monitors, so gnome-display-properties plus Fn+F7
is fine for me. If you do it, please post!

Regards,
Pedro