From 1e2662c5fdceeebb8060214f457791a57da7c19c Mon Sep 17 00:00:00 2001 From: K900 Date: Mon, 28 Feb 2022 20:10:56 +0300 Subject: treewide: fix some desktop file names pkgs.writeTextFile doesn't like spaces in filenames. This is fixed in #162246, but other tools will probably dislike spaces in .desktop file names as well, and that PR will take forever, so let's fix this anyway. --- pkgs/applications/misc/prusa-slicer/default.nix | 4 ++-- pkgs/applications/misc/prusa-slicer/super-slicer.nix | 2 +- pkgs/build-support/make-desktopitem/default.nix | 9 +++++++-- pkgs/development/tools/scenebuilder/default.nix | 4 ++-- pkgs/games/domination/default.nix | 4 ++-- pkgs/games/lunar-client/default.nix | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) (limited to 'pkgs') diff --git a/pkgs/applications/misc/prusa-slicer/default.nix b/pkgs/applications/misc/prusa-slicer/default.nix index d72d605f021..6ae7f422f02 100644 --- a/pkgs/applications/misc/prusa-slicer/default.nix +++ b/pkgs/applications/misc/prusa-slicer/default.nix @@ -93,7 +93,7 @@ stdenv.mkDerivation rec { desktopItems = [ (makeDesktopItem { - name = "PrusaSlicer"; + name = "prusa-slicer"; exec = "prusa-slicer"; icon = "PrusaSlicer"; comment = "G-code generator for 3D printers"; @@ -102,7 +102,7 @@ stdenv.mkDerivation rec { categories = [ "Development" ]; }) (makeDesktopItem { - name = "PrusaSlicer G-code Viewer"; + name = "prusa-gcodeviewer"; exec = "prusa-gcodeviewer"; icon = "PrusaSlicer-gcodeviewer"; comment = "G-code viewer for 3D printers"; diff --git a/pkgs/applications/misc/prusa-slicer/super-slicer.nix b/pkgs/applications/misc/prusa-slicer/super-slicer.nix index de00c1174b9..7a4d2ee1d25 100644 --- a/pkgs/applications/misc/prusa-slicer/super-slicer.nix +++ b/pkgs/applications/misc/prusa-slicer/super-slicer.nix @@ -33,7 +33,7 @@ let desktopItems = [ (makeDesktopItem { - name = appname; + name = "superslicer"; exec = "superslicer"; icon = appname; comment = description; diff --git a/pkgs/build-support/make-desktopitem/default.nix b/pkgs/build-support/make-desktopitem/default.nix index 787f0f67847..e0a57f4aa3f 100644 --- a/pkgs/build-support/make-desktopitem/default.nix +++ b/pkgs/build-support/make-desktopitem/default.nix @@ -34,6 +34,11 @@ , extraConfig ? {} # Additional values to be added literally to the final item, e.g. vendor extensions }: let + # FIXME: workaround until https://github.com/NixOS/nixpkgs/pull/162246 lands + cleanName = if lib.hasInfix " " name + then throw "Name must not contain spaces!" + else name; + # There are multiple places in the FDO spec that make "boolean" values actually tristate, # e.g. StartupNotify, where "unset" is literally defined as "do something reasonable". # So, handle null values separately. @@ -111,8 +116,8 @@ let content = [ mainSectionRendered ] ++ actionsRendered; in writeTextFile { - name = "${name}.desktop"; - destination = "/share/applications/${name}.desktop"; + name = "${cleanName}.desktop"; + destination = "/share/applications/${cleanName}.desktop"; text = builtins.concatStringsSep "\n" content; checkPhase = "${desktop-file-utils}/bin/desktop-file-validate $target"; } diff --git a/pkgs/development/tools/scenebuilder/default.nix b/pkgs/development/tools/scenebuilder/default.nix index 3ae31bbadb9..77928a1f22a 100644 --- a/pkgs/development/tools/scenebuilder/default.nix +++ b/pkgs/development/tools/scenebuilder/default.nix @@ -64,11 +64,11 @@ let ''; desktopItem = makeDesktopItem { - name = "Scene Builder"; + name = "scenebuilder"; exec = "scenebuilder"; icon = "scenebuilder"; comment = "A visual, drag'n'drop, layout tool for designing JavaFX application user interfaces."; - desktopName = pname; + desktopName = "Scene Builder"; mimeTypes = [ "application/java" "application/java-vm" "application/java-archive" ]; categories = [ "Development" ]; }; diff --git a/pkgs/games/domination/default.nix b/pkgs/games/domination/default.nix index dd044656534..b7eae5e5acd 100644 --- a/pkgs/games/domination/default.nix +++ b/pkgs/games/domination/default.nix @@ -11,13 +11,13 @@ let desktopItem = makeDesktopItem { - name = "Domination"; + name = "domination"; desktopName = "Domination"; exec = "domination"; icon = "domination"; }; editorDesktopItem = makeDesktopItem { - name = "Domination Map Editor"; + name = "domination-map-editor"; desktopName = "Domination Map Editor"; exec = "domination-map-editor"; icon = "domination"; diff --git a/pkgs/games/lunar-client/default.nix b/pkgs/games/lunar-client/default.nix index dceb9755fa2..fbebe85cf00 100644 --- a/pkgs/games/lunar-client/default.nix +++ b/pkgs/games/lunar-client/default.nix @@ -5,7 +5,7 @@ let version = "2.9.3"; desktopItem = makeDesktopItem { - name = "Lunar Client"; + name = "lunar-client"; exec = "lunar-client"; icon = "lunarclient"; comment = "Minecraft 1.7, 1.8, 1.12, 1.15, and 1.16 Client"; -- cgit 1.4.1