Bug 378253

Summary: Duplicated Icon of Digikam in Gnome shell menu
Product: [Applications] digikam Reporter: Nicofo <nicofo>
Component: Portability-InterroperabilityAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, iwannaberich, metzpinguin, theassassin
Priority: NOR    
Version: 6.0.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 6.0.0
Sentry Crash Report:
Attachments: TWO Digikam icons in the Gnome shell menu

Description Nicofo 2017-03-29 19:49:14 UTC
Created attachment 104803 [details]
TWO Digikam icons in the Gnome shell menu

1) Add Digikam in the Favorites of Gnome Shell
2) Launch Digikam

Expected behaviour: there is ONE Digikam icon in the Gnome shell left menu (underlined with a blue line - meaning the program is running)

Actual behaviour: there are TWO Digikam icons in the Gnome shell left menu (see attached screenshot) (note that the second only is underlined with a blue line)
Comment 1 Nicofo 2018-10-28 21:03:14 UTC
Still valid with digikam 6.0 Beta2 from Appimage
(Note - also valid with Fedora RPM's 5.9)

Note that in the panel, with Appimage, these are 2 different icons:
* the 1st (DK set in the favourite) is an undefined icon (see bug #381739)
* the 2nd (running program) is a digikam icon

Expected result: only one digikam icon (underlined in blue when program is running)
Comment 2 TheAssassin 2019-02-03 01:45:18 UTC
The issue is the lack of a StartupWMClass entry in your desktop file. It seems most KDE apps lack the entry. It's usually equal to your app name you set in your QApplication, and can also be queried using xprop WM_CLASS.
Comment 3 MarcP 2019-02-03 01:52:46 UTC
Hey, I was about to report this issue, but I found out it already existed.

Apparently it has to do with the WM_class of the .desktop file, which is the one that is used to launch the program from a shortcut. It not only affects digikam, but many other software packed in .appimage format.

Have a look: https://askubuntu.com/questions/403766/duplicate-icons-for-manually-created-gnome-launcher-items

Basically, if the .desktop file contained the line StartupWMClass=digikam, it wouldn't show two separate icons for the launcher and for the program window. You can try for yourself by adding that line to the the digikam.desktop file.
Comment 4 caulier.gilles 2019-02-03 09:32:58 UTC
Interresting.

Do you seen the same duplicate icon with another KDE application as GWenview for ex, when it run under Gnome shell desktop ?

Gilles Caulier
Comment 5 caulier.gilles 2019-02-03 09:36:35 UTC
Look like Gwenview .desktop file do not contains WM_CLASS property :

https://cgit.kde.org/gwenview.git/tree/app/org.kde.gwenview.desktop

Gilles Caulier
Comment 6 caulier.gilles 2019-02-03 09:40:57 UTC
It's the same for Dolphin file manager :

https://cgit.kde.org/dolphin.git/tree/src/org.kde.dolphin.desktop

Gilles Caulier
Comment 7 caulier.gilles 2019-02-03 09:46:04 UTC
I grep in bugzilla if some KDE applications handle StartupWMClass desktop property, and yes i found some items, as krita or konsole :

https://bugs.kde.org/show_bug.cgi?id=372441
https://bugs.kde.org/show_bug.cgi?id=402622

So we need to patch Showfoto and digiKam .desktop file in this way...

Gilles Caulier
Comment 8 caulier.gilles 2019-02-03 10:30:38 UTC
Git commit b8317a7c121f5fa407a9ba250615c7536c125f56 by Gilles Caulier.
Committed on 03/02/2019 at 10:27.
Pushed by cgilles into branch 'master'.

add StartupWMClass property to desktop files
Related: bug 376615, bug 381739, bug 375345

M  +1    -0    core/app/main/org.kde.digikam.desktop
M  +1    -0    core/showfoto/main/org.kde.showfoto.desktop

https://commits.kde.org/digikam/b8317a7c121f5fa407a9ba250615c7536c125f56
Comment 9 caulier.gilles 2019-02-03 10:32:23 UTC
Git commit 473d13879eb43b868a4e072049141e04e0bdbcd3 by Gilles Caulier.
Committed on 03/02/2019 at 10:31.
Pushed by cgilles into branch 'development/dplugins'.

add StartupWMClass property to desktop files
Related: bug 376615, bug 381739, bug 375345

M  +1    -0    core/app/main/org.kde.digikam.desktop
M  +1    -0    core/showfoto/main/org.kde.showfoto.desktop

https://commits.kde.org/digikam/473d13879eb43b868a4e072049141e04e0bdbcd3
Comment 10 MarcP 2019-02-03 16:16:31 UTC
Well, that was quick. Thank you!
Comment 11 caulier.gilles 2019-02-03 16:24:39 UTC
The appimage bundles are updated. Can you test on your computer ?

https://files.kde.org/digikam/

Gilles Caulier
Comment 12 caulier.gilles 2019-02-03 16:36:13 UTC
Here under Gnome shell, the native version work as expected, after to register digiKam as Favorites

https://imgur.com/AVZAtiq

Gilles Caulier
Comment 13 caulier.gilles 2019-02-03 16:52:57 UTC
Same with AppImage 6.0.0 bundle generated today :

https://imgur.com/VzkZcSo

Gilles Caulier
Comment 14 MarcP 2019-02-03 16:56:00 UTC
I can confirm that it now works in version digikam-6.0.0-20190203T151814-x86-64.appimage, but it didn't in previous versions. I am using Ubuntu 18.04 LTS with the default Gnome desktop environment.

By the way, I used AppImageLauncher to automatically "install" and create shortcuts for software in the appimage format.
Comment 15 caulier.gilles 2019-02-03 17:01:30 UTC
yes, it's normal the desktop file patches was only included into digikam-6.0.0-20190203T151814-x86-64.appimage

I close this file now.

Gilles Caulier