Skip to content

feat(desktop): Linux support on desktop/windows (consolidate #9503 #9963 #8415) - #10096

Merged
Git-on-my-level merged 5 commits into
mainfrom
consolidation/linux-electron
Jul 25, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
consolidation/linux-electron

Conversation

@undivisible

@undivisible undivisible commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

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

Review in cubic

@undivisible

Copy link
Copy Markdown
Collaborator Author

@velinxs @ZachL111 @palontologist

Credit for the Linux desktop work consolidated here (from #9503, #8415, #9963). Feat commit has Co-authored-by trailers for all three.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — the consolidation approach (platform seam on desktop/windows instead of a forked tree, with co-author credit for the three community PRs) is the right call, and the Linux adapters degrade gracefully throughout. The architecture is sound.

One blocker before this can land: the Typecheck · Lint · Test CI check is failing because of two ESLint errors this PR introduces:

src/main/usage/nativeForeground.ts:45:19  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
src/main/usage/userAssistRegistry.ts:46:19  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports

The lazy require('koffi') is the right idea (it keeps nativeForeground importable off-Windows), but it trips the @typescript-eslint/no-require-imports rule. The usual fix is a scoped eslint-disable on each line:

// eslint-disable-next-line @typescript-eslint/no-require-imports
const koffi = require('koffi') as typeof import('koffi')

That clears the two errors (the 384 prettier warnings are pre-existing in untouched files and remain non-blocking). Once CI goes green this is in good shape for a maintainer to merge.

A couple of non-blocking notes for a human maintainer:

  • LINUX.md is agent-/contributor-facing guidance, so it will shape how both AI coding agents and humans set up and reason about the Linux build here. The content looks accurate and source-backed (graceful degradation paths, XWayland default, snap-confinement rationale all check out against the code). Worth a maintainer skim to bless it as canonical for the desktop/windows Linux story.
  • The OCR helper and linuxForeground shell-out paths all use argument arrays with execFileSync (no shell injection), enforce timeouts, and clean temp files in finally — good defensive posture.

The feature scope is coherent (one Linux desktop surface); no split needed. Human maintainer review requested before merge.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added needs-tests PR introduces logic that should be covered by tests docs-accuracy Documentation or committed reports need accuracy fixes needs-maintainer-review Needs a human maintainer to sign off before merge labels Jul 20, 2026
undivisible pushed a commit that referenced this pull request Jul 20, 2026
…o-require-imports

Clears the 2 ESLint errors blocking #10096 CI (nativeForeground.ts:45,
userAssistRegistry.ts:46). The lazy require keeps nativeForeground importable
off-Windows; scoped disable is the maintainer-suggested fix.
undivisible added a commit that referenced this pull request Jul 20, 2026
…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. -->
@undivisible

Copy link
Copy Markdown
Collaborator Author

Current head already includes e4ef1b1 for the lazy koffi imports. bun run lint, Node typecheck, and the focused foreground tests pass.

@Git-on-my-level

Copy link
Copy Markdown
Member

Linux support evidence update

The current lazy-koffi lint repair is good, and the platform-seam approach remains preferred over a forked Linux desktop tree. Before this can claim supported Linux behavior, please add a maintained Linux validation route:

  • Ubuntu package/build and helper-protocol smoke coverage, and
  • real Linux launch, OCR, and foreground-detection evidence (including the documented X11/Wayland degradation paths).

The current Windows-oriented checks and focused mocked tests do not validate the claimed AppImage/deb/X11 runtime surface.

@undivisible

Copy link
Copy Markdown
Collaborator Author

Added the maintained Ubuntu validation route in 08b388c: AppImage/deb packaging, helper inclusion/dependency inspection, Xvfb launch, real X11 foreground + Tesseract OCR helper smoke, and Wayland-degradation contracts. Local typecheck, 605 tests, and Linux packaging pass; native user-session/Wayland evidence remains unavailable because the documented Linux host is unreachable.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pushing this forward — the current head resolves the earlier lazy-koffi lint blocker, and the new Ubuntu package/helper smoke path is a solid step for Linux packaging + OCR coverage.

One remaining blocker before this should be treated as supported Linux desktop behavior: the final CI workflow no longer exercises real X11 foreground detection. Patch 08 added an openbox/xterm title smoke, but the current head removes openbox, xterm, x11-utils, and OMI_HELPER_EXPECT_TITLE, while linuxHelper.integration.test.ts now only checks the helper's protocol shape + OCR. That leaves src/main/usage/linuxForeground.ts/nativeForeground.ts covered by parsers and mocks, not by a real xprop + /proc/<pid>/exe foreground smoke under Xvfb.

Because desktop/windows/LINUX.md is contributor- and agent-facing guidance, it will shape how human contributors and AI coding/review agents reason about Linux support in this repo. The doc currently says app-usage tracking works on Linux via X11; please either:

  • restore a maintained Ubuntu/Xvfb smoke that proves the real foreground path (for example install x11-utils plus a tiny X client/window manager and assert the observed title/process through the canonical nativeForeground/linuxForeground seam), or
  • narrow the Linux doc/status wording so foreground tracking is clearly marked as unit-tested/parser-covered but not yet runtime-smoked.

No split needed — this is a cohesive Linux desktop seam. Once that evidence/docs gap is closed, this should be ready for human maintainer review rather than another architecture debate.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

undivisible pushed a commit that referenced this pull request Jul 21, 2026
…o-require-imports

Clears the 2 ESLint errors blocking #10096 CI (nativeForeground.ts:45,
userAssistRegistry.ts:46). The lazy require keeps nativeForeground importable
off-Windows; scoped disable is the maintainer-suggested fix.
@undivisible
undivisible force-pushed the consolidation/linux-electron branch from 20746d4 to 7b218e1 Compare July 21, 2026 17:22
undivisible pushed a commit that referenced this pull request Jul 21, 2026
…o-require-imports

Clears the 2 ESLint errors blocking #10096 CI (nativeForeground.ts:45,
userAssistRegistry.ts:46). The lazy require keeps nativeForeground importable
off-Windows; scoped disable is the maintainer-suggested fix.
@undivisible
undivisible force-pushed the consolidation/linux-electron branch from 7b218e1 to 16c76d7 Compare July 21, 2026 18:35

@skanderkaroui skanderkaroui left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Linux support is well-guarded, safe in how it runs external tools, and degrades gracefully, and the privacy-safe default is a nice touch. Two small fixes: the Linux package is missing one dependency the window-detection feature needs, and a few files still load the Windows-only module even off Windows.

Comment thread desktop/windows/electron-builder.yml Outdated
- tesseract-ocr
- tesseract-ocr-eng
- libnotify4
- libxss1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 x11-utils (which provides xprop) is missing from depends. Active-window / usage tracking and the helper's window-info op call xprop, and LINUX.md lists active-window detection as a working feature — but a .deb install on a minimal system without x11-utils silently loses it. Since the deb already depends on tesseract for OCR, adding x11-utils here keeps the xprop path complete too. Degrades gracefully, so non-blocking.

@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@undivisible

Copy link
Copy Markdown
Collaborator Author

Addressed remaining review blockers on a932126efc:

  1. Added x11-utils to electron-builder.yml deb depends so packaged installs get xprop for active-window / usage tracking.
  2. Narrowed LINUX.md: X11 foreground / app-usage is unit/parser-covered and packaged with x11-utils, but not yet runtime-smoked under Xvfb in CI (OCR helper smoke remains). Status markers updated accordingly.

Ready for maintainer re-review.

@undivisible

Copy link
Copy Markdown
Collaborator Author

Follow-up: rebased onto current main to clear the merge conflict from the electron-builder.yml → electron-builder.config.mjs migration.

  • Ported Linux AppImage+deb targets and runtime depends (including x11-utils) into electron-builder.config.mjs (snap still omitted).
  • Merged helperProcess spawn: Linux still uses ELECTRON_RUN_AS_NODE; Windows keeps windowsHide.
  • Review fixes from the prior head (x11-utils + narrowed LINUX.md foreground evidence) are preserved.

SHA: see latest head.

Consolidate Linux desktop work as platform seams on desktop/windows
(not a forked desktop/linux tree), on main's electron-builder.config.mjs.

- X11 active-window via xprop + /proc; Tesseract OCR helper
- XWayland default + PipeWire; Wayland Rewind default off
- AppImage+deb (no snap); deb depends include x11-utils
- Lazy-require koffi so Linux import never loads Win32 native
- LINUX.md: foreground unit/parser-covered, not yet Xvfb-smoked

Failure-Class: none

Co-authored-by: velinxs <[email protected]>
Co-authored-by: ZachL111 <[email protected]>
Co-authored-by: palontologist <[email protected]>
Co-authored-by: Cursor <[email protected]>
@undivisible
undivisible force-pushed the consolidation/linux-electron branch from 50d79b8 to 4a81034 Compare July 24, 2026 05:13
@undivisible
undivisible requested a review from kodjima33 July 24, 2026 05:15
undivisible and others added 2 commits July 24, 2026 01:19
Allow committed asarUnpack globs to list optional platform-native
clipboard siblings while each host only installs one. Drift fails only
when fresh globs are missing from the committed list; completeness skips
optional siblings absent on the current OS.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
Make helperProcess spawn assertions platform-aware so Ubuntu CI passes,
and assert x11-utils is declared in the packaged .deb depends.

Co-authored-by: Cursor <[email protected]>
@undivisible

Copy link
Copy Markdown
Collaborator Author

Addressed the remaining review blockers on 22886dcf20:

Git-on-my-level (X11 foreground evidence) — chose the doc-narrowing path over restoring openbox/xterm Xvfb smoke (lighter, less flaky). LINUX.md already marks app-usage / X11 active-window as unit/parser-covered (linuxForeground.test.ts, foregroundMonitor.linux.test.ts, etc.) and not runtime-smoked under Xvfb in CI; OCR helper + app launch smoke remain in the Ubuntu workflow.

skander (x11-utils deb depends) — verified x11-utils is present in electron-builder.config.mjs deb.depends after the yml→mjs migration; CI now greps dpkg-deb -I dist/*.deb | grep x11-utils in the Linux package job.

Typecheck · Lint · Test — fixed helperProcess.test.ts to assert platform-specific spawn options (ELECTRON_RUN_AS_NODE on Linux, windowsHide on Windows) so Ubuntu CI no longer fails on the Windows-only expectation.

@Git-on-my-level ready for re-review.

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks for the follow-up — the prior Linux support blockers look addressed on the current head:

  • the lazy koffi import lint issue is fixed,
  • the .deb metadata includes and CI now verifies x11-utils, and
  • LINUX.md now clearly says the X11/app-usage foreground path is parser/unit-covered rather than runtime-smoked under Xvfb.

This is a positive signal on the implementation direction: keeping Linux as a desktop/windows platform seam is the right maintainability tradeoff, the helper/package smoke coverage is useful, and the foreground/OCR shell-outs use bounded execFileSync calls without shell interpolation.

One small docs-accuracy nit before treating desktop/windows/LINUX.md as canonical: the implementation note says resources/linux-ocr-helper/omi-ocr-helper is backed by xprop//proc for window info, but the helper's OP_WINDOW implementation currently returns empty metadata and the real foreground path lives in src/main/usage/linuxForeground.ts via nativeForeground.ts. Please reword that bullet so future contributors and AI coding/review agents do not look in the helper for foreground behavior.

Leaving this for human maintainer review before merge because it is a nontrivial desktop-platform feature and the current head still has unrelated Desktop Swift checks failing/cancelled. No split needed; the PR is cohesive around the Linux desktop seam.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level
Git-on-my-level dismissed stale reviews from themself July 24, 2026 09:33

Resolved on current head c6161ae: lazy-koffi lint fixed; Linux docs now mark foreground tracking as parser/unit-covered rather than runtime-smoked; x11-utils is declared and verified in package metadata. Superseded by latest maintainer-bot comment.

@Git-on-my-level
Git-on-my-level merged commit d660a1a into main Jul 25, 2026
29 checks passed
@Git-on-my-level
Git-on-my-level deleted the consolidation/linux-electron branch July 25, 2026 01:23
kodjima33 added a commit that referenced this pull request Jul 25, 2026
electron-builder.config.mjs declares a `publish` block (GitHub provider), so
electron-builder auto-publishes whenever it detects CI. The config comment
spells out the resulting invariant: every build command must pass
`--publish never`. `build:linux`, added with Linux support in #10096, did
not — so the "Linux package · helper smoke" job of Desktop Windows CI has
failed on every commit since d660a1a with:

  Error: GitHub Personal Access Token is not set, neither programmatically,
  nor using env "GH_TOKEN"

That job is a required check on every PR touching desktop/windows/**, so
main has been red and the lane blocking since 2026-07-25 01:23 UTC.

Add the flag to build:linux (build:mac had the same latent gap; no CI lane
runs it, but the invariant is the same) and add a guard test so a platform
build script cannot ship without it again. No release lane calls build:linux
or build:mac — the Windows release workflow invokes electron-builder
directly and already passes --publish never.

Failure-Class: none

Verified: pnpm vitest scripts/build-scripts-publish.test.mjs 4/4 pass; with
the flag reverted on build:linux the guard fails exactly on that script
(1 failed | 3 passed). prettier --check clean. End-to-end proof is the
Linux package job on this PR, which runs the identical `pnpm run build:linux`
command that is failing on main.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-accuracy Documentation or committed reports need accuracy fixes needs-maintainer-review Needs a human maintainer to sign off before merge needs-tests PR introduces logic that should be covered by tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants