Good question. A bit tricky to answer, but here is a try.
There is actually a little reset possiblity included in X11. You can find it at
/etc/X11/Xreset. You could use the Xreset directory (
Xreset.d) to paste a script that runs automatically when a user logs out. The README file:
# Scripts in this directory are executed as root when a user log out from
# a display manager using /etc/X11/Xreset.
# The username of the user logging out is provided in the $USER environment
You could thus a) add a reset script in
/etc/X11/Xreset.d and b) make a script attached to a launcher that sets your dual external displays up. As such, you would log off and everything would be back to normal, you would log on to your laptop, hit the launcher for the displays and enjoy life.
You might want to look into
sudo dpkg-reconfigure -phigh xserver-xorg for resetting the xserver or (probably better look at the answer Mik suggested in the comments).
A SuSE guy wrote a nice article about X.
In a solved bugreport someone states:
admins can drop scripts in /etc/X11/Xreset.d/ to run after the user logs out.
This is the contents of the file:
You can find it on your own system.
# global Xreset file -- for use by display managers
# $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $
if [ ! -d "$SYSSESSIONDIR" ]; then
# Nothing to do, exiting
# use run-parts to source every file in the session directory; we source
# instead of executing so that the variables and functions defined above
# are available to the scripts, and so that they can pass variables to each
SESSIONFILES=$(run-parts --list $SYSSESSIONDIR)
if [ -n "$SESSIONFILES" ]; then
for SESSIONFILE in $SESSIONFILES; do
# vim:set ai et sts=2 sw=2 tw=80: