jetbrains-toolbox: fix login flow

This does two things:

Switch to the upstream desktop file. There's no reason to be using our
own, and overriding theirs means we'll miss out on potential changes and
improvements. Their desktop file also registers the application as a
handler for `jetbrains://` URLs, which was previously missing from ours.

Fix the desktop file so that URLs are passed to the application. This
argument was erroneously absent from both their and our `Exec=`, meaning
that even with the scheme handler, it wouldn't actually see any URLs.
`jetbrains://` URLs are used by the application for, among other things,
callbacks during the login flow. Without them, it's not possible to
smoothly log in; instead requiring the user to paste in an auth token.

Change-Id: Ic20469f63c0c3cfbb87f0670afbf5cd68ad7f7c5
This commit is contained in:
V 2024-02-22 05:07:36 +01:00
parent b58efbce81
commit 9ff5c93ecf

View File

@ -2,7 +2,6 @@
, lib
, fetchzip
, copyDesktopItems
, makeDesktopItem
, makeWrapper
, runCommand
, appimageTools
@ -24,6 +23,13 @@ let
}
''
appimage-exec.sh -x $out ${src}/${pname}-${version}/${pname}
# JetBrains ship a broken desktop file. Despite registering a custom
# scheme handler for jetbrains:// URLs, they never mark the command as
# being suitable for passing URLs to. Ergo, the handler never receives
# its payload. This causes various things to break, including login.
# Reported upstream at: https://youtrack.jetbrains.com/issue/TBX-11478/
sed -Ei '/^Exec=/s/( %U)?$/ %U/' $out/jetbrains-toolbox.desktop
'';
appimage = appimageTools.wrapAppImage {
@ -31,19 +37,6 @@ let
src = appimageContents;
extraPkgs = pkgs: (appimageTools.defaultFhsEnvArgs.targetPkgs pkgs);
};
desktopItem = makeDesktopItem {
name = "JetBrains Toolbox";
exec = "jetbrains-toolbox";
comment = "JetBrains Toolbox";
desktopName = "JetBrains Toolbox";
type = "Application";
icon = "jetbrains-toolbox";
terminal = false;
categories = [ "Development" ];
startupWMClass = "jetbrains-toolbox";
startupNotify = false;
};
in
stdenv.mkDerivation {
inherit pname version src appimage;
@ -61,7 +54,7 @@ stdenv.mkDerivation {
runHook postInstall
'';
desktopItems = [ desktopItem ];
desktopItems = [ "${appimageContents}/jetbrains-toolbox.desktop" ];
# Disabling the tests, this seems to be very difficult to test this app.
doCheck = false;