Created
August 18, 2026 10:02
-
-
Save 54keesh/f6a0f7b29080b091849d25db68b98280 to your computer and use it in GitHub Desktop.
This gist is for mute/unmute tabs incase the official chrome extension goes down again
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function toggleMuteState(tabId) { | |
| try { | |
| const tab = await chrome.tabs.get(tabId); | |
| const muted = !tab.mutedInfo.muted; | |
| await chrome.tabs.update(tabId, { muted }); | |
| } catch (err) { | |
| console.error("Failed to toggle mute:", err); | |
| } | |
| } | |
| chrome.commands.onCommand.addListener(async (command) => { | |
| if (command === "toggle-mute") { | |
| try { | |
| const [tab] = await chrome.tabs.query({ active: true, currentWindow: true }); | |
| if (tab) { | |
| await toggleMuteState(tab.id); | |
| } | |
| } catch (err) { | |
| console.error("Failed to query active tab:", err); | |
| } | |
| } | |
| }); | |
| chrome.action.onClicked.addListener(async (tab) => { | |
| chrome.tabs.create({ | |
| url: "help/index.html" | |
| }) | |
| }); | |
| chrome.runtime.onInstalled.addListener(({ reason }) => { | |
| if (reason === "install") { | |
| chrome.tabs.create({ | |
| url: "https://browsernative.com/mute-tab-keyboard-shortcut-chrome-extension/" | |
| }) | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment