Skip to content

Commit

Permalink
sublime3: Use consistent program name (#31720)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jtojnar authored and zimbatm committed Nov 16, 2017
1 parent ef0486b commit 97cc469
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkgs/applications/editors/sublime3/default.nix
Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 97cc469

Please sign in to comment.