Skip to content

fix: Linux GPU fallback and HUD window show safety net#264

Merged
webadderall merged 2 commits into
mainfrom
fix/linux-gpu-hud-fallback
Apr 18, 2026
Merged

fix: Linux GPU fallback and HUD window show safety net#264
webadderall merged 2 commits into
mainfrom
fix/linux-gpu-hud-fallback

Conversation

@webadderall
Copy link
Copy Markdown
Collaborator

@webadderall webadderall commented Apr 18, 2026

Summary

Fixes Linux startup issue where the app only appears in the system tray with no visible window.

Root Cause

Two problems:

  1. No Linux GPU configurationconfigureGpuAccelerationSwitches() had branches for macOS (Metal) and Windows (D3D11) but fell through with no config for Linux. Many distros ship broken VAAPI drivers causing vaInitialize failed errors that prevent the Chromium renderer from loading.

  2. HUD window relies solely on did-finish-load — the window is created with show: false and only shown inside did-finish-load. If the renderer fails to load (GPU error), this event never fires, so the window stays invisible. Combined with skipTaskbar: true, there's no way for the user to see or interact with the app.

Changes

Linux GPU config (electron/main.ts)

  • Use EGL instead of GLX (better Wayland compatibility)
  • Disable VAAPI video decoder/encoder to avoid broken driver crashes

HUD window fallback (electron/windows.ts)

  • Add ready-to-show handler as safety net: if window is not visible after 500ms, force-show it
  • Guarded so it does not double-show on working systems

Ref #261

Summary by CodeRabbit

  • Bug Fixes
    • Optimized GPU acceleration on Linux/Unix by enabling EGL rendering and adjusting hardware video codec behavior to improve rendering stability and performance.
    • Improved HUD overlay reliability on Linux/Unix with a fallback display path ensuring overlay windows reliably appear during startup.

- 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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 18, 2026

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "*" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4e533ca8-d10c-4059-a1c4-f0266a036643

📥 Commits

Reviewing files that changed from the base of the PR and between d4a7c86 and 41249a9.

📒 Files selected for processing (1)
  • electron/main.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • electron/main.ts

📝 Walkthrough

Walkthrough

Adds Linux-specific GPU command-line switches (EGL and disabling VAAPI encoder/decoder) and a fallback BrowserWindow ready-to-show listener that shows and raises the HUD overlay after 500ms if still hidden.

Changes

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.ts HUD overlay behavior (timing/show logic).
  • webadderall/Recordly#207: Modifies electron/windows.ts display-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 ⚠️ Warning 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 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 trailing return at line 78 are redundant—both darwin and win32 branches 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 another disable-features entry 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

📥 Commits

Reviewing files that changed from the base of the PR and between 20231fb and d4a7c86.

📒 Files selected for processing (2)
  • electron/main.ts
  • electron/windows.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant