I am using a Thinkpad T510 and I often boot it in a ThinkPad Mini Dock Plus Series 3 (EU). The problem is that if I boot it with the lid closed, I can see grub, I can see the Ubuntu boot splash, but after that my external monitor (connected via VGA) turns off, and I have to open the lid and tell the NVIDIA driver manually to use the external screen and turn off the built in LCD panel. Is there a way to put it into an udev rule, or something like that to avoid the manual switching?
There are some tools to automate it like RandR, disper, displex or this one http://gnomefiles.org/content/show.php/Laptop+external+display+hotplugging?content=138742
I adjusted myself a script I found to my needs.
You can ignore the wacom commands. Those are just to match the input layer of the tablet to the screen orientation.
It identifies a status file in /sys/devices/platform/dock.0 wheter it has the value 1 for docked or 0 for undocked an triggers xrandr to adjust the display output to an extended dektop using the inbuilt display LVDS1 an configuring the external display HDMI2 above.