Composable tmux popup system with gum UI components
Project description
tmux-popup
Composable tmux popup system with gum UI components.
Interactive popup components in action
✨ Features
- 🎨 Rich Components - Styled text, inputs, selections, confirmations
- 🔧 Composable API - Chain commands for complex interactions
- 📦 Zero Dependencies - Pure Python, only needs tmux and gum
- 🎯 Type-Safe - Full type hints and result parsing
- 🚀 Lightweight - Simple, focused library
📋 Prerequisites
Required system tools:
- tmux - Terminal multiplexer for popups
- gum - Provides the UI components
# macOS
brew install tmux gum
# Arch Linux
sudo pacman -S tmux gum
# Ubuntu/Debian
sudo apt install tmux
# For gum: https://github.com/charmbracelet/gum#installation
📦 Installation
# Install from PyPI (coming soon)
uv add tmux-popup # Recommended
pip install tmux-popup # Alternative
# Install from source
uv add git+https://github.com/angelsen/tap-tools.git#subdirectory=packages/tmux-popup
# Or with pip:
pip install git+https://github.com/angelsen/tap-tools.git#subdirectory=packages/tmux-popup
🚀 Quick Start
from tmux_popup import Popup
from tmux_popup.gum import GumStyle, GumInput, GumChoose
# Create a simple popup
popup = Popup(width="65", title="My App")
result = popup.add(
GumStyle("Welcome!", header=True),
GumInput(placeholder="Enter your name...")
).show()
print(f"Hello, {result}!")
🎮 Usage
Basic Input
popup = Popup(width="50")
name = popup.add(
GumStyle("User Setup", header=True),
"Please enter your details:",
GumInput(placeholder="Name...", value="")
).show()
Confirmations
popup = Popup()
confirmed = popup.add(
GumStyle("⚠️ Warning", warning=True),
"This will delete all data.",
GumConfirm("Are you sure?", default=False)
).show()
if confirmed:
# Proceed with deletion
pass
Selections
# Single choice
choice = popup.add(
GumStyle("Select Action", header=True),
GumChoose([
("new", "📝 New File"),
("open", "📂 Open File"),
("save", "💾 Save File"),
("quit", "❌ Quit")
])
).show()
# Multiple selection with fuzzy search
items = ["Python", "JavaScript", "Go", "Rust", "TypeScript"]
selected = popup.add(
GumStyle("Select Languages", info=True),
GumFilter(items, limit=0, fuzzy=True)
).show() # Returns list of selected items
Tables
data = [
["Active", "Server 1", "192.168.1.10"],
["Idle", "Server 2", "192.168.1.11"],
["Active", "Server 3", "192.168.1.12"],
]
selected_ip = popup.add(
GumStyle("Select Server", header=True),
GumTable(
data,
headers=["Status", "Name", "IP"],
return_column=2 # Return IP column
)
).show()
📚 Components
Core
Popup- Main popup runner with tmux display-popupCommand- Base class for all UI commands
Input Components
GumInput- Single line text inputGumWrite- Multi-line text editorGumConfirm- Yes/no confirmation
Selection Components
GumChoose- Single choice from listGumFilter- Fuzzy search with multi-selectGumFile- File pickerGumTable- Table with row selection
Display Components
GumStyle- Styled text with presets (header, info, warning, error)GumFormat- Markdown/template formattingGumPager- Scrollable text viewerGumLog- Formatted log display
Utility Components
GumJoin- Layout multiple elementsGumSpin- Loading spinner for async operations
🏗️ Architecture
The library follows a simple pattern:
- Commands render themselves to shell script
- Popup combines commands and executes via tmux
- Results are parsed and returned to Python
# Commands know how to render
cmd = GumInput(value="default")
script_lines = cmd.render() # Returns list of shell commands
# Popup handles execution
popup = Popup()
result = popup.add(cmd).show() # Executes and returns parsed result
🛠️ Development
# Clone repository
git clone https://github.com/angelsen/tap-tools
cd tap-tools
# Install for development (recommended)
uv sync
uv run --package tmux-popup python examples/demo.py
# Or with pip:
cd packages/tmux-popup
pip install -e .
python examples/demo.py
📄 License
MIT - see LICENSE for details.
👤 Author
Fredrik Angelsen
🙏 Acknowledgments
Built on top of:
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
tmux_popup-0.1.0.tar.gz
(12.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tmux_popup-0.1.0.tar.gz.
File metadata
- Download URL: tmux_popup-0.1.0.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02e0377c2c770edbcf6f59c10f2ba2047bca05422e4386897cdb05d456c9e640
|
|
| MD5 |
fbc1fdaca50fbb3e30e6fd0d6b8c8ac9
|
|
| BLAKE2b-256 |
20c17c5b7b869a5faccf60b264ca00fba7cc5517daf03c850972ac8f16eda473
|
File details
Details for the file tmux_popup-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tmux_popup-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a68d4a0b70315183420723537a2b483b24cb95ef64c06b996d7898042592040f
|
|
| MD5 |
a9b23f35e091af496ae9787bdc7665a7
|
|
| BLAKE2b-256 |
44c7f59ea21aab27d7144034e8b96318df9052417b815c9c5bf06b3b9f8a5e4e
|