Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # 1 "Button Left"
- # 2 "Button Middle"
- # 3 "Button Right"
- # 4 "Button Wheel Up"
- # 5 "Button Wheel Down"
- # 6 "Button Horiz Wheel Left"
- # 7 "Button Horiz Wheel Right"
- # 8 "Button Side"
- # 9 "Button Extra"
- # The trackball has the following keys by default
- # ░░░░░░░░░░░░░
- # ░╔════╤════╗░
- # ░║░2░░│░░8░║░
- # ░║░░░▄▄▄░░░║░
- # ░╟───███───╢░
- # ░║░░░▀▀▀░░░║░
- # ░║░1░░│░░3░║░
- # ░╚════╧════╝░
- # ░░░░░░░░░░░░░
- mouse_name="Kensington Expert Mouse"
- check=$(xinput | grep "$mouse_name")
- if [[ ! -z "$check" ]]; then
- mouse_id=$(xinput | grep "$mouse_name" | sed "s/^.*id=\([0-9]*\)[ \t].*$/\1/")
- echo "Device $mouse_id found"
- # Trackball button 1 will generate click 8 ("Button Side" interpreted as back)
- # Trackball button 2 will generate click 1 ("Button Left")
- # Trackball button 3 will generate click 9 ("Button Extra" interpreted as forward)
- # Trackball button 8 will generate click 3 ("Button Right")
- xinput set-button-map $mouse_id 8 1 9 4 5 6 7 3 2
- # we might want to enable better scrolling
- # xinput set-prop $mouse_id "libinput Natural Scrolling Enabled" 1
- # disable acceliration for the ball
- # xinput set-prop $mouse_id "libinput Accel Profile Enabled" 0, 1
- # allow scrolling by holding middle mouse button and using the ball to scroll ( really smooth and fast ).
- # xinput set-prop $mouse_id "libinput Scroll Method Enabled" 0, 0, 1
- # allow the remmaped middle mouse to be used for middle mouse scroll
- # xinput set-prop $mouse_id "libinput Button Scrolling Button" 3
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement