diff options
| author | pants <niklasjo2004@gmail.com> | 2026-09-21 14:18:06 -0700 |
|---|---|---|
| committer | pants <niklasjo2004@gmail.com> | 2026-09-21 14:18:06 -0700 |
| commit | 83d5ba42f8a98fc0df177efef4333f74a0481f61 (patch) | |
| tree | 6f1fcff64ec9adb2fc51a7cfcc451eb22a103fb3 /scripts/sockets.py | |
Diffstat (limited to 'scripts/sockets.py')
| -rw-r--r-- | scripts/sockets.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/sockets.py b/scripts/sockets.py new file mode 100644 index 0000000..802d5e6 --- /dev/null +++ b/scripts/sockets.py @@ -0,0 +1,32 @@ +import socket +import time +import os + +cmd1 = """ +{"action":"add","identifier":"preview","max_height":21,"max_width":118,"path":"/tmp/a.png","x":10,"y":15} +""" + +cmd2 = """ +{"action":"add","identifier":"preview","max_height":47,"max_width":118,"path":"/tmp/b.png","x":10,"y":15} +""" + +cmd_exit = """ +{"action":"remove","identifier":"preview"} +""" + +s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) +connected = False +while not connected: + try: + s.connect(f"/tmp/ueberzugpp-30468.socket") + connected = True + except Exception: + time.sleep(0.05) + +s.sendall(str.encode(cmd1 + "\n")) +time.sleep(2) +s.sendall(str.encode(cmd_exit + "\n")) +s.sendall(str.encode(cmd2 + "\n")) +time.sleep(2) +s.sendall(str.encode(cmd_exit + "\n")) +s.close() |
