import json, subprocess, hashlib from pathlib import Path def ipc(command='', kind=0): import socket,struct p=command.encode() with socket.socket(socket.AF_UNIX) as s: s.settimeout(10);s.connect('/run/shell/sway-ipc.sock') s.sendall(b'i3-ipc'+struct.pack('=II',len(p),kind)+p) def read(n): b=b'' while len(b)