Created
March 8, 2024 10:16
-
-
Save haarp/07ed9e7abc299b08a32a2f9c0310ae96 to your computer and use it in GitHub Desktop.
toggle-touchpad
This file contains hidden or 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/bash | |
# Toggle libinput touchpad state with each execution | |
touchpad=$(xinput list --name-only | grep -i touchpad) | |
props=$(xinput list-props "$touchpad") | |
enabled=$(awk '/Device Enabled \(...\)/{print $4}' <<< "$props") | |
tapping=$(awk '/libinput Tapping Enabled \(...\)/{print $5}' <<< "$props") | |
if [[ $enabled -eq 1 ]]; then | |
if [[ $tapping -eq 1 ]]; then | |
notify-send -i input-touchpad "$touchpad" "** tapping/scrolling OFF **" | |
xinput set-prop "$touchpad" "libinput Tapping Enabled" 0 | |
xinput set-prop "$touchpad" "libinput Scroll Method Enabled" 0 0 0 | |
else | |
notify-send -i input-touchpad "$touchpad" "** OFF **" | |
xinput set-prop "$touchpad" "Device Enabled" 0 | |
fi | |
else | |
notify-send -i input-touchpad "$touchpad" " ** ON **" | |
xinput set-prop "$touchpad" "Device Enabled" 1 | |
xinput set-prop "$touchpad" "libinput Tapping Enabled" 1 | |
xinput set-prop "$touchpad" "libinput Scroll Method Enabled" 1 0 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment