| Crates.io | chrometab |
| lib.rs | chrometab |
| version | 1.0.1 |
| created_at | 2025-12-09 22:47:52.375222+00 |
| updated_at | 2025-12-09 22:55:47.541551+00 |
| description | A powerful CLI tool for managing Chrome tabs via Chrome DevTools Protocol |
| homepage | |
| repository | https://github.com/cumulus13/chrometab-rust |
| max_upload_size | |
| id | 1976878 |
| size | 91,217 |
A blazingly fast command-line tool for managing Google Chrome tabs using the Chrome DevTools Protocol. Written in Rust for maximum performance and reliability.
cargo install chrometab
git clone https://github.com/cumulus13/chrometab-rust.git
cd chrometab-rust
cargo build --release
The binary will be available at target/release/chrometab
Download from Releases page.
Launch Chrome with remote debugging enabled:
chrome.exe --remote-debugging-port=9222
google-chrome --remote-debugging-port=9222
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
# Set custom Chrome debugging host and port
export CHROME_REMOTE_DEBUGGING_HOST=localhost
export CHROME_REMOTE_DEBUGGING_PORT=9222
Linux: Install xdotool for window activation
sudo apt-get install xdotool # Ubuntu/Debian
sudo dnf install xdotool # Fedora
sudo pacman -S xdotool # Arch
Windows: No additional requirements
macOS: Grant Terminal accessibility permissions in System Preferences
# List all tabs interactively
chrometab --list
# Search for tabs matching pattern
chrometab "youtube"
# Search with wildcard
chrometab "*github*"
# Open a new tab
chrometab --url "https://google.com"
# Show URLs in listing
chrometab --list --show-url
# Find duplicate tabs
chrometab --find-duplicate
When running chrometab --list or when multiple matches are found, you enter interactive mode:
Commands:
3c)1,3,5c)1-5c)USAGE:
chrometab [OPTIONS] [PATTERN]
ARGUMENTS:
[PATTERN] Pattern to match tab titles or URLs
OPTIONS:
-l, --list List all available tabs
-a, --active-only Show only active tabs (exclude chrome-extension://)
-s, --show-url Display URLs alongside tab titles
--find-duplicate Find and list tabs with duplicate URLs
-u, --url <URL> Open a new tab with the specified URL
-f, --force <PLATFORM> Force platform for window activation (windows/linux/darwin)
--host <HOST> Chrome remote debugging host [env: CHROME_REMOTE_DEBUGGING_HOST]
--port <PORT> Chrome remote debugging port [env: CHROME_REMOTE_DEBUGGING_PORT]
--debug Enable debug output
-h, --help Print help
-V, --version Print version
SUBCOMMANDS:
serve Run as WebSocket server for remote control (coming soon)
client Send pattern to WebSocket server (coming soon)
# Find and activate a tab with "github" in title or URL
chrometab github
# List all tabs with URLs visible
chrometab --list --show-url
# Find tabs with duplicate URLs
chrometab --find-duplicate
# Open multiple tabs
chrometab --url "https://github.com"
chrometab --url "https://google.com"
# Search with wildcard at the beginning
chrometab "*react*"
# Search for YouTube videos
chrometab "youtube*"
# Search for specific domain
chrometab "*github.com*"
# Case-insensitive search (automatic)
chrometab "YOUTUBE" # matches "YouTube", "youtube", etc.
In interactive mode, close multiple tabs:
chrometab --list
# Then type:
1,3,5c # Close tabs 1, 3, and 5
1-5c # Close tabs 1 through 5
2,5-8,10c # Close tabs 2, 5 through 8, and 10
# Connect to Chrome on different host/port
chrometab --host 192.168.1.100 --port 9223 --list
# Or use environment variables
export CHROME_REMOTE_DEBUGGING_HOST=192.168.1.100
export CHROME_REMOTE_DEBUGGING_PORT=9223
chrometab --list
Note: Chrome DevTools Protocol does not provide direct access to profile names. However, you can identify profiles through:
--user-data-dirTo work with specific profiles:
# Launch Chrome with specific profile
chrome.exe --remote-debugging-port=9222 --profile-directory="Profile 1"
# Or use user-data-dir
chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\Users\YourName\ChromeProfiles\Work"
The tool will interact with whichever Chrome instance is running on the debugging port.
ChromeTab communicates with Chrome via the Chrome DevTools Protocol (CDP):
--remote-debugging-port=9222http://localhost:9222/json/versionTarget.getTargets - List all tabsTarget.activateTarget - Activate a tabTarget.closeTarget - Close a tabTarget.createTarget - Open new tabEnumWindows, SetForegroundWindow)xdotool command┌─────────────────┐
│ ChromeTab CLI │
└────────┬────────┘
│
├──── Chrome DevTools Protocol (WebSocket)
│ └─── Target Domain
│ ├─── getTargets
│ ├─── activateTarget
│ ├─── closeTarget
│ └─── createTarget
│
└──── Window Management
├─── Windows: Win32 API
├─── Linux: xdotool
└─── macOS: AppleScript
Rust version benefits:
# Windows from Linux
cargo build --release --target x86_64-pc-windows-gnu
# Linux from macOS
cargo build --release --target x86_64-unknown-linux-gnu
# macOS from Linux (requires osxcross)
cargo build --release --target x86_64-apple-darwin
cargo build --release
# With additional optimizations
RUSTFLAGS="-C target-cpu=native" cargo build --release
Error: "Failed to connect to Chrome"
Solution:
--remote-debugging-port=9222curl http://localhost:9222/json/versionWindows:
Linux:
sudo apt-get install xdotoolmacOS:
Error: "Failed to connect to WebSocket"
Solution:
curl http://localhost:9222/json/version# Make binary executable
chmod +x chrometab
# Or install via cargo
cargo install chrometab
cargo test
cargo run -- --debug --list
# Format code
cargo fmt
# Run clippy
cargo clippy
# Check for common issues
cargo check
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)cargo fmt and cargo clippy before committing# Update version in Cargo.toml
# Then publish
cargo publish
Users can then install with:
cargo install chrometab
This project is licensed under the MIT License - see the LICENSE file for details.
Hadi Cahyadi - cumulus13@gmail.com
| Feature | Python | Go | Rust |
|---|---|---|---|
| Startup Time | ~100ms | ~20ms | ~10ms |
| Memory Usage | ~30MB | ~5MB | ~2MB |
| Binary Size | ~50MB | ~8MB | ~3MB |
| Runtime | Required | None | None |
| Dependencies | Many | Few | Minimal |
| Performance | Good | Great | Excellent |
| Safety | Dynamic | Static | Memory-Safe |
Q: Do I need to install Chrome extensions?
A: No, ChromeTab works directly with Chrome DevTools Protocol.
Q: Can I use this with Chromium?
A: Yes, Chromium also supports Chrome DevTools Protocol.
Q: Does this work with Chrome profiles?
A: Yes, connect to the specific Chrome instance running with your desired profile.
Q: Can I automate tab management?
A: Yes, use the command-line interface in scripts.
Q: Is it safe to use?
A: Yes, it only uses the official Chrome DevTools Protocol API.
Q: Why Rust instead of Python/Go?
A: Rust provides the best combination of performance, memory safety, and zero-cost abstractions.
⭐ Star this repository if you find it useful!
📦 Install: cargo install chrometab