Difference between revisions of "Sample Fn-F7 script"

From ThinkWiki
Jump to: navigation, search
Line 6: Line 6:
  
 
<code>
 
<code>
# fn-F7
+
# fn-F7
event=ibm/hotkey HKEY 00000080 00001007
+
event=ibm/hotkey HKEY 00000080 00001007
action=/usr/local/sbin/thinkpad-fn-f7
+
action=/usr/local/sbin/thinkpad-fn-f7
 
</code>
 
</code>
  
Line 17: Line 17:
  
 
<code>
 
<code>
mkdir -p /var/lib/thinkpad
+
mkdir -p /var/lib/thinkpad
echo "internal" > /var/lib/thinkpad/screen.state
+
echo "internal" > /var/lib/thinkpad/screen.state
chmod 755 /usr/local/sbin/thinkpad-fn-f7
+
chmod 755 /usr/local/sbin/thinkpad-fn-f7
service acpid restart
+
service acpid restart
 
</code>
 
</code>

Revision as of 16:40, 12 November 2007

This setup will let you use fn-F7 key combination to toggle between internal, external, or both screens. Tested on ThinkPad X60s running Fedora 8.

Note: you will need to change the internal and external resolution until someone fixes this script to figure it out from xrandr, you may also need to change output names from "VGA" and "LVDS" to what your xrandr tells you.

Create /etc/acpi/events/thinkpad.conf:

# fn-F7
event=ibm/hotkey HKEY 00000080 00001007
action=/usr/local/sbin/thinkpad-fn-f7

Create /usr/local/sbin/thinkpad-fn-f7: ...

As root,

mkdir -p /var/lib/thinkpad
echo "internal" > /var/lib/thinkpad/screen.state
chmod 755 /usr/local/sbin/thinkpad-fn-f7
service acpid restart