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