Skip to main content

Control your browser's tabs from the command line

Project description

BruvTab

GitHub GitHub tag (latest by date) PyPI version Mozilla Add-on

Control your browser's tabs from the terminal.

BruvTab is a fork of brotab, originally created by Yuri Bochkarev.

Features

  • Cross-browser: Support for Firefox, Chrome, Chromium, and Brave.
  • Unified interface: List and manage tabs from multiple browsers in a single view.
  • Scriptable: Ideal for use with fzf, rofi, or custom shell scripts.
  • JSON support: Global --json flag for easy integration with other tools.
  • Search & Index: Index tab contents and search them using SQLite FTS5.
  • Rich Output: Colorized help and tables using the rich library.

Usage

Usage: bruvtab [-h] [--target TARGET_HOSTS] [--json]
               {move,list,close,activate,active,screenshot,search,query,index,new,open,navigate,update,words,text,html,dup,windows,clients,install} ...

bruvtab (bruvtab = Browser Tabs) is a command-line tool that helps you manage browser tabs. It
can help you list, close, reorder, open and activate your tabs.

Positional Arguments:
  {move,list,close,activate,active,screenshot,search,query,index,new,open,navigate,update,words,text,html,dup,windows,clients,install}
    move                move tabs around. This command lists available tabs and runs the editor.
                        In the editor you can 1) reorder tabs -- tabs will be moved in the
                        browser 2) delete tabs -- tabs will be closed 3) change window ID of the
                        tabs -- tabs will be moved to specified windows
    list                list available tabs. The command will request all available clients
                        (browser plugins, mediators), and will display browser tabs in the
                        following format: "<prefix>.<window_id>.<tab_id><Tab>Page title<Tab>URL"
    close               close specified tab IDs. Tab IDs should be in the following format:
                        "<prefix>.<window_id>.<tab_id>". You can use "list" command to obtain tab
                        IDs (first column)
    activate            activate given tab ID. Tab ID should be in the following format:
                        "<prefix>.<window_id>.<tab_id>"
    active              display active tab for each client/window in the following format:
                        "<prefix>.<window_id>.<tab_id>"
    screenshot          return base64 screenshot in json object with keys: 'data' (base64 png),
                        'tab' (tab id of visible tab), 'window' (window id of visible tab), 'api'
                        (prefix of client api)
    search              Search across your indexed tabs using sqlite fts5 plugin.
    query               Filter tabs using chrome.tabs api.
    index               Index the text from browser's tabs. Text is put into sqlite fts5 table.
    new                 open new tab with the Google search results of the arguments that follow.
                        One positional argument is required: <prefix>.<window_id> OR <client>. If
                        window_id is not specified, URL will be opened in the active window of
                        the specifed client
    open                open URLs from the stdin (one URL per line). One positional argument is
                        required: <prefix>.<window_id> OR <client>. If window_id is not
                        specified, URL will be opened in the active window of the specifed
                        client. If window_id is 0, URLs will be opened in new window.
    navigate            navigate to URLs. There are two ways to specify tab ids and URLs: 1.
                        stdin: lines with pairs of "tab_id<tab>url" 2. arguments: bruvtab
                        navigate <tab_id> "<url>", e.g. bruvtab navigate b.20.1
                        "https://google.com" stdin has the priority.
    update              Update tabs state, e.g. URL. There are two ways to specify updates: 1.
                        stdin, pass JSON of the form: [{"tab_id": "b.20.130", "properties":
                        {"url": "http://www.google.com"}}] Where "properties" can be anything
                        defined here:
                        https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/AP
                        I/tabs/update Example: echo '[{"tab_id":"a.2118.2156",
                        "properties":{"url":"https://google.com"}}]' | bruvtab update 2.
                        arguments, e.g.: bruvtab update -tabId b.1.862
                        -url="http://www.google.com" +muted
    words               show sorted unique words from all active tabs of all clients. This is a
                        helper for webcomplete plugin that helps complete words from the browser
    text                show text from all tabs
    html                show html from all tabs
    dup                 display reminder on how to show duplicate tabs using command-line tools
    windows             display available prefixes and window IDs, along with the number of tabs
                        in every window
    clients             display available browser clients (mediators), their prefixes and address
                        (host:port), native app PIDs, and browser names
    install             configure browser settings to use bruvtab mediator (native messaging app)

Options:
  -h, --help            show this help message and exit
  --target TARGET_HOSTS
                        Target hosts IP:Port
  --json                JSON output (default=False)

Installation

Standard (pipx / pip)

  1. Install command-line client:
# Preferred method
pipx install bruvtab

# Alternative
uv tool install bruvtab
pip install --user bruvtab
  1. Install native app manifests:
bruvtab install
  1. Install Browser extension:
  • Firefox: Download from AMO
  • Chrome/Brave/Chromium: Pending Chrome Web Store update. For now, load unpacked extension from bruvtab/extension/chrome/ in developer mode.

NixOS / Home Manager

Add bruvtab as an input to your flake and use the following configuration:

{ config, pkgs, inputs, ... }:
let
  bruvtabPkg = inputs.bruvtab.packages.${pkgs.system}.bruvtab;
  bruvtabCrx = inputs.bruvtab.packages.${pkgs.system}.chromeCrx;
  # The Extension ID is calculated from the private key generated during build
  extensionId = builtins.readFile "${bruvtabCrx}/extension-id";
in
{
  programs.chromium = {
    enable = true;
    extensions = [
      {
        id = extensionId;
        crxPath = "${bruvtabCrx}/bruvtab.crx";
        version = "2.0.1";
      }
    ];
    nativeMessagingHosts = [ bruvtabPkg ];
  };
}

Development

Setup

# Editable install with dev dependencies
pip install -e .[dev,test]
# Install native manifests for testing
bruvtab install --tests

Testing

Run all tests:

just test-all

Or run individual suites:

just unit-test
just smoke-test
just integration-test  # Requires Docker

Related Projects

  • TabFS -- mounts tabs info a filesystem using FUSE
  • dudetab -- collection of useful scripts on top of bruvtab
  • ulauncher-bruvtab -- Ulauncher extension for bruvtab
  • cmp-bruvtab -- bruvtab completion for nvim-cmp

Authors

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bruvtab-2.0.1.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bruvtab-2.0.1-py3-none-any.whl (53.7 kB view details)

Uploaded Python 3

File details

Details for the file bruvtab-2.0.1.tar.gz.

File metadata

  • Download URL: bruvtab-2.0.1.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bruvtab-2.0.1.tar.gz
Algorithm Hash digest
SHA256 dbb4a3ab67d64019465cab397e2641240ec5f26298fa710a5bd7d9ede6380aed
MD5 af26b3d09d5adb89cb16497a91751909
BLAKE2b-256 0f9dc5abaa71341bb6394b305171be0fc3307dad8f84db42c863c1c6b875c427

See more details on using hashes here.

Provenance

The following attestation bundles were made for bruvtab-2.0.1.tar.gz:

Publisher: pypi.yaml on pschmitt/bruvtab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bruvtab-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: bruvtab-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 53.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bruvtab-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb2596828a06eede02ad470fe5b47e2d2dbf35a761a51ccf22b3e8d12c68dce4
MD5 9b8c3191404190e9ffb2119c8617e31d
BLAKE2b-256 4644f0c4cbe98f63157d9885a446f6bd837636ce3f2e46a1954fb3f7419bffeb

See more details on using hashes here.

Provenance

The following attestation bundles were made for bruvtab-2.0.1-py3-none-any.whl:

Publisher: pypi.yaml on pschmitt/bruvtab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page