Last active
June 3, 2023 23:30
-
-
Save jkoelker/7d1bfad5d6adc78e03ed7bf6a42fbf1e to your computer and use it in GitHub Desktop.
Enable or Disable the Touchpad while typing via libinput `xinput` (aka. libinput "gaming" mode)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# libinput by default will disable the touchpad while a key is pressed. | |
# to disable this, run `xinput` to list the inputs. find the name of your | |
# touchpad (mine is 'Microsoft Surface Keyboard Touchpad'). | |
# | |
# Disable the setting 'Disable While Typing Enabled' | |
# `xinput --set-prop 'Microsoft Surface Keyboard Touchpad' \ | |
# 'libinput Disable While Typing Enabled' 0` | |
# | |
# Enable the setting 'Disable While Typing Enabled' | |
# `xinput --set-prop 'Microsoft Surface Keyboard Touchpad' \ | |
# 'libinput Disable While Typing Enabled' 1` | |
# | |
# If you save this script as `gaming`, then you can enable | |
# "gaming" mode (touchpad will be enabled while typing) by calling | |
# `gaming enable` or `gaming e`. To disable gaming mode call | |
# `gaming disable` or `gaming d`. | |
# | |
# Its a bit confusing because of the triple negative condition ;) | |
TOUCHPAD="Microsoft Surface Keyboard Touchpad" | |
SETTING="libinput Disable While Typing Enabled" | |
enable() { | |
xinput --set-prop "${TOUCHPAD}" "${SETTING}" 1 | |
echo "Touchpad disabled while typing" | |
} | |
disable() { | |
xinput --set-prop "${TOUCHPAD}" "${SETTING}" 0 | |
echo "Touchpad enabled while typing" | |
} | |
case "$1" in | |
enable|e) | |
disable | |
;; | |
disable|d) | |
enable | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!