Repository navigation
Conversation
Enables the Electron desktop app on Linux alongside the existing
Windows/macOS targets. Windows/koffi paths are untouched.
- linuxForeground.ts: X11 active-window via xprop + /proc/<pid>/exe; pure
parsers unit-tested, never throws, degrades when X11/xprop absent.
- nativeForeground.ts: process.platform==='linux' branch delegating to it.
- Linux OCR helper (resources/linux-ocr-helper/omi-ocr-helper): Node script
speaking the exact win-ocr-helper stdio frame protocol, backed by tesseract;
resolveHelperPath returns it on Linux.
- index.ts: on Linux default to XWayland (ozone-platform=x11) so global
shortcuts + X11 active-window work; OMI_OZONE=wayland to override. Enable
the PipeWire capturer for portal-based capture.
- rewindSettings.ts: on a Wayland session, continuous Rewind capture defaults
OFF (the desktop portal re-prompts every frame; Electron has no persisted
consent). On-demand 'what's on my screen' still works with one Share prompt.
- LINUX.md: build/run/deps (xprop, tesseract-ocr) + Wayland behavior.
- Tests: linuxForeground, nativeForeground linux/degrade, rewindSettings wayland.
Verification: built + launched on Ubuntu 24 GNOME on both X11 and Wayland
sessions; confirmed active-window tracking, screen OCR ('what's on my screen'),
and global shortcuts. Under native Wayland shortcuts failed (8x) and the app
was invisible to X11 tooling; forcing XWayland fixed both (0 failures).
Full suite: 571 passed / 3 skipped; lint + typecheck clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Thanks @velinxs — this is a genuinely strong first contribution. Linux support is a natural target for Omi, and the implementation is cohesive and careful. A few notes for the human maintainer: What looks good: the OCR helper correctly reuses the existing Things to verify before merge:
Heads-up for AI-agent-aware review: this PR adds Not approving — this is a new platform target (a product/maintenance decision) and touches screen capture / OCR / active-window tracking, so it needs a human maintainer's sign-off. Tagging |
Addresses review feedback on BasedHardware#9503: - helperProcess.ts: spawn the Linux OCR helper with Electron's bundled Node (process.execPath + ELECTRON_RUN_AS_NODE=1) instead of relying on the '#!/usr/bin/env node' shebang finding a system node — so packaged AppImage/deb builds work without node installed. Verified: helper spawns under Electron-node and replies over the frame protocol. - electron-builder.yml: drop the 'snap' Linux target. Snap's strict confinement blocks xprop/tesseract//proc, silently degrading active-window + OCR. Ship AppImage + deb (unconfined). - LINUX.md: frame the test result as reproducible ('npm test') rather than a hardcoded count, and document the Electron-node spawn + AppImage/deb targets. Full suite: 571 passed / 3 skipped; lint + typecheck clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Thanks for the thorough review — all three pre-merge items are addressed in the latest commit (
Fully understood on the human-maintainer sign-off for a new platform target + screen-capture surface. Let me know if you'd like this split into smaller PRs (e.g. active-window vs OCR helper) or a tracking issue for the deferred follow-ups (tray/Quit, native-Wayland capture, packaging). Thanks again. |
|
Thanks for the update, @velinxs. The latest commit addresses the concrete packaging concerns I raised: using Electron's bundled Node for the Linux OCR helper removes the packaged-system- Maintainer-facing follow-up: I still would not formally approve this automatically because it is a new desktop platform target and affects screen/OCR/foreground-window behavior. It should get human maintainer sign-off on product/maintenance direction plus one trusted reproduction pass for Linux tests/build/launch. I don't think this needs to be split just for size; it is cohesive around Linux desktop support. If maintainers want to reduce risk, a focused checklist is probably enough: AppImage/deb packaging includes AI-agent/docs note: Positive signal from me on the implementation direction, with |
|
Hey @velinxs 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Consolidate Linux desktop work as platform seams on desktop/windows (not a forked desktop/linux tree). From #9503 (primary): - X11 active-window via xprop + /proc - Tesseract OCR helper speaking win-ocr-helper protocol - XWayland default + PipeWire capturer - Wayland continuous Rewind default off - AppImage+deb targets (no snap) From #8415: - PulseaudioLoopbackForScreenShare for system-audio loopback - deb runtime depends (tesseract, libnotify, libxss) From #9963: - architecture validation only (forked tree rejected as drift) Also: lazy-require koffi so Linux import of nativeForeground never loads the Win32 native module (fixes linux unit tests off-Windows). Verification: vitest 21/21 on linuxForeground, nativeForeground linux/degrade, rewindSettings wayland. Failure-Class: none Co-authored-by: velinxs <[email protected]> Co-authored-by: ZachL111 <[email protected]> Co-authored-by: palontologist <[email protected]>
…10110) ## Summary Adds a scoped `// eslint-disable-next-line @typescript-eslint/no-require-imports` above the two lazy `require('koffi')` calls (nativeForeground.ts:45, userAssistRegistry.ts:46) so the **Desktop Windows CI / Typecheck · Lint · Test** check goes green on #10096. The lazy require is the right idea (keeps `nativeForeground` importable off-Windows); it just trips the `no-require-imports` rule. This is the exact fix the maintainer requested in the #10096 review. ## Test plan - `cd desktop/windows && npx eslint src/main/usage/nativeForeground.ts src/main/usage/userAssistRegistry.ts` → no `no-require-imports` errors. - Part of the consolidated Linux PR #10096 (supersedes #9503/#9963/#8415). ## Notes Pushed from the `consolidation/linux-electron` HEAD. Intended to be merged into that branch (or squashed into its feat commit) so #10096 can land. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/10110?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Consolidate Linux desktop work as platform seams on desktop/windows (not a forked desktop/linux tree). From #9503 (primary): - X11 active-window via xprop + /proc - Tesseract OCR helper speaking win-ocr-helper protocol - XWayland default + PipeWire capturer - Wayland continuous Rewind default off - AppImage+deb targets (no snap) From #8415: - PulseaudioLoopbackForScreenShare for system-audio loopback - deb runtime depends (tesseract, libnotify, libxss) From #9963: - architecture validation only (forked tree rejected as drift) Also: lazy-require koffi so Linux import of nativeForeground never loads the Win32 native module (fixes linux unit tests off-Windows). Verification: vitest 21/21 on linuxForeground, nativeForeground linux/degrade, rewindSettings wayland. Failure-Class: none Co-authored-by: velinxs <[email protected]> Co-authored-by: ZachL111 <[email protected]> Co-authored-by: palontologist <[email protected]>
Consolidate Linux desktop work as platform seams on desktop/windows (not a forked desktop/linux tree). From #9503 (primary): - X11 active-window via xprop + /proc - Tesseract OCR helper speaking win-ocr-helper protocol - XWayland default + PipeWire capturer - Wayland continuous Rewind default off - AppImage+deb targets (no snap) From #8415: - PulseaudioLoopbackForScreenShare for system-audio loopback - deb runtime depends (tesseract, libnotify, libxss) From #9963: - architecture validation only (forked tree rejected as drift) Also: lazy-require koffi so Linux import of nativeForeground never loads the Win32 native module (fixes linux unit tests off-Windows). Verification: vitest 21/21 on linuxForeground, nativeForeground linux/degrade, rewindSettings wayland. Failure-Class: none Co-authored-by: velinxs <[email protected]> Co-authored-by: ZachL111 <[email protected]> Co-authored-by: palontologist <[email protected]>
#8415) (#10096) ## Summary Consolidates the three open Linux desktop PRs into one landable path: | PR | Approach | Verdict | |---|---|---| | #9503 | Platform seams on `desktop/windows` (+473) | **Primary** — keep | | #8415 | Forked `desktop/Linux` tree (+24k) | Port **Pulse loopback + deb depends** only | | #9963 | Forked `desktop/linux` tree (+58k, ~75% Windows copy) | Reject fork; product extras (sign avatar / monologur) stay follow-ups | Architecture: **one Electron tree** (`desktop/windows`) with `process.platform` branches. No `desktop/linux` / `desktop/Linux` fork — those drift from Windows immediately and double maintenance. ### What lands **From #9503** - X11 active-window (`linuxForeground.ts` via `xprop` + `/proc`) - Tesseract OCR helper speaking `win-ocr-helper` stdio protocol (`resources/linux-ocr-helper/omi-ocr-helper`) - XWayland default (`OMI_OZONE=wayland` override) + PipeWire capturer - Wayland: continuous Rewind capture defaults **off** - Linux targets: AppImage + deb (snap dropped — confinement blocks xprop/tesseract) **From #8415** - `PulseaudioLoopbackForScreenShare` for system-audio loopback - `.deb` depends: `tesseract-ocr`, `tesseract-ocr-eng`, `libnotify4`, `libxss1` **Fix on top of #9503** - Lazy-`require('koffi')` so Linux import of `nativeForeground` never loads Win32 native module (unit tests were broken off-Windows) ## Tests ``` cd desktop/windows npx vitest run \ src/main/usage/linuxForeground.test.ts \ src/main/usage/nativeForeground.linux.test.ts \ src/main/usage/nativeForeground.degrade.test.ts \ src/main/rewind/rewindSettings.wayland.test.ts # → 22/21+ focused Linux tests (includes foregroundMonitor.linux) ``` ## Product invariants None. Path globs under `desktop/windows` for Linux seams only. ## Credits Consolidated from community PRs (code selected into `desktop/windows` seams; forked trees not re-merged): | PR | Author | Role | |---|---|---| | #9503 | @velinxs | Primary Linux platform seams (X11, OCR helper, XWayland, Wayland Rewind default) | | #8415 | @ZachL111 | Pulse loopback flag + deb depends (from Linux packaging work) | | #9963 | @palontologist | Architecture reference; full `desktop/linux` fork not adopted | Git trailers on the feat commit: `Co-authored-by` for all three. Failure-Class: none Closes #9503 Closes #9963 Closes #8415 <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/10096?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
What changed and why
Enables the Electron desktop app on Linux, alongside the Windows/macOS targets it already builds for (
build:linuxis already inelectron-builder.yml). The Windows/koffi paths are untouched. Adds X11 active-window detection, a Tesseract-backed OCR helper that speaks the existingwin-ocr-helperstdio protocol, and Wayland-session handling.linuxForeground.ts— X11 active-window viaxprop+/proc/<pid>/exe; pure parsers unit-tested, never throws, degrades when X11/xprop are absent.nativeForeground.ts— adds aprocess.platform === 'linux'branch; win32 path unchanged.resources/linux-ocr-helper/omi-ocr-helper) — Node script speaking the exactocr/helperProtocol.tsframe protocol, backed by thetesseractCLI;resolveHelperPathreturns it on Linux.index.ts— on Linux, default to XWayland (ozone-platform=x11) so global shortcuts + the X11 active-window path work on Wayland sessions;OMI_OZONE=waylandto override. Enables the PipeWire capturer for portal-based capture.rewindSettings.ts— on a Wayland session, continuous Rewind capture defaults off (the desktop portal re-prompts for consent every frame; Electron exposes no persisted-consent path). On-demand "what's on my screen" still works with one Share prompt.LINUX.md— build/run/deps (xprop,tesseract-ocr) + Wayland behavior.Product invariants affected
None. No invariant in
docs/product/invariants/globsdesktop/windows/src/main/{usage,ocr,rewind}orindex.ts.How it was verified
Built and launched on Ubuntu 24 / GNOME, on both X11 and Wayland sessions, and exercised the real user-facing paths:
xpropactive-window).omi-ocr-helper→ Tesseract), verified by feeding a real desktop capture through the helper over the frame protocol.cd desktop/windows && npm test→ 571 passed / 3 skipped;npm run typecheckandnpx eslintclean.Tests
linuxForeground.test.ts— xprop output parsers +/proc/<pid>/exeresolver.nativeForeground.linux.test.ts/nativeForeground.degrade.test.ts— the Linux branch returns real data when X11 is available, and the off-platform contract still degrades to nulls/no-ops.rewindSettings.wayland.test.ts— continuous-capture default is off on Wayland, on elsewhere.Scoped cleanups
None.
Follow-ups (intentionally not in this PR, to keep it focused): system-tray/Quit affordance on Linux, native-Wayland screen capture (portal restore-token so continuous Rewind can run without per-frame prompts), and packaging polish. Happy to split further or open a tracking issue if maintainers prefer.