Run selected shell commands from any webpage directly into your active tmux session — with one click.
flowchart TB
B e1@-->C
C e2@-->a1
subgraph ide1 [tmux]
direction LR
a1["tmux send keys"]
end
C["Python Host"]
subgraph ide2 [Chrome]
direction LR
A["Chrome Extension"]-->B["Native Messaging"]
end
style C fill:#78A4CB,stroke:#333,stroke-width:1px
e1@{ animate: true }
e2@{ animate: true }
- Select any command-like text on a page → a Run / Paste toolbar appears
- Right-click any selection → "Run in tmux" or "Copy to tmux"
- Run = sends the command + Enter (executes immediately)
- Paste = types the command without Enter (lets you review first)
cd native-host
chmod +x install.sh
./install.shThis will:
- Copy the Python host to
~/.config/zap/ - Generate a secure auth token
- Install the native messaging manifest for Chrome/Chromium
- Print your auth token — copy it!
- Open chrome://extensions
- Enable Developer mode (top right toggle)
- Click Load unpacked
- Select the
extension/folder from this project
After loading, Chrome shows a 32-character extension ID. Run:
cd native-host
./update-extension-id.sh YOUR_EXTENSION_ID_HERE- Click the tmux Runner icon in Chrome toolbar
- Paste the token from Step 1
- Click Verify — you should see "Connected to native host"
Select any text that looks like a shell command on any page. A small toolbar appears:
- ▶ Run – executes the command in your tmux pane
- ⎘ Paste – types it without pressing Enter
Right-click any selected text → Run in tmux or Copy to tmux (no enter)
By default, commands go to your currently active tmux pane.
To target a specific pane, open the extension popup and set a target like:
main– a session named "main"0:1.0– session 0, window 1, pane 0work:code– session "work", window "code"
Run tmux list-sessions or tmux list-panes -a to find targets.
- All commands require a token stored in
~/.config/zap/token - The token uses
hmac.compare_digest(constant-time comparison) - The native host only accepts connections from your extension
- Token is never exposed to web pages — only the background script has it
To regenerate the token: re-run install.sh
zap/
├── extension/
│ ├── manifest.json # Chrome extension manifest (MV3)
│ ├── background.js # Service worker, native messaging
│ ├── content.js # Floating toolbar, toast notifications
│ ├── content.css # Toolbar & toast styles
│ ├── popup.html/js # Extension popup (auth + settings)
│ └── icons/ # Extension icons
└── native-host/
├── tmux_runner_host.py # Native messaging host (Python)
├── install.sh # One-shot installer
└── update-extension-id.sh # Generated by install.sh
"Native host not found"
→ Run install.sh and update-extension-id.sh with the correct extension ID.
Commands go to the wrong pane
→ Set an explicit target in the popup, or ensure the right pane is active.
Token verification fails
→ Check ~/.config/zap/host.log for errors. Re-run install.sh to regenerate.
Toolbar doesn't appear
→ The heuristic filters for command-like text. Try right-click → "Run in tmux" instead.