How do I get the "right" LibreOffice Calc icon into the launcher?

I just uninstalled the pre-installed LibreOffice from Ubuntu 16.04 and installed the 5.0.5-version. Now there occured a problem with the launcher icon that (I think) wasn't there before:

The icon shown for Calc has a very bad quality and always says that it is an untitled document, even when the opened document is clearly titled

enter image description here

This problem does not occur for the other LibreOffice programs, as you can see at the Writer-icon above the Calc-icon.

When I search for LibreOffice in the Dash, two different possibilities show up for Calc

enter image description here

"untitled 1 - LibreOffice Calc" and "LibreOffice 5.0 Calc"

The latter is the right one. But even when I click on it, it opens the first icon/application, although at first it shows the right (high-quality) icon in the launcher for a second. Both open the 5.0.5-version, but with the wrong icon and the wrong title. The same problem occurs with LibreOffice Main.

I have read a bit about icons in Unity at some websites (also this one), which lead me to the folder /usr/share/app-install/desktop, where I also found the "ugly" images, which are related to .xdesktop -files. Interestingly, in this folder, only the .xdesktop -file of Calc and Main have an icon at all, not the others.

Has it got something to do with the files in the folder /usr/share/app-install/desktop/? What about the files in the folder /usr/share/icons? Is it related to the icon-theme, which I changed?
Does anyone know how I can get the right icon and the right Calc -application to be used? Is there possibly a remainder of the previous LibreOffice version on the system?


Solution 1:

Default directories for launchers

The two default directories for .desktop files (launchers) are:

/usr/share/applications

for gloablly installed applications, and

~/.local/share/applications

for locally installed applications (~ stands for your home directory, /home/yourname) , or local versions of the launchers.

About LibreOffice

LibreOffice however is a bit of a stranger in our midst, if it comes to .desktop files.

While the default (Ubuntu) version of LibreOffice stores its .desktop files, as usual, in

/usr/share/applications

the downloaded version stores them in

/usr/local/share/applications

That is, links to the launchers. The real launchers are in

/opt/libreoffice5.0/share/xdg/

What happened

There are two options:

  1. Somehow, you have a local copy of the Libreoffice launcher in ~/.local/share/applications. If so, it will overrule all other occurrences of the same launcher (as mentioned, ~ stands for your home directory, /home/yourname). If so, remove the file(s), log out and back in.
  2. the launcher in /usr/share/applications was left behind for some reason, by an error during uninstall. If the first option is not the case:

    • Navigate to /usr/share/applications open a terminal window, type:

      sudo rm
      

      and subsequently drag the LibreOffice Calc launcher over into the terminal window in order to insert the file-directory. Then press Enter. Of course, you can also do that by typing the command:

      sudo rm /usr/local/share/libreoffice-calc.desktop
      

      and hitting Enter.

    • Log out and back in and it should be fixed.