Skip to content

[Linux] Session persistence + multi-project + manifest file watching #137

@2witstudios

Description

@2witstudios

Overview

Implement session persistence, multi-project support, and direct manifest file watching (inotify) to match macOS app behavior.

Session Persistence

Match PPG CLI/PPG CLI/DashboardSession.swift:

  • Persist terminal/agent entries and grid layouts to .ppg/dashboard-sessions.json
  • SessionData { entries: Vec<TerminalEntry>, gridLayouts: HashMap<String, GridLayoutNode> }
  • TerminalEntry { id, label, kind, parent_worktree_id, working_directory, command, tmux_target, session_id, grid_owner_entry_id, variant_id }
  • Debounced writes (1 second) via glib::timeout_add_seconds
  • Synchronous flush on app quit (connect_shutdown)
  • Restore sessions on relaunch: reconnect to tmux windows, rebuild pane grids

Multi-Project Support

Match PPG CLI/PPG CLI/Models.swift (OpenProjects):

  • Vec<ProjectContext> persisted to config dir
  • Each project has its own manifest, dashboard session, and manifest watcher
  • Sidebar shows all open projects' trees
  • Ctrl+1-9 switches to project's first item
  • "Open Project" action adds a project to the list
  • "Close Project" removes from list

Manifest File Watching

Match PPG CLI/PPG CLI/SidebarViewController.swift (ManifestWatcher):

  • Use gio::FileMonitor (wraps inotify on Linux) to watch .ppg/manifest.json
  • On change: debounce 200ms, then re-read manifest, apply tree diff to sidebar
  • Safety fallback: 3s polling timer in case inotify misses events (file recreated)
  • Also receive WebSocket manifest_updated events as a complement

Prerequisite Checks

Match PPG CLI/PPG CLI/SetupViewController.swift:

  • On launch, check ppg --version and tmux -V (tmux ≥ 3.5)
  • If missing: show setup screen with install instructions
  • ppg: npm install -g pure-point-guard
  • tmux: sudo apt install tmux / sudo dnf install tmux

Acceptance Criteria

  • Terminal entries + grid layouts persist to dashboard-sessions.json
  • Sessions restore on app relaunch
  • Multi-project: open/close projects, switch with Ctrl+1-9
  • Manifest file watching via inotify with 200ms debounce
  • 3s polling fallback for missed events
  • Prerequisites check screen shows when ppg/tmux missing

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions