current commit
220313.1 · machine: add new 'kodos' laptop for kait
#!/bin/sh

if ! is-laptop; then
  exit 1
fi
case "$(myhostname)" in
  kodos|krusty)
    device="SynPS/2 Synaptics TouchPad"
    prop="libinput Tapping Enabled"
    ;;
  *)
    echo "unrecognize machine: $(myhostname)" >&2
    ;;
esac

current="$(
  xinput list-props "$device" | rg "${prop}[\s()0-9]+:\s+([0-9]+)" -or '$1'
)"
if [ "$current" = "0" ]; then
  xinput set-prop "$device" "$prop" 1

  icon=input-touchpad-symbolic.symbolic
  hint=string:synchronous:taptoclick
  notify-send -h "$hint" -i "$icon" -t 1500 "tap-to-click enabled"
else
  xinput set-prop "$device" "$prop" 0

  icon=touchpad-disabled-symbolic.symbolic
  hint=string:synchronous:taptoclick
  notify-send -h "$hint" -i "$icon" -t 1500 "tap-to-click disabled"
fi