Files
screen-leads-app/agent/platform/__init__.py
T
bhushanct c1eef4c6aa Initial commit: Screen Leads app
Screen-capture lead tool: capture agent, Claude vision extractor with
pluggable site recipes (LinkedIn), canonical funnel model, SQLite storage,
FastAPI backend, dashboard, and setup/run scripts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 07:43:33 +05:30

31 lines
1.0 KiB
Python

"""Cross-platform helper for reading the front browser tab's URL.
This is the one genuinely OS-specific piece. Reading *your own* browser's
current URL is a passive, local operation (no request to the target site), so
it stays within the screen-capture / compliance posture. When it can't return
a URL (common on Windows/Linux), the detector falls back to reading the address
bar visually from a screenshot via the AI.
"""
import sys
from typing import Optional
def get_active_tab_url() -> Optional[str]:
"""Best-effort URL of the frontmost browser tab, or None if unavailable."""
try:
if sys.platform == "darwin":
from . import macos
return macos.get_active_tab_url()
if sys.platform.startswith("linux"):
from . import linux
return linux.get_active_tab_url()
if sys.platform in ("win32", "cygwin"):
from . import windows
return windows.get_active_tab_url()
except Exception:
return None
return None