2

Background:

There is a new application XXX, which is distributed as a zip-file. I created a directory ~/programs/XXX, stored the zip-file in it and unzipped it. Now I got a directory ~/programs/XXX/XXXv.1 and in it program xxx and others.

I made xxx executable, dubble-clicked it in the file manager. A new icon appeared in launcher and program xxx started. After quitting the program the icon stayed in launcher. I was able to restart the program from the icon.

After a few days a new version of app xxx was distributed, got the zip, unzipped,got directory ~/programs/XXX/XXXv.1.1, in it program xxx and others.

I deleted the icon from the launcher (to programm xxx v.1), started ~/programs/XXX/XXXv.1.1/xxx from file manager, the icon appeared again in the launcher, the new version of started. After quitting the program and relaunching from the icon in launcher I noticed that the newly created icon started the old version of the program, despite the icon being created by the launch of program xxx from the new version directory.

Question:

How to make the launcher icon point to the program in the new version directory, from where the icon was created from?

Further investigation:

After renaming the program name in the old version directory the newly created icon could not launch the program. So in fact the newly created icon from the newer version of the program points to the old version of the program.

There must be a hidden config file with a pointer to the old executable, which is not deleted, when the icon to the old version is deleted.

When the new version of the program is started,an icon for the new version is created, new version of the program is started, but when restarting from the icon, old version of program is started.

What is that hidden config file of the launcher icon and how to change the program file it points to?

1 Answers1

6

To start with, fix it!

  1. Open ~/.local/share/applications in nautilus. The directory ~/.local is a hidden directory in your personal folder. Press Ctrl+H (in nautilus) to make it visible.
  2. Look for the launcher of your application, delete it.
  3. Open the new version of your application, lock it to the launcher.

You're done.

Explanation; what happened

  1. You launched the first version of your app, locked it to the launcher. This makes either Unity create a launcher in ~/.local/share/applications, or in some cases applications create a launcher there on first run.
  2. You installed a new version and ran it. There was no new version of the launcher created however, since either your application or Unity noticed the launcher already seemed to exist. This existing launcher however points to the old version.

Hence the issue.

Jacob Vlijm
  • 83,767
  • Oh, I see there is a xxx.desktop file in ~/.local/share/applications. And it points to the program in the old version directory. Deleted it. Recreated icon by starting the newer version of program xxx. Oh, there is a new version of ~/.local/share/applications/xxx.desktop and it points to the right program in the new version directory. Thanks Jacob! – Kpacnaja_Shapotshka Feb 11 '17 at 16:17
  • 1
    But that means we have a problem with programs in different directories with the same names and an icon on the launcher. xxx.desktop should be deleted, when icon for program xxx is removed from the launcher. That is more consistant. – Kpacnaja_Shapotshka Feb 11 '17 at 16:26
  • For now I have a wordaround: Rename the program file of the newer version from xxx to xxxv.new . Then another xxxv.new.desktop is created when starting this program with this file pointing to the right directory and application. – Kpacnaja_Shapotshka Feb 11 '17 at 16:28
  • @Kpacnaja_Shapotshka Not necessarily. The name as it appears in the launcher is not the name of the .desktop file, it is the name that is defined inside the file in the line Exec= – Jacob Vlijm Feb 11 '17 at 16:28
  • @Kpacnaja_Shapotshka found it! http://askubuntu.com/a/857927/72216 – Jacob Vlijm Feb 11 '17 at 16:36
  • Jacob Vlijm - Correction: The Exec= inside the desktop-file points to the program. The name in the launcher is defined with the Name= line. – Kpacnaja_Shapotshka Feb 11 '17 at 17:07
  • @Kpacnaja_Shapotshka ouch, ugly typo, you are completely right! – Jacob Vlijm Feb 11 '17 at 17:10
  • This did not work for me with a new version of firefox I don't know why – Hakaishin Sep 06 '18 at 20:10