Adapt trackpad + trackball script for wayland

This commit is contained in:
Dan Buch 2021-07-07 10:01:11 -04:00
parent 159b0ae613
commit 3299670cf1
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7

View File

@ -3,11 +3,32 @@ set -o errexit
set -o pipefail
main() {
_setup_elan_touchpad
_setup_trackman_marble
local session_id
session_id="$(loginctl --output=json | jq -r '.[]|.session')"
local session_type
session_type="$(
loginctl show-session "${session_id}" -p Type |
awk -F= '{ print $2 }'
)"
"_setup_elan_touchpad_${session_type}"
"_setup_trackman_marble_${session_type}"
}
_setup_elan_touchpad() {
_setup_elan_touchpad_wayland() {
local tp='org.gnome.desktop.peripherals.touchpad'
gsettings set "${tp}" natural-scroll true
gsettings set "${tp}" tap-to-click true
}
_setup_trackman_marble_wayland() {
local tm='org.gnome.desktop.peripherals.trackball'
gsettings set "${tm}" scroll-wheel-emulation-button 8
gsettings set "${tm}" accel-profile default
}
_setup_elan_touchpad_x11() {
local etp='Elan Touchpad'
if ! xinput list-props "${etp}" &>/dev/null; then
@ -17,7 +38,7 @@ _setup_elan_touchpad() {
xinput set-prop "${etp}" 'libinput Natural Scrolling Enabled' 1
}
_setup_trackman_marble() {
_setup_trackman_marble_x11() {
local tmm='Logitech USB Trackball'
if ! xinput list-props "${tmm}" &>/dev/null; then