touchpadctl 904 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. function get_touchpad() {
  3. xinput list | grep "Touchpad" | perl -n -e'/(\w+.*)/ && print "$1\n"'
  4. }
  5. function get_touchpad_id() {
  6. get_touchpad | perl -n -e'/id=(\d+)/ && print "$1\n"'
  7. }
  8. function list_config() {
  9. for i in $(get_touchpad_id)
  10. do
  11. xinput --list-props "$i"
  12. done
  13. }
  14. function set_config() {
  15. for i in $(get_touchpad_id)
  16. do
  17. xinput --set-prop "$i" "libinput Natural Scrolling Enabled" 1
  18. xinput --set-prop "$i" "libinput Click Method Enabled" {1 1}
  19. xinput --set-prop "$i" "libinput Tapping Enabled" 1
  20. done
  21. }
  22. function main() {
  23. case "$1" in
  24. "configs" ) list_configs
  25. ;;
  26. "set" ) set_config
  27. ;;
  28. "list" ) get_touchpad
  29. ;;
  30. * | "help" ) echo -e "$HELP_TEXT"
  31. ;;
  32. esac
  33. }
  34. main "$@"
  35. echo "Done"