From 97cc4691e335b23840eee93d824f85d5b98af227 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 16 Nov 2017 12:01:05 +0100 Subject: [PATCH] sublime3: Use consistent program name (#31720) Previously, we used symlinks to create short name aliases. Symlink basenames are used as argv[0], and consequently as WM_CLASS hint when executed. This confused desktop managers, which use the hint to pair desktop files with running applications. This patches uses exec scripts instead of symlinks just like the official deb package does, preserving the sublime_text prgname. --- pkgs/applications/editors/sublime3/default.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/editors/sublime3/default.nix b/pkgs/applications/editors/sublime3/default.nix index 1ec24325460a..9c8a75320a61 100644 --- a/pkgs/applications/editors/sublime3/default.nix +++ b/pkgs/applications/editors/sublime3/default.nix @@ -61,7 +61,7 @@ in let installPhase = '' # Correct sublime_text.desktop to exec `sublime' instead of /opt/sublime_text - sed -e 's,/opt/sublime_text/sublime_text,sublime,' -i sublime_text.desktop + sed -e "s,/opt/sublime_text/sublime_text,$out/sublime_text," -i sublime_text.desktop mkdir -p $out cp -prvd * $out/ @@ -89,9 +89,15 @@ in stdenv.mkDerivation { installPhase = '' mkdir -p $out/bin - ln -s $sublime/sublime_text $out/bin/subl - ln -s $sublime/sublime_text $out/bin/sublime - ln -s $sublime/sublime_text $out/bin/sublime3 + + cat > $out/bin/subl <<-EOF + #!/bin/sh + exec $sublime/sublime_text "\$@" + EOF + chmod +x $out/bin/subl + + ln $out/bin/subl $out/bin/sublime + ln $out/bin/subl $out/bin/sublime3 mkdir -p $out/share/applications ln -s $sublime/sublime_text.desktop $out/share/applications/sublime_text.desktop ln -s $sublime/Icon/256x256/ $out/share/icons