13

OS: Ubuntu 18.04 (minimal installation option):

dkb@dkb-ubu1804:~$ cat /etc/X11/default-display-manager
/usr/sbin/gdm3
dkb@dkb-ubu1804:~$ echo $XDG_SESSION_TYPE
x11
dkb@dkb-ubu1804:~$ 

I installed the following qt-based applications using apt install: dolphin, featherpad, gwenview, kate and qterminal.

Out of these, dolphin, gwenview and kate did not show the "Add to Favorites" option when I right-clicked on their icons in the launcher. But featherpad and qterminal had the "Add to Favorites" option. Why is that?

(The situation persists even after a reboot.)

Their .desktop files didn't offer any clues.

• Dolphin

[Desktop Entry]
Name=Dolphin
Exec=dolphin %u
Icon=system-file-manager
Type=Application
X-DocPath=dolphin/index.html
Categories=Qt;KDE;System;FileTools;FileManager;
GenericName=File Manager
Terminal=false
MimeType=inode/directory;
InitialPreference=10
X-DBUS-ServiceName=org.kde.dolphin

• FeatherPad

[Desktop Entry]
Name=FeatherPad
GenericName=Text Editor
Comment=Lightweight Qt5 text editor
Exec=featherpad %F
Icon=featherpad
Terminal=false
Type=Application
MimeType=text/plain;
Categories=Qt;Utility;TextEditor;
X-KDE-StartupNotify=false

• Gwenview

[Desktop Entry]
Name=Gwenview
GenericName=KDE Image Viewer
Comment=A simple image viewer
Exec=gwenview %U
Terminal=false
Icon=gwenview
Type=Application
Categories=Qt;KDE;Graphics;Viewer;Photography;
MimeType=inode/directory;image/gif;image/jpeg;image/png;image/bmp;image/x-eps;image/x-icns;image/x-ico;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;image/tiff;image/x-psd;image/x-webp;image/webp;image/x-tga;
X-DocPath=gwenview/index.html
# InitialPreference should be greater than Okular so that Gwenview is the
# primary application associated with images, but less than Konqueror or Dolphin
# so that Gwenview is not the primary applications for folders.
InitialPreference=8
X-DBUS-ServiceName=org.kde.gwenview

• Kate

[Desktop Entry]
GenericName=Advanced Text Editor
Name=Kate
Comment=KDE Advanced Text Editor
MimeType=text/plain;
Exec=kate -b %U
StartupNotify=true
X-KDE-HasTempFileOption=true
Icon=kate
X-DocPath=kate/index.html
Type=Application
Terminal=false
InitialPreference=9
X-DBUS-StartupType=Multi
X-DBUS-ServiceName=org.kde.kate
Categories=Qt;KDE;Utility;TextEditor;

• QTerminal

[Desktop Entry]
Name=QTerminal
Type=Application
GenericName=Terminal emulator

Comment=Terminal emulator

Icon=utilities-terminal
Exec=qterminal
Terminal=false
Categories=Qt;System;TerminalEmulator;
Actions=Dropdown;

[Desktop Action Dropdown]
Name=Drop-down terminal
Exec=qterminal --drop
Icon=utilities-terminal

Name[en_GB]=Drop-down Terminal

Dolphin (shown below), gwenview and kate don't show an "Add to Favorites" option

dolphin

 

Featherpad (shown below) and qterminal have the expected "Add to Favorites" option

featherpad

8
  • This may be helpful.
    – pomsky
    Aug 28, 2019 at 11:59
  • 1
    @pomsky, I think things are fixed in 19.10. Both Dolphin and Gwenview can successfully be added as Favorites in Ubuntu 19.10's Dock.
    – DK Bose
    Oct 13, 2019 at 13:00
  • 1
    I cannot add Kate, using Gnome 3, gnome-shell 3.36.1-5ubuntu1 amd64, Ubuntu 20. Is there an alternative way, perhaps by creating a .desktop file to place it somewhere? May 6, 2020 at 17:14
  • @sancho.sReinstateMonicaCellio Did you install it as a snap or deb?
    – DK Bose
    May 7, 2020 at 1:19
  • I just installed Kate as a snap and that can be added to favorites in Ubuntu 20.04. If you try it and have issues with seeing two icons for Kate, see this; of course, you'll need to remove the appropriate .desktop file, which is /var/lib/snapd/desktop/applications/kate_org.kde.kate.desktop.
    – DK Bose
    May 7, 2020 at 1:32

4 Answers 4

17

A convenient workaround for me was adding it to my favorites from the omnibar.

enter image description here

3
  • Thank you for the workaround :)
    – prkos
    Jun 14, 2020 at 22:14
  • 4
    The Workaround produces often two icons if an instance is open, a pined one, but new ones often are added as a second icon. Jun 24, 2021 at 15:22
  • Worked for me like a charm in Ubuntu Desktop 18 - well ubuntu team should take this as an UI bug
    – Nam G VU
    Jan 22, 2022 at 17:31
4

It is completely weird, unpredictable and unexpected UX.

I confirm your results on Ubuntu session (GNOME Shell) in Ubuntu 18.04 LTS and even with 19.10 (development version).

My first thought was that Exec field pointed to some symbolic link, but all files declared in it are simple ELF executables. What is also bad that these desktop-files do not have OnlyShowIn directives...


I do not have this issue on Unity, MATE (using Mutiny panel layout) and Lubuntu sessions in 18.04 LTS and even with 19.10 (development version).
Also I'm able to dock these applications into Cairo-Dock, Docky and Plank.

So it is a bug in GNOME Shell.
I reported it as bug 1840474 to LaunchPad (really it is a duplicate of bug 1768609 from 2018-05-02).

5
  • Please expand a bit on what is meant by ELF executable? Thanks!
    – DK Bose
    Aug 16, 2019 at 14:57
  • 1
    I mean that they are normal linux-executables, not bash/python/whatever-scripts to wrap something :)
    – N0rbert
    Aug 16, 2019 at 14:58
  • I think things are fixed in 19.10. Both Dolphin and Gwenview can successfully be added as Favorites in Ubuntu 19.10's Dock.
    – DK Bose
    Oct 13, 2019 at 12:51
  • On clean 19.10 VM I can add icons only from dash by right-clicking on the icon and choosing from Add to Favorites here. But <Alt+F2> → kate / gwenview or <Super> → kate or gwenview still do not show Add to Favorites in the dock.
    – N0rbert
    Oct 13, 2019 at 14:04
  • 1
    Ah! I added to favorites by right-clicking on the icon in the dock, not by using Alt+F2. But previously, even the right-click didn't work.
    – DK Bose
    Oct 13, 2019 at 14:05
3

Jokalliauer has the correct answer:

rename the .desktop file to the WM_CLASS of the application. Open the application you want to change. Type the following followed by the ENTER key to find the WM_CLASS.

xprop | grep WM_CLASS

You will see nothing in the CLI until you click on the open window for the application. Rename the .desktop file for the application as

wm_classNameGoesHere.desktop

close the app in question, restart it and the option to add to favorites will appear when you right click the icon in the toolbar.

1
  • the .desktop file name should not be preceded by wm_, using exactly the WM_CLASS worked for me while using wm_... didn't Dec 31, 2023 at 21:01
3

The .desktop-file must have the identical WM_CLASS as the opened program:

  • for Dolphin: dolphin.desktop
  • for JabRef: org.jabref.gui.JabRefMain.desktop
  • for Maple: java-lang-Thread.desktop
  • for Eclipse: eclipse.desktop ( source )
  • for nemo nemo.desktop (not Files.desktop)
  • for academic MatlabR2022b: MATLAB R2022b - academic use

The WM_CLASS can be found with the command

xprop

for more details check https://askubuntu.com/a/1155956/676490 and https://unix.stackexchange.com/a/225409/241592

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .