Desktop Shell and Workspace
This document covers the current shell and workspace flow in desktop/.
Scope
- Electron application shell
- window and menu setup
- preload API surface
- workspace opening
- workspace tree rendering
- document selection
Current State
- The app is a single Electron window.
- The shell layout has:
- top bar
- left workspace sidebar
- center editor panel with a single active document surface
- right sidebar with assistant and versions tabs
- Both side panels can be collapsed and reopened from icon controls in the top bar.
- The renderer is implemented in
React and TypeScript.
- The right sidebar hosts the live Codex assistant panel.
Menu and Native Entry Points
File > Open Folder... opens the native folder picker.
- Shortcut:
CmdOrCtrl+O
- The top-bar workspace button triggers the same workspace-opening flow.
Preload and Shared API
The renderer depends on window.mohio and does not access Node APIs directly.
Current API surface:
getAppInfo()
getCurrentWorkspace()
openWorkspace()
searchWorkspace(query)
readDocument(relativePath)
createDocument({ directoryRelativePath })
deleteDocument(relativePath)
saveDocument(input)
getPublishSummary()
syncWorkspaceChanges()
getAutoSyncStatus()
syncIncomingChanges(reason)
getSyncState()
resolveSyncConflict(input)
watchDocument(relativePath | null)
listAssistantThreads()
createAssistantThread()
getAssistantThread(threadId)
sendAssistantMessage(input)
cancelAssistantRun(threadId)
renameAssistantThread(input)
deleteAssistantThread(threadId)
onWorkspaceChanged(listener)
onDocumentChanged(listener)
onAssistantEvent(listener)
Workspace Enumeration
- A workspace is a local folder selected by the user.
- Indexed document extensions:
- Ignored directories:
.git
node_modules
dist
build
coverage
- Workspace nodes are sorted with directories first, then names alphabetically.
Workspace Tree Behavior
- The left sidebar renders tabbed views:
Documents for full tree
Search for live document search
- Tree document open behavior:
- single-click opens the document in the main editor surface
- right-click includes
Delete Document
- The
New Document action creates a markdown document in the selected document folder.
- If no document is selected,
New Document creates the document at workspace root.
- Directories are expanded by default after a workspace loads.
- Clicking a directory row toggles expansion.
- Clicking a document row selects that document.
- Right-clicking a document row opens a context menu with
Delete Document.
- The first document in the tree becomes the default selection after workspace load.
- Document rows display parsed titles when available.
Workspace States
No Workspace Open
- Left and right sidebars keep tab structure visible without workspace-empty placeholder copy.
- Center panel shows a single CTA to choose a folder.
- Search tab remains visible; its input is disabled until a folder is open.
Workspace With No Markdown Documents
- Left sidebar shows
No Markdown documents found.
- Center panel shows the workspace name and the same empty-content message.
Workspace With Documents
- The selected document loads into the single editor surface.
- Newly created documents are selected and opened immediately.
- The active row is highlighted in the workspace tree.
- The top bar keeps quick
New Document, manual Sync status action, and panel visibility controls.
- The right sidebar supports assistant and versions flows.
Search and Discovery
- Left-sidebar
Search tab includes a dedicated full-width input.
- Search is live and queries:
- file/path matches
- content matches with snippets
- Active query text is highlighted in the open editor with yellow in-document marks.
- Search input uses the native clear control provided by
type=\"search\" (when available).
- Internal Markdown and wiki links can be opened directly from the editor with
Cmd/Ctrl+Click.
Security Boundary
- The renderer is isolated from direct filesystem access.
- Workspace document access is validated in the main process.
- Paths outside the active workspace root are blocked.
Current Limitations
- No dedicated rename-document action beyond title-driven file rename
- Panel collapse state is session-local (not persisted across restart)
- History diff is rendered as raw patch text rather than a rich split diff
Code Anchors
- Main process workspace loading:
desktop/src/main/workspace.ts
- Menu wiring:
desktop/src/main/menu.ts
- Main process IPC and workspace state:
desktop/src/main/index.ts
- Shared API contract:
desktop/src/shared/mohio-api.ts
- Renderer workspace shell:
desktop/src/renderer/App.tsx