[eric] browser: Ctrl/Cmd+R reloads the last-interacted browser, else the app

This commit is contained in:
ciregenz
2026-06-25 20:45:18 -07:00
parent 97a859e504
commit ccd0bc3971
6 changed files with 66 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
// Tracks which browser card the user last interacted with (clicked into its page or its chrome),
// so global shortcuts (Ctrl+R reload, Ctrl +/- zoom, Ctrl+Tab) target THAT browser instead of a
// guess. Module-level and imperative on purpose: shortcut handlers read it on keydown, so no React
// re-render is needed. Cleared the moment the user clicks anything that isn't a browser card.
let lastInteractedBrowserId: string | null = null;
export function setLastInteractedBrowser(browserId: string): void {
lastInteractedBrowserId = browserId;
}
export function clearLastInteractedBrowser(): void {
lastInteractedBrowserId = null;
}
export function getLastInteractedBrowser(): string | null {
return lastInteractedBrowserId;
}