Fix Linux About dialog icon handling - #430
Merged
Merged
Conversation
ilysenko
marked this pull request as ready for review
June 8, 2026 06:45
ilysenko
approved these changes
Jun 8, 2026
ilysenko
left a comment
Owner
There was a problem hiding this comment.
Reviewed locally and against the current upstream DMG patch report. CI is green and no blockers were found.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
On Linux the About dialog showed no icon, or could crash with an uncaught promise rejection. This PR wires up a proper bundled icon path for Linux and adds null-safety guards on the icon return values so the dialog renders correctly regardless of which code path is taken.
Why it changed
The upstream About-dialog helper (
bZin the minified main bundle) unconditionally callsapp.getFileIconand then calls.isEmpty()on the result without guarding againstnull. On Linux:app.getFileIconcan reject on some desktop environments, leaving the icon promise unresolved or throwing.windowIconfield propagated downstream without a null check, sod.windowIcon.isEmpty()threw when the icon wasnull.Fw) or the system file-icon API, both of which are no-ops or failures on Linux.The patch (
applyLinuxAboutDialogPatch) addresses all three:Fwcall tonull.app.getFileIconcall withnativeImage.createFromPath(iconPathExpression)pointing at the bundledcontent/webview/assets/app-test.pngasset, wrapped in an IIFE that returnsnullon an empty image instead of propagating an emptyNativeImage.i.isEmpty()→i==null||i.isEmpty()andd.windowIcon.isEmpty()→d.windowIcon==null||d.windowIcon.isEmpty()andwindowIcon:i}→windowIcon:i??null}throughout the downstream spread.getFileIconon non-Linux paths gets.catch(()=>null)so a rejection no longer propagates.The patch is
ciPolicy: "optional"(fail-soft): if the minified bundle changes shape the dialog silently falls back to its previous behavior rather than breaking startup.Source-of-truth files changed
scripts/patches/main-process.js— newapplyLinuxAboutDialogPatchfunctionscripts/patches/core/all-linux/main-process/window-shell/patch.js— registers the patch descriptor (id: "linux-about-dialog", phasemain-bundle, order 55)scripts/patch-linux-window-ui.js— imports and re-exportsapplyLinuxAboutDialogPatchscripts/patch-linux-window-ui.test.js— adds the patch to the uniqueness registry test and adds a focused unit test covering the icon-path substitution, null-safe guards, and idempotencyValidation
All tests pass, including the new
"makes About dialog prefer the bundled Linux icon asset"case. The test covers:nativeImage.createFromPath(...)substitution present in patched outputprocess.platform===\linux`?null:...` short-circuit for the macOS thumbnail callwindowIcon==null||d.windowIcon.isEmpty()?{}:{icon:d.windowIcon}null guardi==null||i.isEmpty()?null:i.resize(null guardwindowIcon:i??nullcoalescingnew Function(patched)does not throw)Limitations / follow-up
content/webview/assets/app-test.png) is resolved at patch time fromcontext.iconPathExpression; if the upstream DMG renames the asset this patch will silently fall back. A follow-up could add a CI assertion that the asset path resolves.optionalpolicy; if the minified signature drifts significantly only the null-safety guards (string-replace based) will still apply.