Skip to content

nthnbch/FFTabClose

Repository files navigation

FFTabClose V5.2

πŸš€ Auto-Close Tabs Extension for Firefox & Zen Browser

Automatically close old tabs after a configurable time β€” like Arc Browser. Pinned tabs and essentials are safely put to sleep instead of being closed. Works across all workspaces in Zen Browser.

✨ Features

  • πŸ—‘οΈ Auto-close normal tabs after a configurable delay (1 min β†’ 24h)
  • πŸ’€ Sleep pinned/essential tabs β€” unloaded from memory but stay in your tab bar
  • πŸ›‘οΈ Never touch active or audio tabs β€” your current tab is always safe
  • 🌐 All workspaces β€” works across every Zen Browser workspace
  • ⏱️ Persistent timers β€” survive browser restarts and sleep/wake
  • 🚫 Domain exclusions β€” exclude specific sites from auto-closing
  • πŸ“Š Live statistics β€” see tab counts update in real-time
  • ⚑ Auto-save settings β€” every change applies instantly

🎯 Arc Browser Behavior

Tab type What happens
Normal tabs Closed after the configured delay
Pinned / Essentials Put to sleep (discarded from memory, stay visible)
Active tab Never touched
Tabs playing audio Never touched

πŸ“¦ Installation

From Firefox Add-ons:

  1. Install from addons.mozilla.org
  2. Click the FFTabClose icon in the toolbar to configure

From source (development):

  1. Clone this repo
  2. Go to about:debugging β†’ "This Firefox" / "This Zen"
  3. Click "Load Temporary Add-on..." β†’ select manifest.json

βš™οΈ Configuration

Click the extension icon to configure:

  • Timer: 1 min (test) to 24 hours, or custom
  • Sleep pinned tabs: Discard pinned/essential tabs instead of closing
  • Protect audio tabs: Never touch tabs playing sound
  • Domain exclusions: Sites to never close (one per line)
  • Force process: Immediately run a cleanup cycle

🧠 How It Works

  1. Every tab gets a lastActiveAt timestamp when you visit it
  2. A background alarm runs every minute to check for old tabs
  3. Tabs older than the configured delay are processed:
    • Normal tabs β†’ closed
    • Pinned tabs β†’ discarded (unloaded from memory)
  4. Active tabs, audio tabs, and excluded domains are always protected
  5. Safety: max 3 tabs closed per cycle if >50% would be affected

🟣 Zen Browser Compatibility

FFTabClose is specifically optimized for Zen Browser:

  • Cross-workspace: Tracks tabs across ALL workspaces via events, since browser.tabs.query() only returns the active workspace
  • Essentials = Pinned: Zen's essential tabs are pinned tabs under the hood β€” they're automatically protected
  • Hidden tabs: Tabs in inactive workspaces are verified with browser.tabs.get() instead of being deleted
  • Auto-detection: Extension detects Zen Browser automatically

πŸ”§ Technical Details

  • Manifest V2 β€” compatible with Firefox 109+ and Zen Browser
  • Persistent background script β€” timers survive restarts
  • browser.tabs.discard() β€” native Firefox API for clean memory unloading
  • browser.alarms β€” reliable timer that works through sleep/wake
  • URL-based timer recovery β€” timestamps survive browser restarts even when tab IDs change
  • No data collection β€” everything stays local, no network requests

πŸ›‘οΈ Privacy

  • No data collected β€” zero telemetry, zero analytics
  • No network requests β€” works entirely offline
  • No tab content access β€” only uses metadata (title, URL)
  • Open source β€” all code available for review

πŸ“ˆ Version History

  • V5.2: Zen Browser compatibility fix, toggle fix, auto-save, live stats, safety cap
  • V5.0: Complete rewrite β€” browser.tabs.discard(), global processing, domain exclusions
  • V4.x: Legacy (broken sleep mechanism, single workspace)

πŸ“„ License

MIT License


Compatible with Firefox & Zen Browser πŸŽ‰

About

Auto Close Tab Extension for Firefox

Resources

Stars

Watchers

Forks

Contributors