fix: Linux GPU fallback and HUD window show safety net#264
Conversation
- Add Linux GPU config: use EGL (better Wayland compat), disable VAAPI video decoder/encoder (many distros ship broken drivers causing 'vaInitialize failed' and preventing renderer from loading) - Add ready-to-show fallback for HUD window: if did-finish-load never fires (GPU failure), show the window after 500ms via ready-to-show Ref #261
|
Warning
|
| Cohort / File(s) | Summary |
|---|---|
GPU Acceleration Configuration electron/main.ts |
Added a non-Windows/non-macOS branch in configureGpuAccelerationSwitches() that appends use-gl=egl and disable-features=VaapiVideoDecoder,VaapiVideoEncoder. |
HUD Window Display Handling electron/windows.ts |
Added a ready-to-show listener fallback that, after a 500ms timeout, calls show() and moveTop() for the HUD overlay if it's not destroyed and remains hidden, complementing the existing did-finish-load flow. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- webadderall/Recordly#157: Modifies
electron/windows.tsHUD overlay behavior (timing/show logic). - webadderall/Recordly#207: Modifies
electron/windows.tsdisplay-selection and positioning logic related to the HUD overlay.
Suggested labels
Checked
Poem
🐰 I hop through Linux fields of light,
EGL nets shimmer in the night,
VAAPI sleeps while frames glide free,
A HUD pops up — hi there, please see!
Half a second, then up we go. 🥕
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title accurately describes the main changes: Linux GPU fallback and HUD window show safety net. It directly relates to both key modifications in the changeset. |
| Description check | ✅ Passed | The description includes Summary, Root Cause analysis, and Changes sections that explain the problem and solution. However, it lacks sections from the template like Type of Change, Testing Guide, and Checklist. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
fix/linux-gpu-hud-fallback
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
electron/main.ts (1)
71-79: Remove the redundant Linux guard and trailing return for clarity.The explicit
if (process.platform === "linux")check and the trailingreturnat line 78 are redundant—bothdarwinandwin32branches already return, so execution only reaches this block on Linux (or unknown Unix variants). The function will return regardless.♻️ Suggested simplification
- // Linux: prefer EGL over GLX for better Wayland compatibility. - // Disable VAAPI — many distros ship broken drivers that cause - // "vaInitialize failed" and prevent the renderer from loading. - if (process.platform === "linux") { - app.commandLine.appendSwitch("use-gl", "egl"); - app.commandLine.appendSwitch("disable-features", "VaapiVideoDecoder,VaapiVideoEncoder"); - return; - } + // Linux (and other Unix): prefer EGL over GLX for better Wayland compatibility. + // Disable VAAPI — many distros ship broken drivers that cause + // "vaInitialize failed" and prevent the renderer from loading. + app.commandLine.appendSwitch("use-gl", "egl"); + app.commandLine.appendSwitch("disable-features", "VaapiVideoDecoder,VaapiVideoEncoder");
⚠️ Note:appendSwitch("disable-features", ...)overwrites previous values rather than merging them. If you later add anotherdisable-featuresentry on Linux, combine all features into a single comma-separated list (e.g.,"VaapiVideoDecoder,VaapiVideoEncoder,OtherFeature").🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@electron/main.ts` around lines 71 - 79, Remove the redundant platform guard and trailing return: delete the `if (process.platform === "linux") { ... return; }` wrapper so the EGL and VAAPI-disable switches are applied unconditionally in that branch code path (leave the calls to `app.commandLine.appendSwitch("use-gl", "egl")` and `app.commandLine.appendSwitch("disable-features", "VaapiVideoDecoder,VaapiVideoEncoder")`), and ensure any future additions to `disable-features` are merged into the same comma-separated string because `app.commandLine.appendSwitch("disable-features", ...)` overwrites prior values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@electron/main.ts`:
- Around line 71-79: Remove the redundant platform guard and trailing return:
delete the `if (process.platform === "linux") { ... return; }` wrapper so the
EGL and VAAPI-disable switches are applied unconditionally in that branch code
path (leave the calls to `app.commandLine.appendSwitch("use-gl", "egl")` and
`app.commandLine.appendSwitch("disable-features",
"VaapiVideoDecoder,VaapiVideoEncoder")`), and ensure any future additions to
`disable-features` are merged into the same comma-separated string because
`app.commandLine.appendSwitch("disable-features", ...)` overwrites prior values.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a59e9673-b48a-4646-ae54-112558b31f58
📒 Files selected for processing (2)
electron/main.tselectron/windows.ts
Summary
Fixes Linux startup issue where the app only appears in the system tray with no visible window.
Root Cause
Two problems:
No Linux GPU configuration —
configureGpuAccelerationSwitches()had branches for macOS (Metal) and Windows (D3D11) but fell through with no config for Linux. Many distros ship broken VAAPI drivers causingvaInitialize failederrors that prevent the Chromium renderer from loading.HUD window relies solely on
did-finish-load— the window is created withshow: falseand only shown insidedid-finish-load. If the renderer fails to load (GPU error), this event never fires, so the window stays invisible. Combined withskipTaskbar: true, there's no way for the user to see or interact with the app.Changes
Linux GPU config (
electron/main.ts)HUD window fallback (
electron/windows.ts)ready-to-showhandler as safety net: if window is not visible after 500ms, force-show itRef #261
Summary by CodeRabbit