31 lines
817 B
Bash
Executable File
31 lines
817 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -o errexit
|
|
|
|
main() {
|
|
export RUNNING_AS="${RUNNING_AS:-me}"
|
|
export RUNNING_AS_ID="$(id -u "${RUNNING_AS}")"
|
|
|
|
export XAUTHORITY="/home/${RUNNING_AS}/.Xauthority"
|
|
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${RUNNING_AS_ID}/bus"
|
|
export DISPLAY=:0
|
|
export HOME="/home/${RUNNING_AS}"
|
|
|
|
local device_id
|
|
device_id="$(__get_device_id)"
|
|
|
|
# libinput Natural Scrolling Enabled (282)
|
|
/usr/bin/sudo -E -u "${RUNNING_AS}" \
|
|
/usr/sbin/xinput set-prop "${device_id}" 282 1
|
|
|
|
# libinput Scroll Method Enabled (285)
|
|
/usr/bin/sudo -E -u "${RUNNING_AS}" \
|
|
/usr/sbin/xinput set-prop "${device_id}" 285 0 0 1
|
|
}
|
|
|
|
__get_device_id() {
|
|
/usr/bin/sudo -E -u "${RUNNING_AS}" /usr/sbin/xinput list |
|
|
awk '/Logitech USB Trackball/ { sub(/id=/, "", $6); print $6 }'
|
|
}
|
|
|
|
main "${@}"
|