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.
This commit is contained in:
Jan Tojnar 2017-11-16 12:01:05 +01:00 committed by zimbatm
parent ef0486b1f9
commit 97cc4691e3

View file

@ -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