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 with pretty output and terminal colors.
  • 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). Optionally target a specific tab ID.
    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 or from
                        specified tabs. This is a helper for webcomplete plugin that helps
                        complete words from the browser
    text                show text from all tabs or from specified tabs
    html                show html from all tabs or from specified 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                Pretty JSON output (colored on terminals)

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: Prefer the signed XPI attached to each GitHub release, or use the flake's self-hosted XPI output (firefoxAddon, alias firefoxXpi). The release workflow publishes listed AMO builds and signs separate self-distributed XPIs for GitHub releases.
  • Chrome/Brave/Chromium: Prefer the Chrome Web Store build once published. The release workflow also uploads Chrome CRX/ZIP artifacts and a self-hosted update manifest to GitHub releases.

NixOS / Home Manager

Add bruvtab as an input to your flake. For Chromium/Home Manager, you can either pin the packaged CRX from the flake output or point Chrome at the published update manifest URL.

Using the packaged CRX directly:

{ config, pkgs, inputs, ... }:
let
  bruvtabPkg = inputs.bruvtab.packages.${pkgs.system}.bruvtab;
  bruvtabCrx = inputs.bruvtab.packages.${pkgs.system}.chromeCrx;
  bruvtabFirefoxAddon = inputs.bruvtab.packages.${pkgs.system}.firefoxAddon;
  # The Extension ID is calculated from the private key generated during build
  extensionId = builtins.readFile "${bruvtabCrx}/extension-id";
in
{
  programs.firefox.profiles.default.extensions.packages = [
    bruvtabFirefoxAddon
  ];

  programs.chromium = {
    enable = true;
    extensions = [
      {
        id = extensionId;
        crxPath = "${bruvtabCrx}/bruvtab.crx";
        inherit (bruvtabPkg) version;
      }
    ];
    nativeMessagingHosts = [ bruvtabPkg ];
  };
}

Using the published update manifest URL for auto-updates from GitHub releases:

{
  programs.chromium.extensions = [
    {
      id = "edpgjheobdplebiikjgjgpmonakingef";
      updateUrl = "https://github.com/pschmitt/bruvtab/releases/latest/download/bruvtab-chrome-updates.xml";
    }
  ];
}

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.9.tar.gz (49.9 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.9-py3-none-any.whl (57.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bruvtab-2.0.9.tar.gz
  • Upload date:
  • Size: 49.9 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.9.tar.gz
Algorithm Hash digest
SHA256 b55a9ddf68fa3a37f04b7b79f43aa2fffa63c4bd2056af896a901da5cd354148
MD5 1cb2253b75ce93c2dc8faa9c10a51fd9
BLAKE2b-256 723f1d7dfb9621572c0cc8ff2b711e679510dfd42e4b9340dfeecd46b3599444

See more details on using hashes here.

Provenance

The following attestation bundles were made for bruvtab-2.0.9.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.9-py3-none-any.whl.

File metadata

  • Download URL: bruvtab-2.0.9-py3-none-any.whl
  • Upload date:
  • Size: 57.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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 96efe4f0d1b8353fd448eb686fa7108aedcb1cea28e94e3788376558dcacf7f3
MD5 8d3131801937ea1e5b4c1fd86650664a
BLAKE2b-256 c775f7fadba9dbd5b803a5a3bde9046c0ae5a9e031b89cc43ff70da8f64b3830

See more details on using hashes here.

Provenance

The following attestation bundles were made for bruvtab-2.0.9-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