Skip to content

Commit f3347e2

Browse files
committed
Add script that fixes scroll direction of all mouses.
1 parent 26db666 commit f3347e2

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

mouse_scroll

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
# mouse_scroll
3+
# Sets the scroll direction to "natural"
4+
5+
# Copyright (C) 2014-2015 Alexander Swen <alex@swen.nu>
6+
7+
# This program is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation; either version 2 of the License, or
10+
# (at your option) any later version.
11+
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
20+
# Alexander Swen
21+
# Private contact: alex@swen.nu
22+
23+
# CHANGELOG:
24+
# 2019-07-09 A.Swen created.
25+
26+
# SETTINGS
27+
date=$(date +%Y%m%d)
28+
me=$(basename $0)
29+
mydir=$(dirname $0)
30+
31+
# FUNCTIONS
32+
die () {
33+
rc=$1
34+
shift
35+
printf '%s\n' "=====================" >&2
36+
printf '%s\n' "==== FATAL ERROR ====" >&2
37+
printf '%s\n\n' "=====================" >&2
38+
printf '%s\n\n' "$@" >&2
39+
exit $rc
40+
}
41+
42+
usage () {
43+
printf '%s\n' "===============" >&2
44+
printf '%s\n' "==== USAGE ====" >&2
45+
printf '%s\n\n' "===============" >&2
46+
printf '%s\n' "Usage: ${me} " >&2
47+
printf '%s\n\n' "example: ${me} " >&2
48+
exit 1
49+
}
50+
get_options () {
51+
while [[ $# -gt 0 ]]; do
52+
case "$1" in
53+
--thing1|-a)
54+
shift
55+
declare -r thing="$1"
56+
shift
57+
;;
58+
--thing2|-b)
59+
shift
60+
declare -r other_thing="$1"
61+
shift
62+
;;
63+
-h|--help)
64+
usage
65+
;;
66+
*)
67+
usage
68+
;;
69+
esac
70+
done
71+
}
72+
73+
duration () {
74+
local before=$1
75+
local after="$(date +%s)"
76+
local elapsed="$(expr $after - $before)"
77+
local hours=$(($elapsed / 3600))
78+
local elapsed=$(($elapsed - $hours * 3600))
79+
local minutes=$(($elapsed / 60))
80+
local seconds=$(($elapsed - $minutes * 60))
81+
time_running="${hours}:${minutes}:${seconds}"
82+
}
83+
84+
log () { printf '%s %s\n' "$(date +%F' '%T)" "$@"; }
85+
86+
# SCRIPT
87+
xinput list|grep Mouse|while read device;do
88+
eval $(echo $device|grep -Eo 'id=[0-9]{2}')
89+
xinput set-int-prop $id 300 8 1
90+
done
91+
92+
# END

0 commit comments

Comments
 (0)