Biont/sway-launcher-desktop

Desktop file ID priority

DanielVoogsgerd opened this issue · 5 comments

Right now all desktop files are loaded and displayed. But according to the specification this should not be the case. The problem arises when you override a desktop file by placing it in a preceded $XDG_DATA_DIR directory. If the Desktop file ID is identical. The one that occurred first should be shown and all others should be ignored.

I encounter this problem with firefox.desktop. I have a desktop file in ~/.local/share/applications/ to override the native desktop entry. This because I want to give it the env var GDB_BACKEND=wayland

I'll leave the exact specifications below and I won't try to reformulate what is said there. The spec is quite clear.

Relevant spec:

Biont commented

Good point. While I never really aimed for spec compliance when I started out, there's nothing really wrong with trying to get there going forward. Especially with low hanging fruit like this.

Should be easy enough to do.

Thank you for the hint.

Biont commented

@DanielVoogsgerd If you have some time, can you have a look at #4 and tell me if this solution works for you?

I initially tried to pull it off with bash (->iterate over the complete list of desktop files and skip ones with a duplicate ID), but that solution came with a pretty noticeable performance penalty. Luckily, awk can do everything for us as long as we feed it the entire list of files (as opposed to one directory at a time). This still comes with some reduced performance, but it's much less noticeable

Looks good to me!

EDIT: I was too enthusiastic too soon. I have some desktop files that aren't showing anymore. I'll investigate the issue and elaborate later.

Biont commented

@DanielVoogsgerd Were you able to take a look in the meantime? Maybe you could provide one or more of the .desktop files that no longer show up (maybe along with the path they're from) so we can build a test case to run against

Biont commented

@DanielVoogsgerd Please create a new issue when you find the time to have a look.