Why the duplicate .desktop file entries?

Normally, all my .desktop entries are always in /usr/share/applications.

I noticed that I had a duplicate thunderbird entry in ‘default applications’ section of KDE settings, so I did some digging and found that somehow I have some new .desktop entries in /.local/share/applications.

Is it safe to delete these? Why would these end up in here anyway when they’re also in the /user/share/applications?

I feel like I took a peak in this folder a few weeks ago and it was empty.

If you edit them using a tool to change settings, they get copied there with your changes.

The files in .local override the ones in /usr/share

You mean editing the .desktop entries in usr/share/applications?

If so, I haven’t done that for these specific apps.

No, i mean through an application that lets you modify the menu.

For example, configure applications in kde

Haven’t done that, either.

I wonder if this is in any way tied to KDE 6 recent updates. Been noticing a few weird quirks here and there.

Oh well, moved it to a diff folder for now to see if it breaks anything before deleting.

/usr/share/applications is the default location for .desktop entries.

~/.local/share/applications is the user specific location for .desktop entries it allows the user to override the .desktop entry, customize it essentially. Normally it’s used by application launchers which allow you to edit default launch options and such for an application.

But you can also just copy paste a file from /usr/share/applications to ~/.local/share/applications and edit it for that same effect, I do this quite a lot actually.

1 Like

I ended up deleting them and all seemed fine.

I just wasn’t sure how they auto generated, as I never edited anything for that to happen.

Nothing broke, so I’m good

Is it possible that you got them from a timeshift restore operation? Or some other backup restore thing?

If you create a keyboard shortcut, it seems to create a copy there (bizarrely).

These are obviously created by an application, either the relevant one (Discord created a custom discord entry), or from the DE (Plasma settings, or other plasma component), from a user session (user privileges).

If there is no documentation from the above programs about it, you should find some signs/clues reading those files’ contents.

Those are menu entries for any XDG-compatible application menu. They do not necessarily override other existing menu entries, rather add new similar ones for another existing one. In order to override, the file name must be exactly the same, which, as it seems from the screenshot, the file name includes a hash/string in the file’s basename (without the extension).

Possible use cases are

  • a shortcut for a program launcher
  • a menu entry with an altered command (Exec= key).

Also, it is possible they include custom Show/Hide instructions, as the creator program is designed to do, using keys like

Display=false # hidden in menus
OnlyShowIn=KDE; # for example
NotShowIn=Gnome; # or other

or with extra program-specific keys, like for example

X-DiscordWorkingDirectory=<some-dir-path>
X-KDE-autostart-phase=2

etc.

1 Like