scalpel@labs: ~/glossary/extension-toolbar-badge.mdx5 sections

The Toolbar Badge: Your Suspended-Tab Count at a Glance

The toolbar badge is the small number on the extension's icon. It counts how many tabs are suspended right now, across every window, and updates as tabs suspend and restore. You can switch it off if you prefer a clean icon.

extension: Scalpel Tab Suspenderupdated: 2026-08-14read_time: 2 min
less extension-toolbar-badge.mdx

Why it matters

At a glance, you want to know how many tabs Scalpel has suspended right now. The badge gives you that number in one look, without opening the popup. It's especially useful if you're trying to free memory on a laptop running hot or if you're curious how aggressive the sweep is over a working session.

How it works

Chrome's setBadgeText() API lets extensions show a small label on their toolbar icon. Scalpel updates the badge after every suspension sweep and whenever a tab's suspended state changes (through manual suspend, restore, or a click). The number reflects the total across every window, not just the active one.

The badge stays live as long as Scalpel is running. If you uninstall the extension, the badge vanishes. If you disable the extension, the badge disappears and suspended tabs are restored (because the background worker isn't running).

The badge uses Chrome's default styling (light grey on a coloured icon). You can't change the badge colour from within the extension; that's a browser-level setting.

What does not matter

The badge doesn't tell you which tabs are suspended or which window they're in, just the total count. It doesn't measure memory saved or CPU freed; that's what the stats panel is for. And the badge is purely informational; turning it off doesn't change how suspension works.

The number only counts tabs that are currently discarded. It doesn't count tabs that are protected by your never-suspend list or other exclusions; those were never suspended in the first place.

Code example

Scalpel updates the badge when the sweep finishes or a manual action happens:

// After a suspension or restore action
const suspendedCount = await getSuspendedTabCount();
await chrome.action.setBadgeText({ text: suspendedCount.toString() });

// Or blank it out if zero
if (suspendedCount === 0) {
  await chrome.action.setBadgeText({ text: '' });
}

How Scalpel shows it

The badge appears on Scalpel's icon in your toolbar. The number updates in real time as you suspend and restore tabs. If you never suspend any tabs (because your timer is high or you've protected everything), the badge is blank.

You can switch the badge off entirely in Scalpel's settings, under "Display." Turn off "Show badge," and the icon will be clean with no number. The badge is just a convenience; turning it off won't affect suspension at all.

Sources