From f128c10012f8b564974f91ea1d6d68f6c292be5e Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Fri, 11 Mar 2022 09:29:01 +0100 Subject: [PATCH] i3-companion: document polybar wire-format --- bin/i3-companion | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/i3-companion b/bin/i3-companion index b4232da..b62d6a2 100755 --- a/bin/i3-companion +++ b/bin/i3-companion @@ -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)