[opensuse-packaging] where are .desktop files stored?

My silly grep over 10k .spec files gives this list of directories where *.desktop files are stored. Who is the consumer of .desktop files and why are there some many different places to store them? And: Is a simple "%_datadir/applications" not good enough for most of them? It would be so easy. And compatible. Olaf 560 %_datadir/applications 224 /opt/kde3/share/applications/kde 171 %_kf5_applicationsdir 140 /opt/kde3/share/services 122 %_kde4_servicesdir 105 %_kf5_servicesdir 63 %yast_desktopdir 58 %_kde4_applicationsdir 55 %_sysconfdir/xdg/autostart 30 %_kf5_servicetypesdir 29 %_datadir/xfce4/panel/plugins 28 /opt/kde3/share/servicetypes 28 /opt/kde3/share/services/kaddressbook 25 %_datadir/xsessions 22 /opt/kde3/share/applnk/.hidden 22 %_kde4_servicesdir/kded 20 /opt/kde3/share/mimelnk/application 16 /opt/kde3/share/services/kontact 13 /usr/share/applications 13 /opt/kde3/share/services/kded 13 %_kf5_configdir/autostart 11 %_datadir/mimelnk/application 9 /opt/kde3/share/autostart 8 /opt/kde3/share/applnk/System/ScreenSavers 8 %_kf5_sharedir/%name/extras/multimedia 7 /opt/kde3/share/apps/kicker/applets 7 %_kde4_servicesdir/ServiceMenus 7 %_datadir/applications/kde4 6 %desktopdir 6 %_kde4_servicetypes 6 %_datadir/xfce4/panel-plugins 5 /opt/kde3/share/apps/konqueror/servicemenus 5 /opt/kde3/share/appl*/* 5 %_kde4_servicetypesdir 5 %_datadir/kde4/services 5 %_datadir/autostart 4 %_libdir/gnome-settings-daemon-3.0/gtk-modules 4 %_kde4_appsdir/solid/actions 4 %_datadir/solid/actions 4 %_datadir/kservices5 3 /opt/kde3/share/mimelnk/text 3 /opt/kde3/share/mimelnk/fonts 3 /opt/kde3/share/applnk/Settings/WebBrowsing 3 %buildroot/%_datadir/applications 3 %_libdir/%name/share/applications 3 %_datadir/xgreeters 3 %_datadir/system-config-selinux 3 %_datadir/kde4/services/ServiceMenus 2 /usr/share/autoinstall/modules 2 /opt/kde3/share/services/kresources/kcal 2 /opt/kde3/share/services/kresources 2 /opt/kde3/share/services/kdemmbackends 2 /opt/kde3/share/apps/remoteview 2 %_prefix/share/applications/YaST2 2 %_kf5_servicesdir/ServiceMenus 2 %_kde4_servicesdir/phononbackends 2 %_kde4_appsdir/kwin 2 %_kde4_appsdir/konqueror/dirtree/remote 2 %_jvmdir/%sdkdir/jre/lib/desktop 2 %_datadir/wayland-sessions 2 %_datadir/kservices5/ServiceMenus 2 %_datadir/kde4/services/phononbackends 2 %_datadir/gnome/wm-properties 2 %_datadir/gnome/autostart 2 %_datadir/gdm/greeter/applications 2 %_datadir/applications/YaST2 1 Swift/resources 1 /usr/share/xsessions 1 /opt/kde3/share/services/searchproviders 1 /opt/kde3/share/mimelnk/interface 1 /opt/kde3/share/mimelnk/inode 1 /opt/kde3/share/mimelnk/audio 1 /opt/kde3/share/mimelnk/* 1 /opt/kde3/share/apps/kttsd 1 /opt/kde3/share/apps/konqueror/dirtree/remote 1 /opt/kde3/share/apps/kicker/extensions 1 /opt/kde3/share/apps/khtml/kpartplugins 1 /opt/kde3/share/apps/khelpcenter/searchhandlers 1 /opt/kde3/share/apps/kabc/formats 1 /opt/kde3/share/applnk/Development 1 /opt/kde3/share/applnk 1 /etc/xdg/autostart 1 %yast_desktopdir/groups 1 %kdeprefix/share/applications 1 %gnome_prefix/share/applications 1 %gnome_prefix/share/application-registry 1 %gnome_datadir/applications 1 %_kf5_sharedir/xsessions 1 %_kf5_sharedir/locale/* 1 %_kf5_sharedir/akonadi/agents 1 %_kf5_sharedir/%name/extras/system 1 %_kf5_servicesdir/kded 1 %_kde4_servicesdir/qimageioplugins 1 %_kde4_appsdir/remoteview 1 %_kde4_appsdir/konqsidebartng/virtual_folders/services 1 %_datadir/tracker/miners 1 %_datadir/susehelp/meta 1 %_datadir/services/kded 1 %_datadir/remoteview 1 %_datadir/konqsidebartng/virtual_folders/services 1 %_datadir/kdm/sessions 1 %_datadir/kde4/apps/ksmserver/windowmanagers 1 %_datadir/gdm/autostart/LoginWindow 1 %_datadir/applications/kde 1 %_datadir/appdata 1 %_datadir/akonadi/agents 1 %_datadir/Thunar/sendto

On Wed, 2017-03-22 at 18:47 +0100, Olaf Hering wrote:
My silly grep over 10k .spec files gives this list of directories where *.desktop files are stored. Who is the consumer of .desktop files and why are there some many different places to store them?
The question seems trivial - but is not
And: Is a simple "%_datadir/applications" not good enough for most of them? It would be so easy. And compatible.
the 'main' location for .desktop files shown by the various desktops is indeed /usr/share/applications (aka %_datadir/applications)
560 %_datadir/applications
So this is the most common way
224 /opt/kde3/share/applications/kde 140 /opt/kde3/share/services Legacy stuff - KDE3: let's just ignore this and forget this exists :)
171 %_kf5_applicationsdir 122 %_kde4_servicesdir 105 %_kf5_servicesdir
The KDE Team, in the spirit of how KDE3 was handled, basically kept their set of macros; kf5_applicationsdir is /usr/share/applications. The idea there was an easy 'move' to /opt should this ever be needed
63 %yast_desktopdir 58 %_kde4_applicationsdir 55 %_sysconfdir/xdg/autostart
Same fileformat to be stored, different meaning - but you know that anyway. XDG compliant DEs will auto-start all .desktop files in there that are matching either the OnlyShowIn= or not maching the NotShowIn= entries
30 %_kf5_servicetypesdir 29 %_datadir/xfce4/panel/plugins 28 /opt/kde3/share/servicetypes 28 /opt/kde3/share/services/kaddressbook 25 %_datadir/xsessions
the various entries you see in sddm/gdm/lightdm (not xdm though)
22 %_kde4_servicesdir/kded 13 /usr/share/applications
Somebody forgot to use the macros
13 %_kf5_configdir/autostart 11 %_datadir/mimelnk/application 8 %_kf5_sharedir/%name/extras/multimedia 7 %_kde4_servicesdir/ServiceMenus 7 %_datadir/applications/kde4 6 %desktopdir 6 %_kde4_servicetypes 6 %_datadir/xfce4/panel-plugins 5 %_kde4_servicetypesdir 5 %_datadir/kde4/services 5 %_datadir/autostart 4 %_libdir/gnome-settings-daemon-3.0/gtk-modules 4 %_kde4_appsdir/solid/actions 4 %_datadir/solid/actions 4 %_datadir/kservices5 3 %buildroot/%_datadir/applications
Those are very likely a bug
3 %_libdir/%name/share/applications 3 %_datadir/xgreeters 3 %_datadir/system-config-selinux 3 %_datadir/kde4/services/ServiceMenus 2 /usr/share/autoinstall/modules 2 %_prefix/share/applications/YaST2 2 %_kf5_servicesdir/ServiceMenus 2 %_kde4_servicesdir/phononbackends 2 %_kde4_appsdir/kwin 2 %_kde4_appsdir/konqueror/dirtree/remote 2 %_jvmdir/%sdkdir/jre/lib/desktop 2 %_datadir/wayland-sessions 2 %_datadir/kservices5/ServiceMenus 2 %_datadir/kde4/services/phononbackends 2 %_datadir/gnome/wm-properties 2 %_datadir/gnome/autostart 2 %_datadir/gdm/greeter/applications 2 %_datadir/applications/YaST2 1 Swift/resources 1 /usr/share/xsessions 1 /etc/xdg/autostart 1 %yast_desktopdir/groups 1 %kdeprefix/share/applications 1 %gnome_prefix/share/applications 1 %gnome_prefix/share/application-registry 1 %gnome_datadir/applications 1 %_kf5_sharedir/xsessions 1 %_kf5_sharedir/locale/* 1 %_kf5_sharedir/akonadi/agents 1 %_kf5_sharedir/%name/extras/system 1 %_kf5_servicesdir/kded 1 %_kde4_servicesdir/qimageioplugins 1 %_kde4_appsdir/remoteview 1 %_kde4_appsdir/konqsidebartng/virtual_folders/services 1 %_datadir/tracker/miners 1 %_datadir/susehelp/meta 1 %_datadir/services/kded 1 %_datadir/remoteview 1 %_datadir/konqsidebartng/virtual_folders/services 1 %_datadir/kdm/sessions 1 %_datadir/kde4/apps/ksmserver/windowmanagers 1 %_datadir/gdm/autostart/LoginWindow 1 %_datadir/applications/kde 1 %_datadir/appdata
erm - here should be NO desktop files - this is definitively wrong
1 %_datadir/akonadi/agents 1 %_datadir/Thunar/sendto
Most of the things are fine - KDE just uses their own set of macros; a few things are indeed bugs. Please file those as such so they can be verified / fixed. Cheers Dominique -- Dimstar / Dominique Leuenberger <dimstar@opensuse.org>

On 03/23/2017 08:30 AM, Dimstar / Dominique Leuenberger wrote:
On Wed, 2017-03-22 at 18:47 +0100, Olaf Hering wrote:
My silly grep over 10k .spec files gives this list of directories where *.desktop files are stored. Who is the consumer of .desktop files and why are there some many different places to store them?
The question seems trivial - but is not
And: Is a simple "%_datadir/applications" not good enough for most of them? It would be so easy. And compatible.
the 'main' location for .desktop files shown by the various desktops is indeed /usr/share/applications (aka %_datadir/applications)
560 %_datadir/applications
13 %_kf5_configdir/autostart 11 %_datadir/mimelnk/application 8 %_kf5_sharedir/%name/extras/multimedia 7 %_kde4_servicesdir/ServiceMenus 7 %_datadir/applications/kde4 6 %desktopdir 6 %_kde4_servicetypes 6 %_datadir/xfce4/panel-plugins 5 %_kde4_servicetypesdir 5 %_datadir/kde4/services 5 %_datadir/autostart 4 %_libdir/gnome-settings-daemon-3.0/gtk-modules 4 %_kde4_appsdir/solid/actions 4 %_datadir/solid/actions 4 %_datadir/kservices5 3 %buildroot/%_datadir/applications
Those are very likely a bug
3 %_libdir/%name/share/applications 3 %_datadir/xgreeters 3 %_datadir/system-config-selinux 3 %_datadir/kde4/services/ServiceMenus 2 /usr/share/autoinstall/modules 2 %_kf5_servicesdir/ServiceMenus 2 %_kde4_servicesdir/phononbackends 2 %_kde4_appsdir/kwin 2 %_kde4_appsdir/konqueror/dirtree/remote
2 %_jvmdir/%sdkdir/jre/lib/desktop
Maybe this one is here and linked to a correct spot with update alternatives
1 /usr/share/xsessions 2 %_datadir/wayland-sessions 1 %_kf5_sharedir/xsessions
These are fine (beside the missing macro) this is what lightdm / gdm use to generate there desktop selection list
2 %_datadir/kservices5/ServiceMenus 2 %_datadir/kde4/services/phononbackends 2 %_datadir/gnome/wm-properties 2 %_datadir/gnome/autostart 2 %_datadir/gdm/greeter/applications
2 %_datadir/applications/YaST2 2 %_prefix/share/applications/YaST2 1 %_datadir/applications/kde
Sub directories of %_datadir/applications are allowed so these are ok, although the kde one should likely use one of the kde macros.
1 Swift/resources 1 /etc/xdg/autostart
This seems to be a valid autostart location although using /usr/share/autostart for consistency would be better
1 %yast_desktopdir/groups 1 %kdeprefix/share/applications 1 %gnome_prefix/share/applications
I presume these both expand to /usr/share/applications which is fine, whether they could use a better macro is another question though.
1 %gnome_prefix/share/application-registry 1 %gnome_datadir/applications 1 %_kf5_sharedir/locale/* 1 %_kf5_sharedir/akonadi/agents 1 %_kf5_sharedir/%name/extras/system 1 %_kf5_servicesdir/kded 1 %_kde4_servicesdir/qimageioplugins 1 %_kde4_appsdir/remoteview 1 %_kde4_appsdir/konqsidebartng/virtual_folders/services 1 %_datadir/tracker/miners 1 %_datadir/susehelp/meta 1 %_datadir/services/kded 1 %_datadir/remoteview 1 %_datadir/konqsidebartng/virtual_folders/services 1 %_datadir/kdm/sessions
Unless this is part of kdm id say there is a fair chance its wrong.
1 %_datadir/kde4/apps/ksmserver/windowmanagers 1 %_datadir/gdm/autostart/LoginWindow 1 %_datadir/appdata
erm - here should be NO desktop files - this is definitively wrong
1 %_datadir/akonadi/agents 1 %_datadir/Thunar/sendto
Most of the things are fine - KDE just uses their own set of macros; a few things are indeed bugs. Please file those as such so they can be verified / fixed.
Cheers Dominique
Those are the ones I remember off the top of my head anyway. -- Simon Lees (Simotek) http://simotek.net Emergency Update Team keybase.io/simotek SUSE Linux Adelaide Australia, UTC+10:30 GPG Fingerprint: 5B87 DB9D 88DC F606 E489 CEC5 0922 C246 02F0 014B

Am Wed, 22 Mar 2017 23:00:28 +0100 schrieb Dimstar / Dominique Leuenberger <dimstar@opensuse.org>:
the 'main' location for .desktop files shown by the various desktops is indeed /usr/share/applications (aka %_datadir/applications)
Thanks.
The idea there was an easy 'move' to /opt should this ever be needed
Nothing moves to /opt. If anyone needs that adjusting _prefix (and consequently _datadir) is the way to go, no spec file must be adjusted for such special case.
3 %buildroot/%_datadir/applications Those are very likely a bug
Most likly in my grep/sed command.
Most of the things are fine - KDE just uses their own set of macros; a
They must not use special macros. Anyway, the last mass fix was rejected, so I will leave it alone. Olaf

On Thu, 2017-03-23 at 08:56 +0100, Olaf Hering wrote:
The idea there was an easy 'move' to /opt should this ever be
needed
Nothing moves to /opt. If anyone needs that adjusting _prefix (and consequently _datadir) is the way to go, no spec file must be adjusted for such special case.
That's what was said in other cases for legacy desktops too - things can happen - that's all
Most of the things are fine - KDE just uses their own set of macros; a
They must not use special macros. Anyway, the last mass fix was rejected, so I will leave it alone.
"must not" ? I can't recall any of our guidelines telling that this would be forbidden in our setup. It's definitively up to the maintainers to decide. Cheers Dominique

Am Thu, 23 Mar 2017 09:20:40 +0100 schrieb Dominique Leuenberger / DimStar <dimstar@opensuse.org>:
"must not" ? I can't recall any of our guidelines telling that this would be forbidden in our setup. It's definitively up to the maintainers to decide.
Its common sense to not invent special macros for the sake of it, even if we have the liberty to do so. As said earlier, %_datadir/whatever is enough. Olaf

On Thu, 2017-03-23 at 09:33 +0100, Olaf Hering wrote:
Am Thu, 23 Mar 2017 09:20:40 +0100 schrieb Dominique Leuenberger / DimStar <dimstar@opensuse.org>:
"must not" ? I can't recall any of our guidelines telling that this would be forbidden in our setup. It's definitively up to the maintainers to decide.
Its common sense to not invent special macros for the sake of it, even if we have the liberty to do so. As said earlier, %_datadir/whatever is enough.
As long as the packaging guidelines do not prohibit it, packagers are free to do what they feel is right in this regards. Not all packages are exclusively openSUSE systems - once thinking beyond, those team MIGHT have a reason to do so. Or should I just interpret your message as a 'vote for change of the packaging guidelines' ? Cheers Dominique
participants (4)
-
Dimstar / Dominique Leuenberger
-
Dominique Leuenberger / DimStar
-
Olaf Hering
-
Simon Lees