git.lucas.co / cce-designer
graphic design tool
git clone https://git.lucas.co/cce-designer.git

scratch/test_selection.py (1.1K)

 1 import subprocess
 2 import time
 3 
 4 def run_clearctl(cmd_str):
 5     full_cmd = f"env WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/run/user/1000 /home/lsgalante/.local/bin/clearctl {cmd_str}"
 6     res = subprocess.run(full_cmd, shell=True, capture_output=True, text=True)
 7     return res.stdout.strip()
 8 
 9 def click_at(x, y):
10     print(f"Moving to {x}, {y}...")
11     run_clearctl(f"pointer-move-to {x} {y}")
12     time.sleep(0.2)
13     print(f"Clicking at {x}, {y}...")
14     run_clearctl("pointer-click left")
15     time.sleep(0.3)
16 
17 # Focus the design interface window
18 run_clearctl("focus-window cce-design-interface")
19 time.sleep(0.5)
20 
21 # Click on Box 1 (x=238, y=389)
22 click_at(238, 389)
23 subprocess.run("env WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/run/user/1000 grim /home/lsgalante/.gemini/antigravity/brain/ab8b2bd9-c7ba-4730-96bb-8766ee711f3a/screenshot_click_box.png", shell=True)
24 
25 # Click on Scatter 1 (x=238, y=469)
26 click_at(238, 469)
27 subprocess.run("env WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/run/user/1000 grim /home/lsgalante/.gemini/antigravity/brain/ab8b2bd9-c7ba-4730-96bb-8766ee711f3a/screenshot_click_scatter.png", shell=True)
28 
29 print("Done.")