#!/usr/bin/env -S python3 import sys import struct import subprocess # Read a message from stdin and decode it. rawLength = sys.stdin.buffer.read(4) if len(rawLength) == 0: sys.exit(0) # Read the length of the message messageLength: int = struct.unpack("@I", rawLength)[0] # Decode the message message = sys.stdin.buffer.read(messageLength).decode("utf-8") # Run the background setting with a link to the image _ = subprocess.run(["setbg", "-tw", message.replace('"', "")])