#!/usr/bin/env bash

TPAD_ID=$(xinput | awk '/Touchpad/ {print $6}' | awk -F = '{print $2}')
is_enabled=$(xinput list-props $TPAD_ID | awk '/Device Enabled/ {print $4}')

if [[ $is_enabled == 0 ]]; then
    xinput enable "$TPAD_ID"
    status="Enabled"
else
    xinput disable "$TPAD_ID"
    status="Disabled"
fi

notify-send "Touchpad" "$status" -i "touchpad"
