fix: Linux AppImage OAuth auth hang (#1525) - #1788
Open
carlosjarenom wants to merge 3 commits into
Open
Conversation
added 2 commits
July 19, 2026 12:43
- Add linuxProtocol.ts: writes ~/.local/share/applications/eigent-protocol-handler.desktop with Exec="<path>" %u and MimeType=x-scheme-handler/eigent; on every packaged Linux launch - Integrate in setupProtocolHandlers() and second-instance handler (self-heal) - Add mimeTypes to electron-builder.json for AppImage bundled .desktop Closes eigent-ai#1525
Incomplete string escaping: backslashes in executable path were not escaped, which could lead to shell interpretation issues in the .desktop file. Escapes both backslashes and double quotes now.
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.
Related Issue
Closes #1525
Description
Fixes the Linux auth hang where login stalls at "Logging in......." after the OAuth provider redirects back via `eigent://auth/callback?token=...`.
Root Cause
On Linux, `app.setAsDefaultProtocolClient` only invokes `xdg-mime default` against a `.desktop` file that must already exist — it does not create one. AppImage builds ship no such file, and users who author their own frequently omit the `%u/%U` field code. Without `%u`, `xdg-open` drops the `eigent://` URL before launching the app. The running instance's `second-instance` event then fires with a URL-less argv, so `handleProtocolUrl` is never called and the token never reaches the renderer.
Fix (3 changes)
New: `electron/main/utils/linuxProtocol.ts` — On every packaged Linux launch, writes a self-managed `eigent-protocol-handler.desktop` to `~/.local/share/applications/` with `Exec="" %u` and `MimeType=x-scheme-handler/eigent;`, then runs `update-desktop-database` and `xdg-mime default`. Prefers `$APPIMAGE` so registration survives AppImage version bumps; falls back to `process.execPath`. Skipped in dev mode (existing dev branch handles that). Re-registers on `second-instance` without URL (self-heal).
`electron/main/index.ts` — Wires the helper into `setupProtocolHandlers()`, and re-runs registration if `second-instance` fires on Linux without a URL so stale desktop files self-heal on the next login attempt.
`electron-builder.json` — Adds `mimeTypes: ["x-scheme-handler/eigent"]` to the Linux AppImage config so `appimaged`-managed installs pick up the association at install time.
Testing Evidence
Checklist