Thinkpad "Series 3" Docking Station on Linux

I just got a ThinkPad Mini Dock Plus Series 3 - 90W and tried to configure my Linux system to automatically switch to the external displays. Unfortunately, thinkwiki's instructions don't work with the "Series 3" docking stations anymore, and thinkwiki seems to be read-only right now.

First of all, it looks like you're going to need a 3.x kernel. I'm also assuming a running acpid. I expect these instructions to work with all "Series 3" docking station and all notebooks with an Intel graphics card. You may want to modify thinkpad-dock.sh and thinkpad-undock.sh depending on your preferences and monitor setup (HDMI2 is the DisplayPort port, and HDMI3 the DVI one). Make sure to replace $SUDO_USER with a user who's allowed to access and change X settings, or use xhost to allow the ACPI user to modify xhost properties.

cat >/etc/acpi/events/thinkpad-dock-ibm <<EOF event=ibm/hotkey IBM0068:00 00000080 00004010 action=su $SUDO_USER -c /etc/acpi/thinkpad-dock.sh EOF cat >/etc/acpi/events/thinkpad-dock-lenovo <<EOF event=ibm/hotkey LEN0068:00 00000080 00004010 action=su $SUDO_USER -c /etc/acpi/thinkpad-dock.sh EOF cat >/etc/acpi/events/thinkpad-undock-ibm <<EOF event=ibm/hotkey IBM0068:00 00000080 00004011 action=su $SUDO_USER -c /etc/acpi/thinkpad-undock.sh EOF cat >/etc/acpi/events/thinkpad-undock-lenovo <<EOF event=ibm/hotkey LEN0068:00 00000080 00004011 action=su $SUDO_USER -c /etc/acpi/thinkpad-undock.sh EOF cat >/etc/acpi/thinkpad-dock.sh <<EOF #!/bin/sh # 2 invocations because the Intel graphics card can only handle two outputs at a time xrandr -d :0.0 --output HDMI2 --auto --primary --output LVDS1 --off xrandr -d :0.0 --output HDMI3 --auto --left-of HDMI2 EOF chmod a+x /etc/acpi/thinkpad-dock.sh cat >/etc/acpi/thinkpad-undock.sh <<EOF #!/bin/sh xrandr -d :0.0 --output HDMI2 --off xrandr -d :0.0 --output LVDS1 --auto --primary --output HDMI3 --off EOF chmod a+x /etc/acpi/thinkpad-undock.sh /etc/init.d/acpid reload

On my system, xrandr is horrendously slow (in the order of seconds), but, well, it works. Please send any improvements and comments to this guide to phihag@phihag.de. Thanks, in particular to Hubert Ritzdorf for noting alternative event IDs!