first commit
This commit is contained in:
commit
3381caae95
3 changed files with 212 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
input-setup
|
5
README.md
Normal file
5
README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# ThinkPad Trackpoint Configuration Script (Linux)
|
||||||
|
|
||||||
|
This script configures ThinkPad Trackpoint devices on several different models of ThinkPad keyboards running under Linux.
|
||||||
|
|
||||||
|
I created it for my own convenience in order to automatically set some preferences including disabling middle-click scrolling and increasing Trackpoint sensitivity.
|
206
tp-input-setup
Executable file
206
tp-input-setup
Executable file
|
@ -0,0 +1,206 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# See 'man 4 libinput' or 'man 4 syntaptics'
|
||||||
|
|
||||||
|
get_dev_id () {
|
||||||
|
DISPLAY=:0 xinput list --id-only "$1" 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
set_natural_scrolling () {
|
||||||
|
#
|
||||||
|
# 1 boolean value, 1 enables natural scrolling
|
||||||
|
#
|
||||||
|
|
||||||
|
# Get libinput "Natural Scrolling Enabled" ID
|
||||||
|
local id=$(DISPLAY=:0 xinput list-props $1 | \
|
||||||
|
grep -Po 'Natural Scrolling Enabled \(\K[0-9]+')
|
||||||
|
|
||||||
|
# enable natural scrolling
|
||||||
|
DISPLAY=:0 xinput set-prop $1 $id $2
|
||||||
|
}
|
||||||
|
|
||||||
|
set_scroll_method () {
|
||||||
|
#
|
||||||
|
# 3 boolean in order "two-finger", "edge", "button"
|
||||||
|
#
|
||||||
|
|
||||||
|
# Get libinput "Scroll Method Enable" ID
|
||||||
|
local id=$(DISPLAY=:0 xinput list-props $1 | \
|
||||||
|
grep -Po 'Scroll Method Enabled \(\K[0-9]+')
|
||||||
|
|
||||||
|
# enable button scroll method
|
||||||
|
DISPLAY=:0 xinput set-prop $1 $id $2 $3 $4
|
||||||
|
}
|
||||||
|
|
||||||
|
set_accel_speed () {
|
||||||
|
#
|
||||||
|
# 32-bit float in range -1, 1
|
||||||
|
#
|
||||||
|
|
||||||
|
# Get libinput "Accel Speed" ID
|
||||||
|
local id=$(DISPLAY=:0 xinput list-props $1 | grep -Po 'Accel Speed \(\K[0-9]+')
|
||||||
|
|
||||||
|
# set accel speed
|
||||||
|
DISPLAY=:0 xinput set-prop $1 $id $2
|
||||||
|
}
|
||||||
|
|
||||||
|
set_accel_profile () {
|
||||||
|
#
|
||||||
|
# 2 boolean values in order "adaptive", "flat"
|
||||||
|
#
|
||||||
|
|
||||||
|
# Get libinput "Accel Profile Enabled" ID
|
||||||
|
local prop_id=$(DISPLAY=:0 xinput list-props $1 | \
|
||||||
|
grep -Po 'Accel Profile Enabled \(\K[0-9]+')
|
||||||
|
|
||||||
|
DISPLAY=:0 xinput set-prop $1 $prop_id $2 $3
|
||||||
|
}
|
||||||
|
|
||||||
|
disable_touchpad () {
|
||||||
|
#
|
||||||
|
# 1 boolean value, enabled=1
|
||||||
|
#
|
||||||
|
|
||||||
|
local prop_id=$(DISPLAY=:0 xinput list-props $syntchid | grep -Po 'Device Enabled \(\K[0-9]+')
|
||||||
|
|
||||||
|
DISPLAY=:0 xinput set-prop $prop_id 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### DEVICES ###
|
||||||
|
|
||||||
|
# ThinkPad P72 (libinput driver)
|
||||||
|
trackpoint_string="Elan TrackPoint"
|
||||||
|
touchpad_string="Elan Touchpad"
|
||||||
|
name="ThinkPad P72 (libinput)"
|
||||||
|
|
||||||
|
if trackpoint_id=$(get_dev_id "$trackpoint_string"); then
|
||||||
|
echo "Applying settings for $name"
|
||||||
|
set_natural_scrolling $trackpoint_id 1
|
||||||
|
set_scroll_method $trackpoint_id 0 0 1 # enable button
|
||||||
|
set_accel_speed $trackpoint_id -0.2
|
||||||
|
set_accel_profile $trackpoint_id 1 0 # 0 1 flat | 1 0 adaptive
|
||||||
|
|
||||||
|
# this no longer works. 'sensitivity' doesn't exist
|
||||||
|
# if syntpdev="$(find /sys/devices -type f -name 'sensitivity' | grep 'serio')"; then
|
||||||
|
# echo -n 200 | sudo tee $syntpdev >/dev/null
|
||||||
|
# fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# ThinkPad P72 (for synaptics driver?)
|
||||||
|
trackpoint_string="ETPS/2 Elantech TrackPoint"
|
||||||
|
touchpad_string="Elan Touchpad"
|
||||||
|
name="ThinkPad P72 (synaptics)"
|
||||||
|
|
||||||
|
if trackpoint_id=$(get_dev_id "$trackpoint_string"); then
|
||||||
|
echo "Applying settings for $name"
|
||||||
|
set_natural_scrolling $trackpoint_id 1
|
||||||
|
set_scroll_method $trackpoint_id 0 0 1 # enable button
|
||||||
|
set_accel_speed $trackpoint_id 1.00
|
||||||
|
set_accel_profile $trackpoint_id 1 0 # adaptive
|
||||||
|
|
||||||
|
if syntpdev="$(find /sys/devices -type f -name 'sensitivity' | grep 'serio')"; then
|
||||||
|
echo -n 190 | sudo tee $syntpdev >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if touchpad_id=$(get_dev_id "$touchpad_string"); then
|
||||||
|
echo "Disabling touchpad for $name"
|
||||||
|
disable_touchpad $touchpad_id
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ThinkPad T580
|
||||||
|
trackpoint_string="TPPS/2 IBM TrackPoint"
|
||||||
|
touchpad_string="SynPS/2 Synaptics TouchPad"
|
||||||
|
name="ThinkPad T580"
|
||||||
|
|
||||||
|
if trackpoint_id=$(get_dev_id "$trackpoint_string"); then
|
||||||
|
echo "Applying settings for $name"
|
||||||
|
set_natural_scrolling $trackpoint_id 1
|
||||||
|
set_scroll_method $trackpoint_id 0 0 1 # enable button
|
||||||
|
set_accel_speed $trackpoint_id -0.20
|
||||||
|
set_accel_profile $trackpoint_id 1 0 # adaptive
|
||||||
|
|
||||||
|
if syntpdev="$(find /sys/devices -type f -name 'sensitivity' | grep 'serio')"; then
|
||||||
|
echo -n 215 | sudo tee $syntpdev >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if touchpad_id=$(get_dev_id "$touchpad_string"); then
|
||||||
|
echo "Disabling touchpad for $name"
|
||||||
|
disable_touchpad $touchpad_id
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# ThinkPad T550
|
||||||
|
trackpoint_string="pointer:TPPS/2 IBM TrackPoint"
|
||||||
|
touchpad_string="pointer:Synaptics TM3053-003"
|
||||||
|
name="ThinkPad T550"
|
||||||
|
|
||||||
|
if trackpoint_id=$(get_dev_id "$trackpoint_string"); then
|
||||||
|
echo "Applying settings for $name"
|
||||||
|
set_natural_scrolling $trackpoint_id 1
|
||||||
|
set_scroll_method $trackpoint_id 0 0 1 # enable button
|
||||||
|
set_accel_speed $trackpoint_id -0.20
|
||||||
|
set_accel_profile $trackpoint_id 1 0 # adaptive
|
||||||
|
|
||||||
|
if syntpdev="$(find /sys/devices -type f -name 'sensitivity' | grep 'serio')"; then
|
||||||
|
echo -n 215 | sudo tee $syntpdev >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if touchpad_id=$(get_dev_id "$touchpad_string"); then
|
||||||
|
echo "Disabling touchpad for $name"
|
||||||
|
disable_touchpad $touchpad_id
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Lenovo TrackPoint Keyboard II
|
||||||
|
name="pointer:Lenovo TrackPoint Keyboard II"
|
||||||
|
|
||||||
|
if trackpoint_id=$(get_dev_id "$name"); then
|
||||||
|
echo "Applying settings for $name"
|
||||||
|
set_natural_scrolling $trackpoint_id 1
|
||||||
|
set_scroll_method $trackpoint_id 0 0 1 # enable button
|
||||||
|
set_accel_speed $trackpoint_id 0.2
|
||||||
|
set_accel_profile $trackpoint_id 0 1 # 0 1 flat | 1 0 adaptive
|
||||||
|
|
||||||
|
sudo tp2ctl -s 8
|
||||||
|
# if tpcpusbdev="$(find /sys/devices -type f -name 'sensitivity' | grep 'usb1')"; then
|
||||||
|
# echo -n "9" |sudo tee $tpcpusbdev >/dev/null
|
||||||
|
# fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Lenovo ThinkPad Compact USB Keyboard
|
||||||
|
name="ThinkPad Compact USB Keyboard"
|
||||||
|
|
||||||
|
if trackpoint_id=$(get_dev_id "$name"); then
|
||||||
|
echo "Applying settings for $name"
|
||||||
|
set_natural_scrolling $trackpoint_id 1
|
||||||
|
set_scroll_method $trackpoint_id 0 0 1 # enable button
|
||||||
|
set_accel_speed $trackpoint_id -0.18
|
||||||
|
set_accel_profile $trackpoint_id 1 0 # adaptive
|
||||||
|
|
||||||
|
if tpcpusbdev="$(find /sys/devices -type f -name 'sensitivity' | grep 'usb1')"; then
|
||||||
|
echo -n "9" |sudo tee $tpcpusbdev >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ThinkPad Compact Bluetooth Keyboard
|
||||||
|
name="ThinkPad Compact Bluetooth Keyboard"
|
||||||
|
|
||||||
|
if trackpoint_id=$(get_dev_id "$name"); then
|
||||||
|
echo "Applying settings for $name"
|
||||||
|
set_natural_scrolling $trackpoint_id 1
|
||||||
|
set_scroll_method $trackpoint_id 0 0 1 # enable button
|
||||||
|
set_accel_speed $trackpoint_id -0.100
|
||||||
|
set_accel_profile $trackpoint_id 1 0 # adaptive
|
||||||
|
|
||||||
|
if tpcpbtdev="$(! find /sys/devices -type f -name 'sensitivity' | grep 'bluetooth')"; then
|
||||||
|
echo -n "7" |sudo tee "$tpcpbtdev" >/dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue