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

scratch/test_flow.py (1.2K)

 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 # Reset cursor & close any menus
18 run_clearctl("key-press Escape")
19 time.sleep(0.05)
20 run_clearctl("key-release Escape")
21 time.sleep(0.2)
22 
23 # Focus the window
24 click_at(1100, 150)
25 
26 # Move to View menu and click
27 # View menu is around local x=230 (global 984+230 = 1214), local y=39 (global 48+39 = 87)
28 click_at(1214, 87)
29 
30 # Move to "Circular Pane" dropdown and click
31 # Dropdown is at x=207 to 344. Let's use local x=270 (global 984+270 = 1254).
32 # Y center is local y=107 (global 48+107 = 155).
33 click_at(1254, 155)
34 
35 print("Taking screenshot...")
36 subprocess.run("env WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/run/user/1000 grim /home/lsgalante/.gemini/antigravity/brain/9048aec8-21a4-458f-94d4-efe127095c7f/screenshot_test.png", shell=True)
37 print("Done.")