i3-companion: document polybar wire-format

This commit is contained in:
Vincent Bernat 2022-03-11 09:29:01 +01:00
parent 9cc40b8755
commit f128c10012

View file

@ -265,7 +265,11 @@ def polybar(module):
# Send it to polybar
cmd = bytes(f"#{module}.send.{content}", "utf-8")
data = b"polyipc" + struct.pack("=BIB", 0, len(cmd), 2) + cmd
data = (
b"polyipc" # magic
+ struct.pack("=BIB", 0, len(cmd), 2) # header: version, length, type
+ cmd
)
for name in glob.glob(f"{os.getenv('XDG_RUNTIME_DIR')}/polybar/*.sock"):
try:
reader, writer = await asyncio.open_unix_connection(name)