3

I have noticed that when I do a program search in Ubuntu 20.04, there are two instances of the program Okular. One with an icon and one that has the generic application icon (gear). I installed Okular from Ubuntu Software. This doesn't seem to happen with other applications that I have also installed from Ubuntu Software. I'd search this on Google myself but I'm not quite sure how to describe this issue. Any help would be appreciated. Thanks.

I should note that this was a fresh install.

Links to relevant screenshots... (I don't have 10 reputation yet to embed images)

Two icons in search

Two icons in search

Output of snap list

Output of <code>snap list</code>

Output of apt policy okular

Output of <code>apt policy okular</code>

  • 1
    Okay, so you seem to have the snap version and not the deb version. That still doesn't explain why you see two icons. I guess you can figure out which is the real icon and just use that in case no one comes up with a good explanation. – DK Bose Apr 25 at 12:44
  • I added the images for you. BTW, for the future, please don't provide terminal output as images. It is difficult for responders to use part of the output in their answers or in requests for clarification. Instead, copy and paste the relevant output here using this site's markdown formatting. – DK Bose Apr 25 at 13:04
  • 1
    I'll bookmark that and make sure that I will do that next time. Thank you for the edit. – seeyanara Apr 25 at 13:06
  • Hmmm! I installed the okular snap in Xubuntu 20.04 and see the same two icons as you do. Both are functional. – DK Bose Apr 25 at 14:13
3

NOTE: This answer works for the okular snap in Xubuntu 20.04, and in Ubuntu 20.04

After installing okular as a snap package, I see two icons in the Whisker Menu launcher: one seems to represent okular and the other is generic but both show the same tooltip (Universal document viewer).

Two okular icons

I ran locate -i okular | grep -i desktop to identify the corresponding .desktop files. (Ubuntu users may need to install the mlocate package to access the locate command.) There were several hits but

/var/lib/snapd/desktop/applications/okular_okular.desktop
/var/lib/snapd/desktop/applications/okular_org.kde.okular.desktop

are relevant.

  • I copied these two .desktop files over to ~/.local/share/applications. The applications subfolder may not exist originally in which case it should be created.

  • I edited both files to remove extra names, generic names, and comments and then compared the two files.

dkb@dkb-xubuFF:~/.local/share/applications$ ls
okular_okular.desktop  okular_org.kde.okular.desktop
dkb@dkb-xubuFF:~/.local/share/applications$ diff *.desktop
7,8c7
< Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/okular_okular.desktop /snap/bin/okular %U
< Icon=/snap/okular/98/usr/share/icons/hicolor/64x64/apps/okular.png
---
> Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/okular_org.kde.okular.desktop /snap/bin/okular %U
12d10
< 
dkb@dkb-xubuFF:~/.local/share/applications$ 

As you can see from the output,

  • the Exec= lines of both .desktop files launch /snap/bin/okular %U
  • one .desktop file, okular_org.kde.okular.desktop, is missing the line beginning with Icon and that explains the "generic" icon in the application menu.
  • since both .desktop files seem to be equivalent, we can just "hide" the one which shows the generic icon by adding NoDisplay=true as the last line to that .desktop file.

Now, there's just the one "okular" when one types oku in a launcher's search bar:

Just one okular

Note:

  • none of the operations above need the user to be root or to invoke sudo
  • modifications made to .desktop files in ~/.local/share/applications will survive updates of the parent packages.

A bug has been filed.

| improve this answer | |
  • I'm going to try this now and report back. Many thanks. – seeyanara Apr 27 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.