import os,fcntl,struct,time,socket,json,subprocess from pathlib import Path def ipc(command): 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),0)+b) def read(n): b=b'' while len(b)