[sway] Improve toggle_touchpad

To take into account disabled_on_external_mouse
This commit is contained in:
Midgard 2022-09-07 22:40:37 +02:00
parent 3ddd8ecbb3
commit 7725111195
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -1,3 +1,14 @@
#!/bin/sh
swaymsg 'input type:touchpad events toggle enabled disabled'
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