14 lines
865 B
Python
14 lines
865 B
Python
|
#!/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"])
|