Reviews for Fast Bookmark
Fast Bookmark by rxliuli
1 review
- Rated 5 out of 5by Firefox user 19240815, a day agoSurprisingly good.
import os
import subprocess
import time
# Target click coordinates
folder_x, folder_y = 1821, 65
search_x, search_y = 1661, 169
# Get current cursor position
result = subprocess.run(["xdotool", "getmouselocation", "--shell"], capture_output=True, text=True)
lines = result.stdout.splitlines()
orig_x = int([l for l in lines if l.startswith("X=")][0].split("=")[1])
orig_y = int([l for l in lines if l.startswith("Y=")][0].split("=")[1])
# Click folder
os.system(f"xdotool mousemove --sync {folder_x} {folder_y}")
os.system("xdotool mousedown 1")
time.sleep(0.05) # hold for 1/4 second
os.system("xdotool mouseup 1")
# Wait for popup to process click
time.sleep(0.25) # keep 0.2s to ensure focus
# Click search bar
os.system(f"xdotool mousemove --sync {search_x} {search_y}")
os.system("xdotool mousedown 1")
os.system("xdotool mouseup 1")
# Minimal pause before restoring cursor
time.sleep(0.05)
# Restore original cursor position
os.system(f"xdotool mousemove --sync {orig_x} {orig_y}")
This can be used for AutoKey.