regolith-linux / ilia

A GTK-based Desktop Executor
Apache License 2.0
83 stars 11 forks source link

(Applications) flatpak application are not found due to ignoring symlinks #49

Closed cjthompson closed 1 year ago

cjthompson commented 2 years ago

Description

https://github.com/regolith-linux/ilia/blob/master/src/apps/DesktopAppPage.vala#L269

The function to search for desktop files explicitly ignores symlinks. Flatpak uses symlinks to reference desktop files inside of Flatpak artifacts.

This is a regression from the previous release, which did include Flatpak desktop files.

Example

ls -l /var/lib/flatpak/exports/share/applications

lrwxrwxrwx 1 root root  93 Oct 31 09:15 cc.arduino.IDE2.desktop -> ../../../app/cc.arduino.IDE2/current/active/export/share/applications/cc.arduino.IDE2.desktop*
lrwxrwxrwx 1 root root 107 Oct 31 09:15 com.discordapp.Discord.desktop -> ../../../app/com.discordapp.Discord/current/active/export/share/applications/com.discordapp.Discord.desktop*
lrwxrwxrwx 1 root root 107 Oct 31 09:15 com.getpostman.Postman.desktop -> ../../../app/com.getpostman.Postman/current/active/export/share/applications/com.getpostman.Postman.desktop*

None of these applications are available in Ilia.

kgilmer commented 2 years ago

Thanks for the details @cjthompson . In this case the issue is that recent changes source app dirs from dconf rather than $XDG_DATA_DIRS, but this flatpack directory is not in the list I specify as default. I'll have to think about it a bit but leaning towards sourcing dirs from the set of the two.

cjthompson commented 2 years ago

In this case the issue is that recent changes source app dirs from dconf rather than $XDG_DATA_DIRS,

If that's the case, then I should be able to just update the configuration to fix it? Is this just a documentation problem then rather than a technical one?

edit: I used dconf-editor to change the value of app-search-paths and that fixed my issue.

kgilmer commented 2 years ago

Well ideally things should "just work" if possible. To reproduce this issue I installed a flatpack app for testing. The dependencies to flatpack causes a change to XDG_DATA_DIRS to include the desktop file path you mention above. It would be best if ilia can use that. The reason I switched away was that, as a DE, it seems possibly out of scope to mutate XDG_DATA_DIRS. But more seriously, I found that doing that on Debian Bullseye totally bricked X11 and I was unable to troubleshoot why. So, I was left feeling uneasy about anything that involved making changes there, as bricking someone's desktop is to be avoided at all costs.

kgilmer commented 2 years ago

Related PR: https://github.com/regolith-linux/regolith-session/pull/5

kgilmer commented 2 years ago

The logic to determine the desktop app paths is on the critical path of dialog bring up. As such, I prefer not to introduce more things to be done if it's avoidable. Looks like I will need to read and dedupe from both lists, use a fancier datatype, or leave it to the user to ensure their paths are correct. I also want to avoid fancy cache logic. I'm thinking the best option may be just to append the flatpack path to the search paths in dconf.. I've already got one for snap desktop files :shrug:

kgilmer commented 2 years ago

After digging some more into the glib docs, I found it's possible to delegate entirely to glib for desktop apps. The performance of this feels faster and in some simple testing the performance variance is much lower. I'm going w/ this new approach and will remove app-search-paths altogether unless there is some reason to revert.

kgilmer commented 1 year ago

In Regolith 2.2 ilia calls a GLIB API for getting desktop apps rather than manually sourcing from the filesystem. Please re-open this issue of app desktop file sourcing is not working as expected in 2.2.