fix: prevent browser target and focus surprises
Testing / remote-protocol-compat (0.9.5) (push) Successful in 57s
Testing / remote-protocol-compat (0.9.3) (push) Successful in 1m1s
Testing / test (push) Successful in 1m7s

- Respect the globally selected browser when renaming client aliases.
- Pass the resolved local profile into sync and async local transports so
  BROWSER_CLI_PROFILE is honored consistently.
- Stop tabs.active from explicitly focusing the OS browser window, avoiding
  virtual-desktop jumps during tab activation.
- Make window merging skip audible, unmuted windows so video playback windows
  are not selected as merge targets.
- Bump the Python package and extension manifest versions to 0.12.2.
- Add regression coverage for browser selection and focus-stealing behavior.
This commit is contained in:
2026-06-14 13:00:33 +02:00
parent e1c495d82d
commit 509f1387de
10 changed files with 85 additions and 20 deletions
+4 -4
View File
@@ -137,10 +137,10 @@ def send_command(
response = (
_send_remote(remote_endpoint, msg, private_key)
if remote_endpoint
else local_transport.send_local_sync(profile, payload, target_discovery.resolve_socket)
else local_transport.send_local_sync(requested_profile, payload, target_discovery.resolve_socket)
)
except (FileNotFoundError, ConnectionRefusedError, OSError):
raise messages.remote_connection_error(remote_endpoint) if remote_endpoint else messages.local_connection_error(profile)
raise messages.remote_connection_error(remote_endpoint) if remote_endpoint else messages.local_connection_error(requested_profile)
return messages.decode_response(response)
@@ -192,9 +192,9 @@ async def send_command_async(
response = (
await _send_remote_async(remote_endpoint, msg, private_key)
if remote_endpoint
else await local_transport.send_local_async(profile, payload, target_discovery.resolve_socket)
else await local_transport.send_local_async(requested_profile, payload, target_discovery.resolve_socket)
)
except (FileNotFoundError, ConnectionRefusedError, OSError):
raise messages.remote_connection_error(remote_endpoint) if remote_endpoint else messages.local_connection_error(profile)
raise messages.remote_connection_error(remote_endpoint) if remote_endpoint else messages.local_connection_error(requested_profile)
return messages.decode_response(response)
+6 -3
View File
@@ -159,11 +159,14 @@ def _print_clients(all_clients: list) -> None:
help="Browser profile alias to rename. Overrides the global --browser option for this command.",
)
@click.argument("alias")
def cmd_clients_rename(target_browser, alias):
@click.pass_context
def cmd_clients_rename(ctx, target_browser, alias):
"""Set the profile alias used to identify this browser instance."""
root_obj = ctx.find_root().obj or {}
selected_browser = target_browser or root_obj.get("browser")
try:
_ensure_unique_browser_alias(alias, target_browser)
send_command("clients.rename_profile", {"alias": alias}, profile=target_browser)
_ensure_unique_browser_alias(alias, selected_browser)
send_command("clients.rename_profile", {"alias": alias}, profile=selected_browser)
except BrowserNotConnected as e:
console.print(f"[red]Error:[/red] {e}")
sys.exit(1)