24 lines
545 B
Bash
Executable file
24 lines
545 B
Bash
Executable file
#!/bin/sh
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
current_state() {
|
|
swaymsg -t get_inputs | jq -r 'map(select(.type == "touchpad")) | .[0].libinput.send_events'
|
|
}
|
|
set_state() {
|
|
swaymsg "input type:touchpad events $@"
|
|
}
|
|
|
|
if [ "$(current_state)" == disabled_on_external_mouse ]; then
|
|
set_state disabled
|
|
else
|
|
set_state toggle enabled disabled
|
|
fi
|
|
|
|
state=$(current_state)
|
|
case $state in
|
|
enabled) image=icons/touchpad_enabled.png; ;;
|
|
disabled) image=icons/touchpad_disabled.png; ;;
|
|
*) image=""; ;;
|
|
esac
|
|
wl-overlay --time=1000 "$image" "Touchpad $state"
|