Overview
Implement the sidebar tree view matching the macOS app's SidebarViewController.swift.
Structure
The sidebar has two sections:
Navigation Tabs (top)
5 tabs matching macOS: Dashboard, Swarms, Prompts, Schedules, Agent Config. Use gtk::StackSwitcher or custom button row.
Tree View (main area)
Hierarchical list showing:
- Project (header row) — project name, "+" button for spawning
- Worktree (expandable) — name, branch badge, status dot, agent count
- Agent (leaf) — name, type icon, status dot (colored), prompt preview
- Agent Group (expandable) — multiple agents sharing a tmux window
- Terminal (leaf) — dashboard-created terminal sessions
Use gtk::ListBox with custom row widgets, or gtk::TreeView / gtk::ColumnView for the hierarchy.
Recommended: gtk::ListBox with indent levels
GTK4's ListView with TreeListModel is the modern approach:
let tree_model = gtk::TreeListModel::new(root_model, false, true, |item| {
// Return child model for expandable items
});
let selection = gtk::SingleSelection::new(Some(tree_model));
let list_view = gtk::ListView::new(Some(selection), Some(factory));
Status Indicators
Match macOS colors from PPG CLI/PPG CLI/Theme.swift:
- Running: green (#34D399)
- Completed: blue (#60A5FA)
- Failed: red (#F87171)
- Killed: orange (#FBBF24)
- Spawning: yellow (#FDE68A)
- Lost: gray (#9CA3AF)
- Waiting: purple (#A78BFA)
Context Menus
Right-click on:
- Worktree → New Agent, New Terminal, Delete
- Agent → Rename, Kill, Restart, Delete
- Agent Group → Rename, Delete All
- Project → Close Project
Incremental Updates
When manifest refreshes (via WS event or pull-to-refresh), diff against current tree and update in place — don't rebuild the entire tree. Match the applyTreeDiff pattern from the macOS sidebar.
References
- macOS:
PPG CLI/PPG CLI/SidebarViewController.swift (1418 lines)
- iOS:
ios/PPGMobile/PPGMobile/Views/Sidebar/SidebarView.swift
Acceptance Criteria
Overview
Implement the sidebar tree view matching the macOS app's
SidebarViewController.swift.Structure
The sidebar has two sections:
Navigation Tabs (top)
5 tabs matching macOS: Dashboard, Swarms, Prompts, Schedules, Agent Config. Use
gtk::StackSwitcheror custom button row.Tree View (main area)
Hierarchical list showing:
Use
gtk::ListBoxwith custom row widgets, orgtk::TreeView/gtk::ColumnViewfor the hierarchy.Recommended: gtk::ListBox with indent levels
GTK4's
ListViewwithTreeListModelis the modern approach:Status Indicators
Match macOS colors from
PPG CLI/PPG CLI/Theme.swift:Context Menus
Right-click on:
Incremental Updates
When manifest refreshes (via WS event or pull-to-refresh), diff against current tree and update in place — don't rebuild the entire tree. Match the
applyTreeDiffpattern from the macOS sidebar.References
PPG CLI/PPG CLI/SidebarViewController.swift(1418 lines)ios/PPGMobile/PPGMobile/Views/Sidebar/SidebarView.swiftAcceptance Criteria