Skip to content

fix(linux): pass URLs through desktop launcher#1179

Open
toonvanvr wants to merge 3 commits intosurrealdb:mainfrom
toonvanvr:bugfix-954-linux-pass-urls-through-desktop-launcher
Open

fix(linux): pass URLs through desktop launcher#1179
toonvanvr wants to merge 3 commits intosurrealdb:mainfrom
toonvanvr:bugfix-954-linux-pass-urls-through-desktop-launcher

Conversation

@toonvanvr
Copy link
Copy Markdown

@toonvanvr toonvanvr commented Apr 6, 2026

Issue

Signing in to to your SurrealDB account is not possible when using the .deb installer.

Relates to: #954

image

Cause

The OAuth callback URL is not passed as an argument to the surrealist executable when passing it to the .desktop launcher.

Solution

Alter the generated .desktop file by using a handlebars template to pass URLs.

[Desktop Entry]
Categories=Development;
-Exec=surrealist
+Exec=surrealist %U
Icon=surrealist
Name=Surrealist
Terminal=false
Type=Application
MimeType=text/x-surrealql;x-scheme-handler/surrealist

Choices made

  • Using a handlebars template seems like the most correct way to work around this issue as there doesn't seem to be a more specific flag in the Tauri configuration to pass arguments to the surrealist command in the launcher in another way.
  • Passing %U (multiple URLs) instead of %u (single URL) as the macOS seems to support multiple URLs too.
    RunEvent::Opened { urls } => {
    • NOTE: I believe this isn't the case for Windows, as I think %1 means it picks only the first URL.
      WriteRegStr SHCTX "Software\Classes\\{{protocol}}\shell\open\command" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" $\"%1$\""
  • Added MimeType manually as it seemed missing in the variables provided by Tauri in their official documentation

Notes

  • It might be worth checking out whether other arguments than URLs need to be supported, as this feature constrains the passed references to URLs and not files, for example.
  • ! Signing out doesn't seem to work either. Is this a regression?

Verification

  • The %U flag works when manually editing the .desktop file after installing the current official release 3.7.4
  • The .deb build creates the .desktop file correctly in /usr/share/applications/Surrealist.desktop
  • The .deb build works locally
  • The .rpm build works

Caution

I was not able to get the .deb version to run correctly after the build due to my local setup, nor did I test the rpm version as I'm running Ubuntu.
AppImage didn't support a flag like this, and I'm not sure whether that's impacted.
⇒ Please verify these cases before merging

References

tauri.conf.json

.desktop

@toonvanvr toonvanvr requested a review from macjuul as a code owner April 6, 2026 08:47
Copilot AI review requested due to automatic review settings April 6, 2026 08:47
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 6, 2026

👷 Deploy request for public-surrealist pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit da79a23

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Linux bundle configuration so the generated .desktop launcher forwards OAuth callback URLs to the application, fixing Linux sign-in flows for .deb (and aligning .rpm).

Changes:

  • Configure Tauri Linux deb and rpm bundling to use a custom desktopTemplate.
  • Add a Handlebars-based .desktop template that appends %U to Exec= to forward URLs to the app.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src-tauri/tauri.conf.json Enables a shared .desktop template for Linux deb and rpm bundles.
src-tauri/res/desktop-template.desktop.hbs Defines the .desktop template, including Exec={{exec}} %U to pass URLs through the launcher.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src-tauri/res/desktop-template.desktop.hbs Outdated
Comment thread src-tauri/res/desktop-template.desktop.hbs
macjuul and others added 2 commits April 16, 2026 17:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@macjuul
Copy link
Copy Markdown
Member

macjuul commented Apr 16, 2026

Thanks for your PR!

I was not able to get the .deb version to run correctly after the build due to my local setup, nor did I test the rpm version as I'm running Ubuntu.
AppImage didn't support a flag like this, and I'm not sure whether that's impacted.
⇒ Please verify these cases before merging

Unfortunately we don't have the capabilities internally to test the .deb version, so I will have to keep this PR open until a community member is able to confirm this fix

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.

3 participants