chrome-NewWindowWithTabsToRight icon indicating copy to clipboard operation
chrome-NewWindowWithTabsToRight copied to clipboard

Ability to see how many tabs/windows currently open

Open 0xdevalias opened this issue 1 year ago • 0 comments

  • 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',
  })
});

0xdevalias avatar Nov 21 '23 04:11 0xdevalias