Skip to content

gitkraken: register gitkraken:// and gk:// URL handlers#310

Merged
Azd325 merged 3 commits into
Azd325:masterfrom
mosi0815:feature/fix-url-handlers
Jun 23, 2026
Merged

gitkraken: register gitkraken:// and gk:// URL handlers#310
Azd325 merged 3 commits into
Azd325:masterfrom
mosi0815:feature/fix-url-handlers

Conversation

@mosi0815

@mosi0815 mosi0815 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

The hand-written GitKraken.desktop carried no scheme MimeType, so the
gitkraken:// and gk:// URL handlers never registered and OAuth callback
links broke. Fix this on the existing tarball instead of switching the
source to the .deb (which only adds these few text files but would cost a
/usr/share->/opt relocation and CI rework).

  • adopt upstream's launcher contents from the deb in GitKraken.desktop
    (kept under that name so existing favorites/pins stay valid), and add the
    gitkraken-url-handler and gk-cli-url-handler entries, which register the
    two schemes and open them via /usr/bin/gitkraken --uri=%U
  • drop the deb launcher's MimeType=text/plain, which wrongly associated
    GitKraken with all plaintext files (Desktop file incorrectly associates GitKraken with plaintext files. #260); the launcher carries no
    MimeType, so the two --uri handlers own the schemes
  • symlink /usr/bin/gitkraken to the tarball's resources/bin/gitkraken.sh
    instead of shipping our own wrapper; drop gitkraken.sh
  • chmod 4755 chrome-sandbox so Electron's SUID sandbox works (cp drops it)
  • bump pkgrel to 2 so existing 12.2.1 users get the fix

@mosi0815 mosi0815 marked this pull request as ready for review June 18, 2026 23:09
@Azd325

Azd325 commented Jun 19, 2026

Copy link
Copy Markdown
Owner

The bug is real. Our GitKraken.desktop has no scheme MimeType, so gitkraken:// and gk:// don't register and OAuth links break. I want to fix it.

I don't want to switch the source to the .deb, though. The benefit is too small.

The tarball and the deb ship the same Electron payload. The tarball already contains the launcher (resources/bin/gitkraken.sh), chrome-sandbox, and the binary. The deb only adds three .desktop files.

To get those files, the PR adds noextract, two-pass bsdtar extraction, a /usr/share/opt relocation with an Exec sed, and a CI rewrite. That is the layout-remapping cost the ArchWiki warns about. The technique is fine. It just costs more than it returns when we already ship a clean tarball.

We can fix the bug on the current tarball:

  1. Symlink /usr/bin/gitkraken to the bundled resources/bin/gitkraken.sh. (Your PR already does this.)
  2. Add the two URL-handler .desktop files and a scheme MimeType on the main entry. Leave out text/plain. The deb's file includes it, which would reintroduce Desktop file incorrectly associates GitKraken with plaintext files. #260.
  3. chmod 4755 chrome-sandbox. Correct fix. Add a comment so the setuid namcap warning isn't read as a mistake.
  4. Bump pkgrel to 2 so current 12.2.1 users get the fix.

Can you rework the PR this way? Thanks for finding the root cause.

The hand-written GitKraken.desktop carried no scheme MimeType, so the
gitkraken:// and gk:// URL handlers never registered and OAuth callback
links broke. Fix this on the existing tarball instead of switching the
source to the .deb (which only adds these few text files but would cost a
/usr/share->/opt relocation and CI rework).

- adopt upstream's launcher contents from the deb in GitKraken.desktop
  (kept under that name so existing favorites/pins stay valid), and add the
  gitkraken-url-handler and gk-cli-url-handler entries, which register the
  two schemes and open them via /usr/bin/gitkraken --uri=%U
- drop the deb launcher's MimeType=text/plain, which wrongly associated
  GitKraken with all plaintext files (Azd325#260); the launcher carries no
  MimeType, so the two --uri handlers own the schemes
- symlink /usr/bin/gitkraken to the tarball's resources/bin/gitkraken.sh
  instead of shipping our own wrapper; drop gitkraken.sh
- chmod 4755 chrome-sandbox so Electron's SUID sandbox works (cp drops it)
- bump pkgrel to 2 so existing 12.2.1 users get the fix
@mosi0815 mosi0815 force-pushed the feature/fix-url-handlers branch from ff47a32 to 2811038 Compare June 19, 2026 12:07
@mosi0815 mosi0815 changed the title build from upstream deb to fix URL handler registration gitkraken: register gitkraken:// and gk:// URL handlers Jun 19, 2026
@mosi0815

Copy link
Copy Markdown
Contributor Author

Sorry for the force push action. ;)
Builds and installs fine locally and now uses the tar.gz + destkop files here in the repo.

@Azd325

Azd325 commented Jun 19, 2026

Copy link
Copy Markdown
Owner

One change before I merge: set Icon=gitkraken (no path, no extension) in all three .desktop files instead of Icon=/usr/share/pixmaps/gitkraken.png. We install the icon to /usr/share/pixmaps, which is in the default icon search path, so the name resolves to the same file and also lets icon themes override it. That was a deliberate choice in 881d1d6.

One thing to double-check, not a blocker: /usr/bin/gitkraken now points at the bundled CLI launcher instead of our old wrapper. Can you confirm gitkraken /path/to/repo from a terminal still opens the repo? It matches what upstream's deb does, so it should be fine.

@mosi0815

Copy link
Copy Markdown
Contributor Author

gitkraken <path> opens the UI as expected.
Icon path is fixed.

@mosi0815

Copy link
Copy Markdown
Contributor Author

Forgot the .SRCINFO....

@Azd325 Azd325 merged commit 9228867 into Azd325:master Jun 23, 2026
4 checks passed
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.

2 participants