How jhuow/openmathpix works
OpenMathpix is an Electron desktop snipping and OCR application. Users capture or paste an image, send it to a configured PaddleOCR pipeline, view LaTeX/Markdown/text or the original image, and can revisit saved results in History. Settings configure the endpoint, pipeline, output format, theme, and hotkey. The graph separates renderer UI, capture, main-process coordination, OCR integration, and persistence. Edges follow shown calls and documented workflow; some renderer-to-main links are evidenced by IPC usage rather than a directly shown end-to-end call.
Main entry points: App.tsx App shell · useOCR.ts Recognition flow · capture.ts Screen capture · ipc.ts IPC handlers
Components 20
Renderer UI
- App shell
src/renderer/App.tsx - Toolbar
src/renderer/components/Toolbar.tsx - Status bar
src/renderer/components/StatusBar.tsx - Recognition flow
src/renderer/hooks/useOCR.ts - Result tabs
src/renderer/pages/SnipResult.tsx - Format preview
src/renderer/components/Preview.tsx - Settings page
src/renderer/pages/Settings.tsx - History page
src/renderer/pages/History.tsx - UI state
src/renderer/store.ts
Screen Capture
- Selection overlay
src/renderer/overlay.ts - Screen capture
src/main/capture.ts
Main Process
- Electron coordinator
src/main/index.ts - Preload API
src/preload/index.ts - IPC handlers
src/main/ipc.ts - Shared IPC types
src/shared/types.ts
OCR Recognition
- PaddleOCR client
src/services/paddleocr.ts - PaddleOCR endpoint
Settings and History
- Encrypted settings
src/main/store.ts - Recognition history
src/main/db.ts
Other components
- Desktop user
Connections 25
- Desktop user → Toolbar: starts snip
README.md - Desktop user → Recognition flow: pastes image
README.md - Toolbar → Screen capture: requests snip
README.md - Electron coordinator → Screen capture: starts snip
src/main/index.ts - Screen capture → Selection overlay: sends screen data
src/main/capture.ts - Selection overlay → Screen capture: sends selection
src/main/capture.ts - Screen capture → Recognition flow: sends captured image
src/main/capture.ts - App shell → Recognition flow: uses recognition
src/renderer/App.tsx - App shell → Toolbar: renders
src/renderer/App.tsx - App shell → Status bar: renders
src/renderer/App.tsx - App shell → Result tabs: renders
src/renderer/App.tsx - App shell → Settings page: renders
src/renderer/App.tsx - App shell → History page: renders
src/renderer/App.tsx - Result tabs → Format preview: renders
src/renderer/pages/SnipResult.tsx - Recognition flow → UI state: updates results
src/renderer/hooks/useOCR.ts - Recognition flow → Preload API: invokes recognition
src/renderer/hooks/useOCR.ts - Preload API → IPC handlers: dispatches IPC
- IPC handlers → PaddleOCR client: calls recognition
src/main/ipc.ts - PaddleOCR client → PaddleOCR endpoint: posts image
src/services/paddleocr.ts - IPC handlers → Encrypted settings: reads settings
src/main/ipc.ts - IPC handlers → Recognition history: saves and queries
src/main/ipc.ts - Settings page → Preload API: uses settings API
README.md - History page → Preload API: uses history API
README.md - Electron coordinator → Encrypted settings: loads settings
src/main/index.ts - Electron coordinator → Recognition history: initializes history
src/main/index.ts