0xdevalias / chrome-NewWindowWithTabsToRight

Create a new window from the tabs to the right of the currently selected tab.
https://www.devalias.net/dev/chrome-extensions/new-window-with-tabs-to-right/
MIT License
6 stars 2 forks source link

Ability to see how many tabs/windows currently open #14

Open 0xdevalias opened 7 months ago

0xdevalias commented 7 months ago
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',
  })
});