#!/bin/bash -l
+set -x
# Copyright (C) 2016 Ian Kelling
# Licensed under the Apache License, Version 2.0 (the "License");
# See the License for the specific language governing permissions and
# limitations under the License.
+# set to oppsite if the order is flipped.
+k2flip=falsesf-
+if $k2flip; then
+k2inorder=false
+else
+ k2inorder=true
+ fi
+
case $HOSTNAME in
x2|tp) type=laptop ;;
treetowl*|iank-dev|frodo) type=kinesis ;;
mi "$1"
}
set_device_id() {
- if device_id=$(xinput --list | grep -m 1 "$1"); then
+ if [[ $2 ]] && $2; then
+ cmd="tail -n1"
+ else
+ cmd="head -n1"
+ fi
+ if device_id=$(xinput --list | grep "$1" | $cmd); then
device_id=${device_id##*id=}
device_id=${device_id%%[[:space:]]*}
+ echo "2:$2 device_id=$device_id"
else
return 1
fi
xset r rate 200 13 # decrease rate delay
cd / # so xbindkeys does not hold open mountpoints
+ killall xbindkeys # having some lag, thinking this might help.
xbindkeys # configured to grab left and right scroll button presses
fi
-
+ kinesis2=false
#right scroll wheel, change from button 4 & 5 to 13 and 14.
# also changes the middle click to 12, even though I'm not using it anymore
if set_device_id "04d9:048e"; then
xinput --set-button-map "$device_id" 1 12 3 13 14 6 7
+ else
+ kinesis2=true # if we are using the 2nd kinesis which has different device ids
fi
+ if $kinesis2 && set_device_id "USB OPTICAL MOUSE" $k2flip; then
+ xinput --set-button-map "$device_id" 1 12 3 14 13 6 7
+ fi
+
+
ms 'Kensington Kensington Slimblade Trackball' 100 4000/1 7 6.5 1.5
xinput --set-button-map 'Kensington Kensington Slimblade Trackball' 0 0 0 4 5 6 7 0 9 10 11 12
fi
- # disable the mouse movements of my mouse-wheel only mouse
- if set_device_id "USB Optical Mouse"; then
- xinput --set-prop "$device_id" 'Device Accel Constant Deceleration' 10000
- # 12 is to effectively disable the middle click button
- xinput --set-button-map "$device_id" 1 12 3 10 11 6 7
+ # disable the mouse movements mouse wheel
+ if $kinesis2; then
+ if set_device_id "USB OPTICAL MOUSE" $k2inorder; then
+ xinput --set-prop "$device_id" 'Device Accel Constant Deceleration' 10000
+ # 12 is to effectively disable the middle click button
+ xinput --set-button-map "$device_id" 1 12 3 11 10 6 7
+ fi
+ else
+ if set_device_id "USB Optical Mouse"; then
+ xinput --set-prop "$device_id" 'Device Accel Constant Deceleration' 10000
+ # 12 is to effectively disable the middle click button
+ xinput --set-button-map "$device_id" 1 12 3 10 11 6 7
+ fi
fi
+
. /a/bin/bash_unpublished/duplicity-gpg-agent-setup
;;
esac