Skip to content

Focus last active Chrome window for global shortcuts#37

Draft
Copilot wants to merge 3 commits into
masterfrom
copilot/add-global-shortcut-focus
Draft

Focus last active Chrome window for global shortcuts#37
Copilot wants to merge 3 commits into
masterfrom
copilot/add-global-shortcut-focus

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 30, 2026

Global shortcuts triggered while Chrome is in the background should bring the last active Chrome window to the foreground. Currently commands run but Chrome remains unfocused, making global shortcuts awkward to use.

  • Window focus on command execution
    • Add a shared helper that focuses the last active normal Chrome window before executing shortcut commands.
  • Hardened focus behavior
    • Use a strict window ID check and guard against missing-window errors while surfacing unexpected failures.
async function focusLastActiveWindow() {
  const lastFocusedWindow = await chrome.windows.getLastFocused({
    windowTypes: ['normal'],
    includeIncognito: true,
  });

  if (lastFocusedWindow && typeof lastFocusedWindow.id === 'number') {
    await chrome.windows.update(lastFocusedWindow.id, { focused: true });
  }
}
Original prompt

This section details on the original issue you should resolve

<issue_title>all shortcuts should focus the last active chrome window (for setting shortcuts to global)</issue_title>
<issue_description></issue_description>

<agent_instructions>this is issue is essentially saying "i want the option to have a shortcut being used even when chrome is not in the foreground/active. right now, when i do a global shortcut, it runs, but chrome didn't jump to the foreground so its kind of annoying"</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 30, 2026 14:18
Co-authored-by: DovieW <32934685+DovieW@users.noreply.github.com>
Co-authored-by: DovieW <32934685+DovieW@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option for global shortcuts to focus last active chrome window Focus last active Chrome window for global shortcuts Jan 30, 2026
Copilot AI requested a review from DovieW January 30, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

all shortcuts should focus the last active chrome window (for setting shortcuts to global)

2 participants