Files
socktop/zellij_socktop_plugin
jasonwitty f61b232e42 fix: untrack zellij plugin build dir; installer updates all PATH copies
- Remove zellij_socktop_plugin/target from git (3,577 files committed by
  accident in bf6ac87): the root .gitignore anchors /target to the repo
  root, so the standalone plugin's own build dir wasn't covered. Ignore
  target/ at any depth (also fixes the pre-existing
  '/socktop-wasm-test/target' entry, which pointed at a hyphenated path
  that doesn't exist).

- install.sh now updates EVERY copy of socktop/socktop_agent on PATH,
  not just $PREFIX: a stale 'cargo install' in ~/.cargo/bin shadows
  /usr/local/bin on most PATHs, so an install could 'succeed' while
  'socktop --version' kept reporting the old release. Extra copies that
  can't be written are warned about, not fatal, and the script now
  prints which binary is actually active on PATH at the end.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 10:23:45 -07:00
..
2025-09-10 09:32:00 -07:00

Zellij Socktop Plugin

A Zellij plugin that displays real-time system metrics from a socktop agent.

Quick Start

  1. Build the plugin:

    cargo build --target wasm32-wasi --release
    
  2. Install in Zellij:

    # Copy the WASM file to Zellij plugins directory
    mkdir -p ~/.config/zellij/plugins
    cp target/wasm32-wasi/release/zellij_socktop_plugin.wasm ~/.config/zellij/plugins/socktop.wasm
    cp plugin.yaml ~/.config/zellij/plugins/
    
  3. Use in Zellij layout:

    # ~/.config/zellij/layouts/socktop.yaml
    template:
      direction: Horizontal
      parts:
        - direction: Vertical
          borderless: true
          split_size:
            Fixed: 1
          run:
            plugin:
              location: "file:~/.config/zellij/plugins/socktop.wasm"
              configuration:
                server_url: "ws://localhost:3000/ws"
        - direction: Vertical
    
  4. Launch Zellij with the layout:

    zellij --layout socktop
    

Plugin Features

  • Real-time Metrics: Displays CPU and memory usage
  • Auto-refresh: Updates every 2 seconds
  • Reconnection: Press 'r' to reconnect to socktop agent
  • Configurable: Set custom server URL in plugin config
  • Error Handling: Shows connection status and errors

Configuration Options

  • server_url: WebSocket URL for socktop agent (default: ws://localhost:3000/ws)

Controls

  • r - Reconnect to socktop agent
  • Plugin updates automatically every 2 seconds

Development Notes

This is a scaffold implementation. To make it fully functional:

  1. Async Operations: Zellij plugins have limitations with async operations. You may need to:

    • Use a different async runtime or approach
    • Handle WebSocket connections in a background thread
    • Use message passing between threads
  2. Error Handling: Add more robust error handling for:

    • Network connectivity issues
    • Invalid server URLs
    • Agent unavailability
  3. UI Improvements:

    • Add more detailed metrics display
    • Implement scrolling for large datasets
    • Add color coding for status indicators
  4. Performance:

    • Implement caching to reduce agent requests
    • Add configurable update intervals
    • Optimize WASM binary size

Dependencies

  • zellij-tile: Zellij plugin framework
  • socktop_connector: WebSocket connector with WASM support
  • serde: JSON serialization
  • chrono: Time handling (WASM-compatible)

Building

# Add WASM target
rustup target add wasm32-wasi

# Build for WASM
cargo build --target wasm32-wasi --release

# The plugin will be at: target/wasm32-wasi/release/zellij_socktop_plugin.wasm