Skip to content
yyPublic

About

A Mac CLI for herding browser tabs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tabby logo

tabby

Claude Insights quote: "User asked Claude to close 114 browser tabs in one session — the digital equivalent of finally cleaning out the garage"

A Mac CLI for herding browser tabs. Pure zsh + JXA, no dependencies.

Install

# Clone and add to PATH
git clone git@github.com:yy/tabby.git ~/git/tabby
export PATH="$HOME/git/tabby/bin:$PATH"

Usage

tabby list              # List all tabs as JSON
tabby list --window 1   # List tabs in window 1
tabby count             # Count tabs per window
tabby count --total     # Just the total
tabby url               # URL of active tab
tabby url 1 3           # URL of window 1, tab 3
tabby close 1 5         # Close window 1, tab 5
tabby close --url arxiv # Close first tab whose URL contains "arxiv"
tabby focus 1 3         # Switch to window 1, tab 3
tabby dedup             # Close duplicate tabs
tabby dedup --dry-run   # Preview duplicates
tabby version           # Print version (also --version, -v)

Composes with standard tools:

# Find all GitHub tabs
tabby list | jq '.[] | select(.url | test("github.com"))'

# Count tabs per domain
tabby list | jq -r '.[].url' | awk -F/ '{print $3}' | sort | uniq -c | sort -rn

# Close all Google search tabs (careful!)
tabby close --url "google.com/search" --all

Browser selection

tabby --browser safari list         # Use Safari
TABBY_BROWSER=safari tabby list     # Same, via env var

Default: chrome. Set TABBY_BROWSER=safari in your shell profile to switch permanently.

Safe close

Tab indices shift when tabs are closed, and browsers reorder windows by recency between calls, so a window/tab index read from list can point at a different tab by the time you close it. Two ways to close safely:

tabby close --expect "GitHub" 1 5   # Only closes if title starts with "GitHub"
tabby close --url github.com/foo    # Find + close by URL in one step (no index race)
tabby close --url github.com --all  # Close every matching tab

Prefer --url in scripts: it resolves the tab and closes it inside a single call, so window reordering can't make it hit the wrong tab.

--url matches on substring and, without --all, closes the first hit. That bites when your needle is a prefix of another open tab's URL: https://bsky.app/ also matches https://bsky.app/profile/someone/post/123. Narrow it:

tabby close --url https://bsky.app/ --exact  # Whole URL must equal the needle
tabby close --url bsky.app --expect "Quiet"  # URL hit must also pass the title check

--exact and --expect compose, and both abort rather than close a tab they can't confirm.

Permissions

On first run, macOS will prompt you to grant your terminal Automation access to Chrome (or Safari). This allows tabby to read tab titles/URLs and close tabs. You can revoke this in System Settings > Privacy & Security > Automation.

Privacy

tabby list outputs all tab titles and URLs to stdout. Be mindful when piping to files or logs — URLs may contain tokens, session IDs, or reveal private browsing activity.

Requirements

  • macOS
  • Google Chrome or Safari

About

A Mac CLI for herding browser tabs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages