examples: windowed browser by default, so the session's desktop is visible

This commit is contained in:
Hermenix committed 2026-09-30 19:21:30 +00:00
1 parent bfb333e9ff
commit 36541d22f4
1 file changed
+14 -5
+14 -5
View File
@@ -122,7 +122,8 @@ def clear_screen(runtime_dir: str) -> None:
time.sleep(1.0)
def start_browser(env: dict, *, url: str, port: int, home: pathlib.Path) -> subprocess.Popen:
def start_browser(env: dict, *, url: str, port: int, home: pathlib.Path,
fullscreen: bool = False) -> subprocess.Popen:
home.mkdir(parents=True, exist_ok=True)
profile = home / "profile"
env = {**env, "HOME": str(home)}
@@ -134,8 +135,11 @@ def start_browser(env: dict, *, url: str, port: int, home: pathlib.Path) -> subp
# invocation the module's own manual testing used.
"--no-sandbox",
"--disable-dev-shm-usage",
"--kiosk",
"--window-size=1280,720",
# Windowed by default: the session's wallpaper, gaps and window borders
# are the point of filming a *desktop*, and a kiosk window hides all of
# them. `--fullscreen` brings back the full-bleed browser.
*(["--kiosk"] if fullscreen else []),
"--window-size=1040,560",
f"--user-data-dir={profile}",
"--no-first-run",
"--no-default-browser-check",
@@ -145,7 +149,8 @@ def start_browser(env: dict, *, url: str, port: int, home: pathlib.Path) -> subp
"--remote-debugging-address=127.0.0.1",
url,
]
log(f"browser: starting chromium (debug port {port}) at {url}")
log(f"browser: starting chromium (debug port {port}, "
f"{'kiosk' if fullscreen else 'windowed'}) at {url}")
return subprocess.Popen(argv, env=env, stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
@@ -353,6 +358,9 @@ def main() -> int:
parser.add_argument("--capture-fps", type=float, default=15.0,
help="frames per second to keep (default: %(default)s)")
parser.add_argument("--debug-port", type=int, default=9222)
parser.add_argument("--fullscreen", action="store_true",
help="kiosk/full-bleed browser instead of a windowed one "
"(hides the session's wallpaper and window borders)")
parser.add_argument("--work-dir", type=pathlib.Path, default=None,
help="where frames land (default: a temp dir)")
parser.add_argument("--clear-screen", action="store_true",
@@ -381,7 +389,8 @@ def main() -> int:
out.parent.mkdir(parents=True, exist_ok=True)
browser = start_browser(env, url="https://www.google.com",
port=args.debug_port, home=work / "home")
port=args.debug_port, home=work / "home",
fullscreen=args.fullscreen)
devtools = None
recorder = None
try: