Skip to content

scubbo/tab-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Tab Counter

A command-line tool to count the number of browser tabs currently open.

Current Support

Firefox only - This tool currently only supports Mozilla Firefox. Support for other browsers (Chrome, Safari, Edge) may be added in the future.

How It Works

The tool reads Firefox's session store file (a compressed JSON file in mozLz40 format), decompresses it, and counts the total number of tabs across all open windows.

Building

Requirements:

  • Go 1.16 or later
go build -o count-firefox-tabs count-firefox-tabs.go

Cross-Platform Builds

# macOS
GOOS=darwin GOARCH=amd64 go build -o count-firefox-tabs-macos count-firefox-tabs.go

# Linux
GOOS=linux GOARCH=amd64 go build -o count-firefox-tabs-linux count-firefox-tabs.go

# Windows
GOOS=windows GOARCH=amd64 go build -o count-firefox-tabs.exe count-firefox-tabs.go

Usage

Simply run the binary:

./count-firefox-tabs

Output:

Firefox tabs open: 42

If Firefox is not running:

Firefox is not running

Platform Support

  • macOS: Fully supported
  • Linux: Should work (untested) - looks for Firefox profiles in ~/.mozilla/firefox/
  • Windows: Should work (untested) - looks for Firefox profiles in %APPDATA%/Mozilla/Firefox/Profiles

Note: The profile location detection currently assumes macOS paths. Cross-platform support would require updating the findFirefoxProfile() function.

How Firefox Session Store Works

Firefox stores your browsing session in compressed files:

  • sessionstore-backups/recovery.jsonlz4 - Most recent session data
  • sessionstore.jsonlz4 - Backup session data

These files use Mozilla's mozLz40 compression format, which is LZ4 block compression with a custom header containing:

  • 8-byte magic number: mozLz40\0
  • 4-byte little-endian uncompressed size
  • Compressed JSON data

License

MIT

About

Obsessive Tab Hoarder? This can give you stats!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages