From 772511119509989960f05a29c66c750e5c2b3971 Mon Sep 17 00:00:00 2001 From: Midgard <2885-Midgard@users.noreply.framagit.org> Date: Wed, 7 Sep 2022 22:40:37 +0200 Subject: [PATCH] [sway] Improve toggle_touchpad To take into account disabled_on_external_mouse --- sway/toggle_touchpad | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sway/toggle_touchpad b/sway/toggle_touchpad index 6c1f86a..17ab6a6 100755 --- a/sway/toggle_touchpad +++ b/sway/toggle_touchpad @@ -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