Sunday, 4 January 2009

External Monitor Key on the X300

Out of the box, the external monitor key (Fn-F7) on my Lenovo X300 didn't work. I found a great post on the ThinkWiki that described how to do it. I followed the instructions up to and including the "set permissions and restart acpi" section.

There was one small problem with the bash script that you put in /usr/local/sbin/thinkpad-fn-f7. Lines 39 and 40 didn't get the right values when one of the monitors was off, but still connected. I changed them to:
INTERNAL_STATE=$($SU xrandr | sed -n "s/${INTERNAL_OUTPUT}\Wconnected\W\([0-9]\+[xX][0-9]\++[0-9]\++[0-9]\+\).*/\1/p")
EXTERNAL_STATE=$($SU xrandr | sed -n "s/${EXTERNAL_OUTPUT}\Wconnected\W\([0-9]\+[xX][0-9]\++[0-9]\++[0-9]\+\).*/\1/p")
and all was good.

I posted my experience to the ThinkWiki discussion on the topic, so hopefully by the time you read this the fix will have been made there.

No comments: