Created
January 24, 2013 04:49
-
-
Save dstar4138/4617737 to your computer and use it in GitHub Desktop.
dock-undock script for w520 with the mini dock plus. To install, place in /etc/init.d/. and run 'update-rc.d dock-undock.sh defaults'.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: dock-undock.sh | |
# Required-Start: $local_fs $remote_fs $bumblebeed | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: | |
# Short-Description: Check if laptop is docked or undocked and change XOrg. | |
# Description: Check if laptop is docked or undocked and change XOrg config. | |
### END INIT INFO | |
set -e | |
DOCKED=`hwinfo | grep "ThinkPad Mini Dock Plus Series 3" | wc -l` | |
LOG=/var/log/docked_status.log | |
if [ $DOCKED -gt 0 ]; then | |
cp /etc/X11/xorg.conf.docked /etc/X11/xorg.conf | |
YN="{DOCKED}" | |
echo ON | tee /proc/acpi/bbswitch | |
else | |
cp /etc/X11/xorg.conf.undocked /etc/X11/xorg.conf | |
YN="{UNDOCKED}" | |
echo OFF | tee /proc/acpi/bbswitch | |
fi | |
echo "[`date`] DOCK STATUS = $YN" >> $LOG | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment