fix(desktop): Niri/Hyprland - Linux secret storage backend#2916
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
ApprovabilityVerdict: Needs human review This PR introduces new Linux desktop environment detection logic and secret storage backend configuration, affecting application startup behavior. While framed as a fix, the scope includes new heuristics, new settings, and new command-line manipulation - constituting a new feature rather than a simple bug fix. You can customize Macroscope's approvability policy. Learn more. |
1ec83f0 to
57dcaa9
Compare
57dcaa9 to
9bf124e
Compare
c4ee8d6 to
5f02a0e
Compare
5f02a0e to
a8ab180
Compare
a8ab180 to
f38b824
Compare
f9c8c69 to
219f76d
Compare
219f76d to
7704609
Compare
61c6919 to
4b49244
Compare
d760719 to
0733d82
Compare
0733d82 to
9c0f415
Compare
9c0f415 to
7daa03d
Compare
There was a problem hiding this comment.
Effect Service Conventions: one finding — a standalone service-shape interface was introduced for a new Context.Service. See inline comment.
Posted via Macroscope — Effect Service Conventions
9b75d1c to
e030be2
Compare
e030be2 to
dde3435
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dde3435. Configure here.
Address Bugbot review: authoritative desktop hints and shell DBUS override
dde3435 to
e739ccb
Compare

Summary
Closes #2880.
This selects an encrypted Linux
safeStoragebackend before Electron is ready, so desktop SSH environment credentials and the encrypted connection catalog can be persisted on Linux sessions Electron does not recognize automatically.Upstream's Clerk bridge migration (
#3092) moved cloud auth offsafeStorage, butDesktopSavedEnvironmentsandDesktopConnectionCatalogStorestill depend on Electron's Linux password-store backend selection.Problem and Fix
basic_texton Linux sessions such as Niri or unversioned KDE/Plasma because the desktop name is not one of Electron's recognized backend selectors.password-storeswitch beforeapp.readyand default unknown non-KDE sessions tognome-libsecret, while using KWallet for KDE/Plasma sessions.linuxPasswordStoresetting synchronously during early Electron startup, with unsupported values normalized toautowithout dropping unrelated settings.password-storeswitch.Defensive Fixes
ready; Electron requires that registration synchronously at bootstrap.ElectronProtocol.layerSchemePrivilegesfor botht3codeandt3code-dev, sequenced with pre-ready command-line switch setup before the broader desktop runtime layer can build.readyand the selected backend afterready, without probing keyring availability during startup.Application Startup Sequence
Before this change,
main.tsbuilt the desktop runtime directly from the Clerk layer. Linux password-store selection and privileged scheme registration did not happen beforeapp.ready, andDesktopApp.startuponly applied a WMclassswitch after shell hydration:After this change,
main.tsstill boots through the Clerk layer, but inserts pre-ready Electron setup beforeDesktopApp.startupruns and extends startup with password-store re-resolution and safeStorage diagnostics:Known Limitations
password-storedecision usesprocess.envbefore login-shell hydration. KDE/Plasma sessions that only exposeXDG_*after shell hydration may getgnome-libsecretuntil restart unless the user passes--password-storeon the command line or setslinuxPasswordStoreexplicitly.DesktopApp.startupcovers the common AppImage case but not every desktop session ordering.Validation
bun fmtbun lintbun typecheckbun run --filter @t3tools/desktop test -- linuxSecretStorage DesktopEarlyElectronStartup DesktopAppSettings DesktopShellEnvironment DesktopSavedEnvironmentsmain(includes Clerk bridge#3092); PR CI green at9c0f41559Checklist
Note
Medium Risk
Touches startup ordering, Electron CLI switches, and encrypted credential backends on Linux; wrong heuristics or timing could still mis-select storage until restart.
Overview
Fixes encrypted credential persistence on Linux desktops Electron does not recognize (e.g. Niri/Hyprland) by choosing Electron’s
password-storebeforeapp.readyand again after login-shell env hydration.Pre-ready bootstrap: Adds synchronous read of
desktop-settings.json(JSONC) forlinuxPasswordStore, heuristics inlinuxSecretStorage(auto→ KWallet on KDE/Plasma,gnome-libsecretotherwise, no override when Electron already knows the session), WMclassplus optionalpassword-storeswitches, and privilegedt3code/t3code-devscheme registration via a dedicated pre-ready layer inmain.ts.Runtime startup: After
installIntoProcess, re-resolvespassword-storefrom updatedXDG_*/ DBUS (unless--password-storewas passed), exposesremoveCommandLineSwitch, and logs configured store plussafeStoragebackend on Linux.Settings & shell: Persists
linuxPasswordStore(defaultauto, invalid values normalized). Linux shell hydration now pulls session/desktop/DBus vars from the login shell and can synthesizeDBUS_SESSION_BUS_ADDRESSfrom/run/user/<uid>/bus.Reviewed by Cursor Bugbot for commit e739ccb. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix Linux secret storage backend selection for Niri/Hyprland desktop environments
linuxPasswordStorefrom desktop settings and sets thepassword-storecommand-line switch before Electron'sreadyevent, respecting any explicit CLI override.resolveLinuxPasswordStoreSwitchin linuxSecretStorage.ts to map user preference and desktop session environment (XDG hints) to the correct Electron switch value, with fallback guidance for GNOME Keyring vs KWallet.installPosixEnvironmentin DesktopShellEnvironment.ts to import desktop session hints (XDG_CURRENT_DESKTOP,XDG_SESSION_TYPE,WAYLAND_DISPLAY, etc.) from the login shell and auto-discoverDBUS_SESSION_BUS_ADDRESSwhen unset.linuxPasswordStoretoDesktopSettingswith normalization on load and persistence when changed from the default.ElectronSafeStoragewithselectedStorageBackend(Linux-only) andElectronAppwithremoveCommandLineSwitchto support runtime switch management.password-storeswitch is now cleared and re-set on each startup based on settings and environment, rather than left to Electron's default heuristics.Macroscope summarized e739ccb.