From 2f21c97a421cb91d4c19ad5f2d7eb2f9cd49fe52 Mon Sep 17 00:00:00 2001 From: dalahast Date: Tue, 26 May 2020 18:29:25 +0200 Subject: [PATCH] add script to toggle touchpad in wayland --- .local/bin/toggle_touchpad.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 .local/bin/toggle_touchpad.py diff --git a/.local/bin/toggle_touchpad.py b/.local/bin/toggle_touchpad.py new file mode 100755 index 0000000..b038cb3 --- /dev/null +++ b/.local/bin/toggle_touchpad.py @@ -0,0 +1,13 @@ +#!/usr/bin/python + +import json,sys,subprocess + +msg = json.loads(subprocess.run(["swaymsg", "-t", "get_inputs"], stdout=subprocess.PIPE).stdout.decode('utf-8')) +for i in range(len(msg)): + if msg[i]["type"] == "touchpad": + if msg[i]["libinput"]["send_events"] == "disabled": + subprocess.run(["swaymsg", "input", msg[i]["identifier"], "events", "enabled"]) + subprocess.run(["notify-send", "-a", "Touchpad", "Touchpad Enabled", "-i", "/usr/share/icons/Papirus-Dark/64x64/devices/input-touchpad.svg", "-t", "1500"]) + if msg[i]["libinput"]["send_events"] == "enabled": + subprocess.run(["swaymsg", "input", msg[i]["identifier"], "events", "disabled"]) + subprocess.run(["notify-send", "-a", "Touchpad", "Touchpad Disabled", "-i", "/usr/share/icons/Papirus-Dark/64x64/devices/input-touchpad.svg", "-t", "1500"])