Good question. A bit tricky to answer, but here is a try.
Basic Answer
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
# variable.
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.
More information
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.
#!/bin/sh
#
# /etc/X11/Xreset
#
# global Xreset file -- for use by display managers
# $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $
set -e
PROGNAME=Xreset
SYSSESSIONDIR=/etc/X11/Xreset.d
if [ ! -d "$SYSSESSIONDIR" ]; then
# Nothing to do, exiting
exit 0
fi
# 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
# other
SESSIONFILES=$(run-parts --list $SYSSESSIONDIR)
if [ -n "$SESSIONFILES" ]; then
set +e
for SESSIONFILE in $SESSIONFILES; do
. $SESSIONFILE
done
set -e
fi
exit 0
# vim:set ai et sts=2 sw=2 tw=80:
xrandr
that might be useful.