An open API service indexing awesome lists of open source software.

https://github.com/dapi/zellij-tab-status

Zellij tab status indicator
https://github.com/dapi/zellij-tab-status

Last synced: 4 months ago
JSON representation

Zellij tab status indicator

Awesome Lists containing this project

README

          

# zellij-tab-status

[![CI](https://github.com/dapi/zellij-tab-status/actions/workflows/ci.yml/badge.svg)](https://github.com/dapi/zellij-tab-status/actions/workflows/ci.yml)

Zellij plugin for managing tab status with emoji prefixes.

## Features

- **Set/clear emoji status** on any tab by pane_id
- **Rename tabs** without losing the emoji status prefix
- **Query current status**, base name, or plugin version programmatically
- **Atomic operations** β€” no race conditions when updating status
- **Unicode-aware** β€” handles complex emoji (flags πŸ‡ΊπŸ‡Έ, skin tones πŸ‘‹πŸ», ZWJ sequences πŸ‘¨β€πŸ‘©β€πŸ‘§)

## Installation

### Option 1: Download Release (Recommended)

```bash
# Download latest release
curl -L https://github.com/dapi/zellij-tab-status/releases/latest/download/zellij-tab-status.wasm \
-o ~/.config/zellij/plugins/zellij-tab-status.wasm
```

### Option 2: Build from Source

```bash
# Prerequisites
rustup target add wasm32-wasip1

# Build & Install
git clone https://github.com/dapi/zellij-tab-status
cd zellij-tab-status
make install
```

### Configure Zellij

No `config.kdl` changes are required for the default setup.
The plugin is launched on-demand via `zellij pipe --plugin ...`.

Optional preloaded mode (if you want `--name tab-status` commands):
```kdl
load_plugins {
"file:~/.config/zellij/plugins/zellij-tab-status.wasm"
}
```

## Usage

### Basic Status Management

```bash
PLUGIN_PATH="file:$HOME/.config/zellij/plugins/zellij-tab-status.wasm"

# Set status emoji: "my-tab" β†’ "πŸ€– my-tab"
zellij pipe --plugin "$PLUGIN_PATH" -- '{"pane_id": "'$ZELLIJ_PANE_ID'", "action": "set_status", "emoji": "πŸ€–"}'

# Change status: "πŸ€– my-tab" β†’ "βœ… my-tab"
zellij pipe --plugin "$PLUGIN_PATH" -- '{"pane_id": "'$ZELLIJ_PANE_ID'", "action": "set_status", "emoji": "βœ…"}'

# Clear status: "βœ… my-tab" β†’ "my-tab"
zellij pipe --plugin "$PLUGIN_PATH" -- '{"pane_id": "'$ZELLIJ_PANE_ID'", "action": "clear_status"}'
```

### Rename Tab (Preserving Status)

```bash
# Rename tab without losing emoji: "πŸ€– my-tab" β†’ "πŸ€– new-name"
zellij pipe --plugin "$PLUGIN_PATH" -- '{"pane_id": "'$ZELLIJ_PANE_ID'", "action": "set_name", "name": "new-name"}'
```

### Query

```bash
# Get current emoji (outputs to stdout)
zellij pipe --plugin "$PLUGIN_PATH" -- '{"pane_id": "'$ZELLIJ_PANE_ID'", "action": "get_status"}'
# Output: πŸ€–

# Get base name without emoji
zellij pipe --plugin "$PLUGIN_PATH" -- '{"pane_id": "'$ZELLIJ_PANE_ID'", "action": "get_name"}'
# Output: my-tab

# Get installed plugin version
zellij pipe --plugin "$PLUGIN_PATH" -- '{"pane_id": "'$ZELLIJ_PANE_ID'", "action": "get_version"}'
# Output: 0.7.1
```

## Status Emoji Examples

| Status | Emoji | Use Case |
|--------|-------|----------|
| Working | πŸ€– | Processing task |
| Waiting | ⏳ | Long operation |
| Input needed | βœ‹ | Requires user input |
| Success | βœ… | Task completed |
| Error | ❌ | Task failed |
| Warning | ⚠️ | Attention needed |
| Building | πŸ”¨ | Compilation |
| Testing | πŸ§ͺ | Running tests |
| Deploying | πŸš€ | Deployment in progress |

## CLI Scripts

Ready-to-use wrapper scripts are included in `scripts/`:

### Install scripts

```bash
# Copy to ~/.local/bin (or anywhere in PATH)
cp scripts/zellij-tab-status ~/.local/bin/
chmod +x ~/.local/bin/zellij-tab-status
```

### Usage

```bash
zellij-tab-status πŸ€– # Set status emoji
zellij-tab-status ⏳ # Change status
zellij-tab-status --clear # Remove status
zellij-tab-status # Get current emoji
zellij-tab-status --name # Get base name
zellij-tab-status -s "Code" # Rename tab (preserving emoji)
zellij-tab-status --version # Get plugin version
```

### Shell aliases (optional)

Add to `~/.bashrc` or `~/.zshrc`:

```bash
alias ts='zellij-tab-status'
alias tsc='zellij-tab-status --clear'
alias tsn='zellij-tab-status --name'
alias tsr='zellij-tab-status --set-name'
```

## Integration Examples

### Show Status During Long Commands

```bash
# Wrapper for long-running commands
with-status() {
local emoji="${1:-πŸ€–}"
shift
zellij-tab-status "$emoji"
"$@"
local exit_code=$?
if [[ $exit_code -eq 0 ]]; then
zellij-tab-status βœ…
else
zellij-tab-status ❌
fi
return $exit_code
}

# Usage
with-status πŸ”¨ make build
with-status πŸ§ͺ npm test
with-status πŸš€ ./deploy.sh
```

### Git Hook Integration

```bash
# .git/hooks/pre-commit
#!/bin/bash
zellij-tab-status πŸ”
# ... run checks ...
```

### CI/CD Status Display

```bash
#!/bin/bash
zellij-tab-status πŸš€
if deploy_to_staging; then
zellij-tab-status βœ…
echo "Deploy successful"
else
zellij-tab-status ❌
echo "Deploy failed"
exit 1
fi
```

### Claude Code Integration

This plugin works with [zellij-tab-claude-status](https://github.com/dapi/claude-code-marketplace/tree/master/zellij-tab-claude-status) β€” a Claude Code plugin that shows AI session state in Zellij tabs:

- 🟒 Ready β€” waiting for input
- πŸ€– Working β€” processing request
- βœ‹ Needs input β€” permission prompt waiting

## API Reference

### `tab-status` Pipe

JSON payload with `pane_id` and `action`:

| Action | Required Fields | Description |
|--------|-----------------|-------------|
| `set_status` | `emoji` | Set emoji prefix on tab |
| `clear_status` | β€” | Remove emoji prefix |
| `get_status` | β€” | Output current emoji to stdout |
| `get_name` | β€” | Output base name (without emoji) to stdout |
| `set_name` | `name` | Set tab name, preserving emoji prefix |
| `get_version` | β€” | Output plugin version to stdout |

### Status Format

Status = first grapheme cluster + space.

| Tab Name | Status | Base Name |
|----------|--------|-----------|
| `πŸ€– Working` | `πŸ€–` | `Working` |
| `πŸ‡ΊπŸ‡Έ USA` | `πŸ‡ΊπŸ‡Έ` | `USA` |
| `Working` | `` (empty) | `Working` |

## Troubleshooting

### Check Plugin Logs

```bash
tail -f /tmp/zellij-$(id -u)/zellij-log/zellij.log | grep tab-status
```

### Plugin Not Responding

1. Verify plugin is loaded: run `zellij-tab-status --version` or check Zellij logs for `[tab-status] Plugin loaded`
2. Check `$ZELLIJ_PANE_ID` is set (only works inside Zellij)
3. Restart Zellij session after config changes

### Wrong Tab Updated

Plugin maps `pane_id` β†’ tab. If you have multiple panes in a tab, any pane_id from that tab will update the same tab name.

### Unicode Issues

Plugin uses grapheme clustering. If emoji appears broken:
- Ensure terminal supports Unicode
- Check font has emoji glyphs
- Try simpler emoji (🟒 instead of πŸ‘¨β€πŸ‘©β€πŸ‘§)

### Preloaded Mode (Optional)

If you want to target plugin by name (`--name tab-status`) instead of `--plugin`,
add the plugin to `~/.config/zellij/config.kdl`:
```kdl
load_plugins {
"file:~/.config/zellij/plugins/zellij-tab-status.wasm"
}
```

## Development

```bash
# Build
make build

# Install locally
make install

# Clean
make clean

# Run unit tests
make test

# Test in live Zellij session (after make install)
make test-live

# Integration tests (mode: preloaded|ondemand)
make test-integration
TEST_PLUGIN_MODE=ondemand make test-integration

# Verify on-demand --plugin does not duplicate plugin instance
make test-plugin-dedup

# Regression check for issue #5 (floating panel input)
make test-issue5-regression
```

## License

MIT