commit 48572363d367a2969c0566f7fc6d3fd80d635122 Author: luxick Date: Thu Dec 29 16:51:45 2016 +0100 fancontrol & dockdetector added diff --git a/dockdetector b/dockdetector new file mode 100755 index 0000000..4af98c4 --- /dev/null +++ b/dockdetector @@ -0,0 +1,40 @@ +#!/bin/bash +export XAUTHORITY=/home/luxick/.Xauthority +export DISPLAY=:0.0 + +# Device that appears only in docked mode (USBDeveices, etc) +IDENTIFIER_DEVICE="/dev/disk/by-uuid/840f4c9f-bbf4-4d92-972f-8ec827bd36dc" +DOCKING_STATUS=0 + +# Change Wallpaper when docked/undocked +WALLPAPER_DOCKED="./docked.png" +WALLPAPER_UNDOCKED="./undocked.png" + +echo "Thinkpad Dock detection started" + +while [[ true ]]; do + if [ -e "$IDENTIFIER_DEVICE" ]; then + if [[ $DOCKING_STATUS = 0 ]]; then + + while [[ ! $(xrandr | grep HDMI3 | grep connected) ]]; do + sleep 0.5s + done + + #xrandr --output HDMI3 --primary --auto --pos 1280x0 --output LVDS1 --mode 1280x800 --pos 0x0 + ~/.screenlayout/dock.sh + feh --bg-scale $WALLPAPER_DOCKED + #i3-msg workspace 9:www &>/dev/null; i3-msg move workspace to output left &>/dev/null; i3-msg workspace back_and_forth &>/dev/null + #i3-msg workspace 10:mail &>/dev/null; i3-msg move workspace to output left &>/dev/null; i3-msg workspace back_and_forth &>/dev/null + DOCKING_STATUS=1 + echo `date` "Thinkpad Docked" + fi + else + if [[ $DOCKING_STATUS == 1 ]]; then + ~/.screenlayout/undock.sh + feh --bg-scale $WALLPAPER_UNDOCKED + DOCKING_STATUS=0 + echo `date` "Thinkpad Undocked" + fi + fi + sleep 1s +done diff --git a/fancontrol b/fancontrol new file mode 100755 index 0000000..8987ba9 --- /dev/null +++ b/fancontrol @@ -0,0 +1,44 @@ +#!/bin/bash +# In auto mode the fan does not use the maximum speed when temerature is +# high, this script manually set fan speed to full-speed/ returns ist to +# auto mode. +start() { + echo "Starting Service" + while : + do + CURRENTSPEED=`cat /proc/acpi/ibm/fan | grep level: | awk 'NF>1{print $NF}'` + CURRENTTMP=`cat /proc/acpi/ibm/thermal | grep -o -E '[0-9]+' | sed -n '1p'` + if [ $CURRENTTMP -gt 80 ]; then + echo "level full-speed" > /proc/acpi/ibm/fan + RETURN="$CURRENTSPEED -> disengaged" + elif [ $CURRENTTMP -lt 65 ]; then + echo "level auto" > /proc/acpi/ibm/fan + RETURN="$CURRENTSPEED -> auto" + fi + sleep 5 + done +} + +stop() { + echo "Stopping Service" + killall fancontrol +} + +case "$1" in + start) + start & + ;; + stop) + stop + ;; + status) + ;; + restart|reload|condrestart) + stop + start & + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|status}" + exit 1 +esac +exit 0