allow to mute and unmute tabs and get mute status into tab info
Testing / test (push) Failing after 34s
Testing / test (push) Failing after 34s
This commit is contained in:
+22
-1
@@ -141,6 +141,8 @@ async function dispatch(command, args) {
|
||||
case "tabs.dedupe": return tabsDedupe();
|
||||
case "tabs.sort": return tabsSort(args);
|
||||
case "tabs.merge_windows": return tabsMergeWindows();
|
||||
case "tabs.mute": return tabsMute(args);
|
||||
case "tabs.unmute": return tabsUnmute(args);
|
||||
|
||||
// ── Groups ────────────────────────────────────────────────────────────
|
||||
case "group.list": return groupList();
|
||||
@@ -439,8 +441,27 @@ async function tabsMergeWindows() {
|
||||
return { moved };
|
||||
}
|
||||
|
||||
async function tabsMute({ tabId }) {
|
||||
const tab = tabId ? await chrome.tabs.get(tabId) : await getActiveTab();
|
||||
await chrome.tabs.update(tab.id, { muted: true });
|
||||
return { tabId: tab.id, muted: true };
|
||||
}
|
||||
|
||||
async function tabsUnmute({ tabId }) {
|
||||
const tab = tabId ? await chrome.tabs.get(tabId) : await getActiveTab();
|
||||
await chrome.tabs.update(tab.id, { muted: false });
|
||||
return { tabId: tab.id, muted: false };
|
||||
}
|
||||
|
||||
function tabInfo(t) {
|
||||
return { id: t.id, windowId: t.windowId, active: t.active, title: t.title, url: t.url };
|
||||
return {
|
||||
id: t.id,
|
||||
windowId: t.windowId,
|
||||
active: t.active,
|
||||
muted: Boolean(t.mutedInfo && t.mutedInfo.muted),
|
||||
title: t.title,
|
||||
url: t.url,
|
||||
};
|
||||
}
|
||||
|
||||
// ── Groups ────────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user