Open 0xdevalias opened 7 months ago
eg. https://github.com/kanban-labs/tabs-count
This is a simple browser extension that lets you know the amount of tabs you have open. The code is very lightweight and only runs on-demand, when you click the extension's icon.
https://github.com/kanban-labs/tabs-count/blob/main/js/background.js
chrome.action.onClicked.addListener(async () => { const tabs = await chrome.tabs.query({ windowType: 'normal' }).then((t) => t.length) const windows = await chrome.windows.getAll().then((w) => w.length) let message = `You have ${tabs} tab${tabs > 1 ? 's' : ''} open` if (windows > 1) message += ` across ${windows} windows` chrome.notifications.create({ type: 'basic', title: 'Tabs count', message, iconUrl: '/icons/icon-144x144.png', }) });
eg. https://github.com/kanban-labs/tabs-count
https://github.com/kanban-labs/tabs-count/blob/main/js/background.js