How flplima/tmuxy works
Purpose and Delivery Modes
tmuxy is a GUI layer over tmux: it observes and controls existing tmux sessions while adding browser-native UI features such as pane groups, floating panes, rich widgets, and image rendering. It ships as a web application backed by HTTP/SSE and as a Tauri desktop application using local IPC. Core workspace and package boundaries are defined by Cargo.toml, packages/tmuxy-ui/, and packages/tmuxy-tauri-app/.
Entry Points and Launch Topology
Rust binaries provide the backend, connector, desktop app, and tree utility: packages/tmuxy-server/src/main.rs, packages/tmuxy-connect/src/main.rs, packages/tmuxy-tauri-app/src/main.rs, and packages/tmuxy-tree/src/main.rs. The browser UI boots from packages/tmuxy-ui/src/main.tsx; shell entrypoints in bin/dev, bin/prod, and bin/build-tauri orchestrate development and packaging. A separate Next-based public demo lives in packages/tmuxy-demo/app/page.tsx.
tmux Core: Control Mode to Authoritative State
packages/tmuxy-core/ is the central Rust domain layer. It connects to tmux control mode, parses its protocol and terminal-related extensions, aggregates state, and executes tmux commands. The critical pipeline is represented by packages/tmuxy-core/src/control_mode/connection.rs, packages/tmuxy-core/src/control_mode/parser.rs, and packages/tmuxy-core/src/control_mode/state.rs. Service/session coordination and command execution sit at packages/tmuxy-core/src/tmux_service.rs, packages/tmuxy-core/src/session.rs, and packages/tmuxy-core/src/executor.rs.
Network Server Boundary
The web backend exposes the core through HTTP commands and Server-Sent Events. packages/tmuxy-server/src/server.rs owns server setup, packages/tmuxy-server/src/command.rs maps client operations to core actions, and packages/tmuxy-server/src/sse.rs streams state/events to clients. packages/tmuxy-server/src/auth.rs is the security boundary for remote access. The web client should treat this API as asynchronous, streamed transport rather than direct tmux access.
Desktop IPC Boundary
The Tauri app reuses the Rust core but bypasses HTTP/SSE for local IPC. packages/tmuxy-tauri-app/src/gui.rs initializes desktop-facing application behavior, packages/tmuxy-tauri-app/src/commands.rs exposes invokeable commands, and packages/tmuxy-tauri-app/src/monitor.rs connects monitoring/state propagation. Capabilities are constrained through packages/tmuxy-tauri-app/capabilities/default.json.
UI State, Transport, and Rendering
The React/Vite frontend is structured around an application state machine and a tmux model/store. packages/tmuxy-ui/src/machines/app/appMachine.ts coordinates UI modes and user workflows; packages/tmuxy-ui/src/machines/actors/tmuxActor.ts binds transport updates into UI control flow; packages/tmuxy-ui/src/tmux/store/TmuxStore.ts owns client-side tmux state and operations. Transport adapters support web, desktop-compatible abstractions, demo, and local emulation: packages/tmuxy-ui/src/tmux/HttpAdapter.ts, packages/tmuxy-ui/src/tmux/effect/EffectTmuxAdapter.ts, and packages/tmuxy-ui/src/tmux/v86/V86TmuxAdapter.ts.
Interaction and Terminal Presentation
packages/tmuxy-ui/src/App.tsx composes the application shell. Layout and pane presentation are centered on packages/tmuxy-ui/src/components/PaneLayout.tsx, packages/tmuxy-ui/src/components/TerminalPane.tsx, and packages/tmuxy-ui/src/components/ScrollbackTerminal.tsx. Input flows from keyboard/mouse actors through tmux adapters, while streamed terminal deltas update the client store and trigger pane rendering. Rich non-terminal content is an explicit extension boundary via packages/tmuxy-ui/src/components/WidgetPane.tsx and packages/tmuxy-ui/src/components/widgets/.
Runtime and External Dependencies
Primary runtimes are Rust for tmux integration/server/desktop services and TypeScript/React in the frontend. tmux itself, specifically control mode, is the fundamental external system. Web mode requires an HTTP/SSE-capable browser and server; desktop mode requires Tauri. The optional browser-local v86 path supports tmux emulation/demo behavior. CI builds and deploys through .github/workflows/build-app.yml and .github/workflows/deploy-demo.yml.
Main entry points: tmux_service.rs tmux service · tmuxActor.ts tmux actor · command.rs HTTP commands · commands.rs Tauri commands
Components 22
tmux Core
Rust domain layer and authoritative tmux state.
- Control connection
packages/tmuxy-core/src/control_mode/connection.rs - Control parser
packages/tmuxy-core/src/control_mode/parser.rs - Authoritative state
packages/tmuxy-core/src/control_mode/state.rs - tmux service · Coordinates sessions and state.
packages/tmuxy-core/src/tmux_service.rs - Command executor
packages/tmuxy-core/src/executor.rs
Web Backend
HTTP and SSE boundary for browser clients.
- Server runtime
packages/tmuxy-server/src/server.rs - Remote auth
packages/tmuxy-server/src/auth.rs - HTTP commands
packages/tmuxy-server/src/command.rs - SSE event stream
packages/tmuxy-server/src/sse.rs
Tauri Desktop
Local IPC boundary for the desktop runtime.
- Tauri GUI runtime
packages/tmuxy-tauri-app/src/gui.rs - Tauri commands · Invokeable desktop commands.
packages/tmuxy-tauri-app/src/commands.rs - Desktop monitor
packages/tmuxy-tauri-app/src/monitor.rs
React UI
Shared frontend state, transport, and rendering.
- UI bootstrap
packages/tmuxy-ui/src/main.tsx - Application shell
packages/tmuxy-ui/src/App.tsx - App state machine · Coordinates UI modes and workflows.
packages/tmuxy-ui/src/machines/app/appMachine.ts - tmux actor · Binds transport updates into UI control flow.
packages/tmuxy-ui/src/machines/actors/tmuxActor.ts - Client tmux store · Owns client-side tmux state and operations.
packages/tmuxy-ui/src/tmux/store/TmuxStore.ts - HTTP adapter
packages/tmuxy-ui/src/tmux/HttpAdapter.ts - Effect adapter
packages/tmuxy-ui/src/tmux/effect/EffectTmuxAdapter.ts - Pane layout
packages/tmuxy-ui/src/components/PaneLayout.tsx - Terminal presentation · Renders panes and scrollback updates.
packages/tmuxy-ui/src/components/TerminalPane.tsx
Other components
- tmux control mode · Authoritative terminal multiplexer.
Connections 25
- tmux control mode → Control connection: control protocol
- Control connection → Control parser: raw messages
- Control parser → Authoritative state: parsed events
- Authoritative state → tmux service: state updates
- tmux service → Command executor: operations
- Command executor → tmux control mode: tmux commands
- Server runtime → Remote auth: protects remote access
- Remote auth → HTTP commands: authorized requests
- HTTP commands → tmux service: core actions
- tmux service → SSE event stream: state and events
- Tauri GUI runtime → Tauri commands: local invoke
- Tauri commands → tmux service: core actions
- tmux service → Desktop monitor: state changes
- UI bootstrap → Application shell: mounts
- Application shell → App state machine: UI workflows
- App state machine → tmux actor: control flow
- tmux actor → Client tmux store: streamed updates
- tmux actor → HTTP adapter: web mode
- HTTP adapter → HTTP commands: HTTP commands
- SSE event stream → HTTP adapter: SSE updates
- tmux actor → Effect adapter: desktop mode
- Effect adapter → Tauri commands: local IPC
- Desktop monitor → Effect adapter: state updates
- Client tmux store → Pane layout: pane state
- Pane layout → Terminal presentation: pane rendering