#!/bin/sh

device=$(swaymsg -t get_inputs --raw | jq '.[] | select(.type == "touchpad") | .identifier' | tr -d '"')
status=$(swaymsg -t get_inputs --raw | jq '.[] | select(.type == "touchpad") | .libinput.send_events' | tr -d '"')

if [ "${status}" = "disabled" ]; then
    swaymsg input "${device}" events enabled
    notify-send -a 'Touchpad' 'Touchpad enabled' -i "$HOME/.config/{{ notification }}/trackpad.png"
else
    swaymsg input "${device}" events disabled
    notify-send -a 'Touchpad' 'Touchpad disabled' -i "$HOME/.config/{{ notification }}/notrackpad.png"
fi
