feat(url): optional browser field (yandex/chrome/firefox/edge)

Adds optional 'browser' field to url-action; runtime resolves it via
config.BROWSER_PATHS (subprocess.Popen with the chosen exe). When
omitted, falls back to webbrowser.open (system default). Constructor
GUI gains a browser dropdown on URL action and on multi-step URL.
Existing open_browser/youtube/google updated to use yandex by default
since user prefers Yandex Browser.
This commit is contained in:
Bossiara13 2026-04-27 20:06:26 +03:00
parent d22a35c9c7
commit a4171ec6b1
5 changed files with 65 additions and 12 deletions

View file

@ -65,13 +65,20 @@ class ShellAction:
return out
KNOWN_BROWSERS = ("yandex", "chrome", "firefox", "edge")
@dataclass
class UrlAction:
href: str
browser: Optional[str] = None
type: str = "url"
def to_dict(self) -> dict:
return {"type": "url", "href": self.href}
out: dict = {"type": "url", "href": self.href}
if self.browser:
out["browser"] = self.browser
return out
@dataclass
@ -157,7 +164,10 @@ def action_from_dict(data: Any) -> Action:
href = data.get("href")
if not href or not isinstance(href, str):
raise SchemaError("url action requires non-empty 'href' string")
return UrlAction(href=href)
browser = data.get("browser")
if browser is not None and browser not in KNOWN_BROWSERS:
raise SchemaError(f"url.browser must be one of {KNOWN_BROWSERS} or omitted")
return UrlAction(href=href, browser=browser)
if t == "keys":
sequence = data.get("sequence")
text = data.get("text")