Skip to content

Add keyboard shortcut to pause audio tabs or switch to audible tab#33

Draft
Copilot wants to merge 4 commits into
masterfrom
copilot/add-pause-all-tabs-shortcut
Draft

Add keyboard shortcut to pause audio tabs or switch to audible tab#33
Copilot wants to merge 4 commits into
masterfrom
copilot/add-pause-all-tabs-shortcut

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 9, 2026

Adds a configurable keyboard shortcut that pauses media playing in all tabs, or switches to the first audible tab if pausing fails.

Implementation

  • Audio detection: Queries tab.audible property across all tabs
  • Pause mechanism: Injects scripts in parallel using Promise.allSettled() to pause HTML5 <audio> and <video> elements
  • Fallback behavior: Switches to first audible tab when script injection fails (protected pages) or no pausable media exists
  • Result tracking: Uses optional chaining to safely check if media was actually paused: results?.[0]?.result === true

Changes

  • manifest.json: Added pause-or-show-audio-tabs command
  • background.js: Implemented handlePauseOrShowAudioTabs() with parallel execution and error handling
  • popup.js, README.md: Added command description and documentation

Limitations

Only pauses HTML5 media elements. Cannot control Web Audio API, WebRTC, or content on protected pages (chrome://).

// Injected function that pauses discovered media
const mediaElements = document.querySelectorAll('audio, video');
mediaElements.forEach(el => {
  if (!el.paused) el.pause();
});

No default keybinding—users configure via chrome://extensions/shortcuts.

Original prompt

This section details on the original issue you should resolve

<issue_title>pause all tabs? show tabs playing audio?</issue_title>
<issue_description></issue_description>

<agent_instructions>can the extension have a new shortcut which either pauses all tabs and if not, shows a tab playing audio?</agent_instructions>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 9, 2026 02:15
Co-authored-by: DovieW <32934685+DovieW@users.noreply.github.com>
… result checking

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 shortcut to pause all tabs or show audio playing tabs Add keyboard shortcut to pause audio tabs or switch to audible tab Jan 9, 2026
Copilot AI requested a review from DovieW January 9, 2026 02:20
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.

pause all tabs? show tabs playing audio?

2 participants