Created
July 20, 2022 10:12
-
-
Save txtyash/03d01c51c6f892b80e4f018648e0f4e9 to your computer and use it in GitHub Desktop.
Bash script to toggle touchpad/trackpad in xorg/X11
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 | |
# Toggle touchpad status | |
# Using libinput and xinput | |
# Use xinput list and do a search for touchpads. Then get the first one and get its name. | |
device="$(xinput list | grep -P '(?<= )[\w\s:]*(?i)(touchpad|synaptics)(?-i).*?(?=\s*id)' -o | head -n1)" | |
# If it was activated disable it and if it wasn't disable it | |
[[ "$(xinput list-props "$device" | grep -P ".*Device Enabled.*\K.(?=$)" -o)" == "1" ]] && | |
xinput disable "$device" || | |
xinput enable "$device" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment