lots of stuff lumped together
[distro-setup] / input-setup
1 #!/bin/bash -l
2 # Copyright (C) 2016 Ian Kelling
3
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7
8 # http://www.apache.org/licenses/LICENSE-2.0
9
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 case $HOSTNAME in
17 x2|tp) type=laptop ;;
18 treetowl*|iank-dev|frodo) type=kinesis ;;
19 esac
20
21
22
23 case $1 in
24 l) type=laptop ;;
25 k) type=kinesis ;;
26 esac
27
28 #set -x
29 mi() {
30 xinput --get-feedbacks "$1" | grep "threshold"
31 xinput --get-feedbacks "$1" | grep "accelNum\|accelDenom"
32 xinput --list-props "$1" | grep "Device Accel Profile\|Device Accel Constant Deceleration\|Device Accel Velocity Scaling"
33 }
34 ms() {
35 xinput --set-ptr-feedback "$1" $2 ${3%/*} ${3#*/}
36 xinput --set-prop "$1" 'Device Accel Profile' $4
37 xinput --set-prop "$1" 'Device Accel Constant Deceleration' $5
38 xinput --set-prop "$1" 'Device Accel Velocity Scaling' $6
39 mi "$1"
40 }
41 set_device_id() {
42 if device_id=$(xinput --list | grep -m 1 "$1"); then
43 device_id=${device_id##*id=}
44 device_id=${device_id%%[[:space:]]*}
45 else
46 return 1
47 fi
48 }
49
50 case $type in
51 laptop)
52 # original saved with: xkbcomp $DISPLAY /a/c/stretch-11-2016.xkb
53 xkbcomp /a/c/x2.xkb $DISPLAY
54 xkbset -m # remove mouse keys
55
56 ;;
57 kinesis)
58 # todo, differentiate for work pc
59 #/a/bin/radl
60 if [[ -z $DISPLAY ]]; then
61 echo "error. empty DISPLAY var" >> /a/gdm-keyboard-error.log
62 else
63 xkbcomp /a/c/.Xkeymap $DISPLAY
64
65 xkbset m # setup mouse keys, which I have altered
66
67 xkbset exp =m # stop mousekeys expiring after a timeout
68
69 xset r rate 200 13 # decrease rate delay
70 cd / # so xbindkeys does not hold open mountpoints
71 xbindkeys # configured to grab left and right scroll button presses
72 fi
73
74
75 #right scroll wheel, change from button 4 & 5 to 13 and 14.
76 # also changes the middle click to 12, even though I'm not using it anymore
77 if set_device_id "04d9:048e"; then
78 xinput --set-button-map "$device_id" 1 12 3 13 14 6 7
79 fi
80
81 ms 'Kensington Kensington Slimblade Trackball' 100 4000/1 7 6.5 1.5
82 xinput --set-button-map 'Kensington Kensington Slimblade Trackball' 0 0 0 4 5 6 7 0 9 10 11 12
83
84 # razer naga middle mouse stopped working. it's settings were:
85 #ms "$device_id" 100 1000/1 7 4 1
86
87 if set_device_id "SteelSeries World of Warcraft MMO Gaming Mouse"; then
88 ms "$device_id" 100 1000/1 7 4 1
89 #ms "$device_id" 1 7/2 2 2.5 2
90
91 # makes it compatible with what windows sends using synergy
92 xinput --set-button-map "$device_id" 1 2 3 4 5 6 7 6 7 10 11 12 13 14 15
93
94 # under the new "improved" libinput, the mouse speed/accel has
95 # changed all around and is much more limited.
96 # Other xinput commands will fail and this will succeed.
97 xinput --set-prop "$device_id" "libinput Accel Speed" '.8'
98 fi
99
100
101 # disable the mouse movements of my mouse-wheel only mouse
102 if set_device_id "USB Optical Mouse"; then
103 xinput --set-prop "$device_id" 'Device Accel Constant Deceleration' 10000
104 # 12 is to effectively disable the middle click button
105 xinput --set-button-map "$device_id" 1 12 3 10 11 6 7
106 fi
107 . /a/bin/bash_unpublished/duplicity-gpg-agent-setup
108 ;;
109 esac
110
111 # for desktop and htpc
112 set_device_id "Logitech Unifying Device"
113 xinput --set-prop "$device_id" 'Evdev Middle Button Emulation' 1
114
115
116 #ms 'Kensington Kensington Slimblade Trackball' 1 7/2 2 4 5 = 2.01
117 # ms 9 10 20/1 6 4 .2
118 #ms 9 10 35/1 6 5 .2 = 1.82
119 #ms 9 10 1200/1 7 5 .2 = 1.82 after a practice round
120 #
121 #ms 9 10 140/1 6 7 .1 = 2.0 after a practice round.
122 #feels like the slow is finally too slow, and fast too fast
123 # ms 9 10 50/1 6 6 .2 = 1.83 after
124 # ms 9 10 90/1 6 6 .1 = 1.86
125 #ms 9 10 3000/1 7 6 .1 = 1.81
126 #ms 9 1 15/1 3 6 3 = 2.0
127 #ms 9 1 10/1 3 4 2 = 1.91
128 #ms 9 1 8/1 3 5 4 = 1.98
129 #ms 9 1 10/2 2 5 2.5 = 1.99
130 #ms 9 100 3000/1 7 5 1 = 1.86
131 #ms 9 100 1500/1 7 5 1.5 = 1.87
132 #ms 9 100 2200/1 7 6 1.5 = 1.81
133 #ms 9 100 2200/1 7 5 1.5 = 1.83
134 #ms 9 100 3000/1 7 6 1.5 = 1.88
135 #ms 9 1 100/1 4 6 15 = 1.85
136 #ms 9 100 3000/1 7 7 1.5 = 1.85, but had a 1.76 on first try...
137 # ms 9 100 3500/1 7 7 1.5 = 1.73, 1.68 a1 1.74, 1.83, 1.75, 1.78, 1.76
138 # ms 9 100 4000/1 7 7 1.5 = 1.80
139 # ms 9 100 4000/1 7 8 1.5 = 1.78
140 # ms 9 100 4000/1 7 8 1.8 = 1.88
141 # ms 9 100 4800/1 7 8 1.5 = 1.85
142 # ms 9 100 4000/1 7 6.5 1.5 = 1.83. stickig with this, upped speeds a bit to make it more practical for normal windows
143 # new day
144 # ms 9 100 3500/1 7 7 1.5 = 1.92
145 # ms 9 1 7/2 2 5 5 = 1.9
146 # ms 9 100 3500/1 7 7 1.5 = 1.62
147 # felt like having it a bit faster for a while, but switched back
148 #ms 'Kensington Kensington Slimblade Trackball' 100 3500/1 7 5 1.5
149
150
151 #set +x