flathub / com.saivert.pwvucontrol

https://flathub.org/apps/details/com.saivert.pwvucontrol
0 stars 0 forks source link

Missing icons for other flatpak applications #3

Open prodrigestivill opened 3 months ago

prodrigestivill commented 3 months ago

Currently there are no icons for any flatpak applications in the playback and recording panels.

To solve only the flatpak applications installed as system, it can be solved with something like this:

flatpak override com.saivert.pwvucontrol \
        --filesystem=/var/lib/flatpak:ro \
        --env="XDG_DATA_DIRS=/app/share:/usr/share:/usr/share/runtime/share:/run/host/user-share:/var/lib/flatpak/exports/share:/run/host/share"

And this change is proposed as PR #2.

But in order to have a workaround for the flatpak applications installed in the user home, it's a little bit more tricky, mostly since ~ doesn't seam to be resolved by XDG_DATA_DIRS.

Even that the folder can be shared using --filesystem=xdg-data/flatpak:ro but then to discover the "previous" XDG_HOME_DIR from outside the sandbox a launcher script to setup XDG_DATA_DIRS env var will be required, inside this script it can be discovered the shared paths using something like this:

awk 'BEGIN{ORS=":"}match($2,/flatpak$/){print $2"/exports/share"}' /proc/mounts

Please tell me if you want me to implement such launcher script in a PR.

As a temporal workaround, each user can run this on their shell and it will resolve the variables before adding the user paths:

flatpak override --user com.saivert.pwvucontrol \
        --filesystem=xdg-data/flatpak:ro \
        --filesystem=/var/lib/flatpak:ro \
        --env="XDG_DATA_DIRS=/app/share:/usr/share:/usr/share/runtime/share:/run/host/user-share:${HOME}/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/run/host/share"
saivert commented 3 months ago

If we can also solve the issue of getting access to host application icons then I'm all for this. But until then I will simply not show any icons for applications at all when running as a Flatpak app. This "fix" will land in the next release of pwvucontrol.

prodrigestivill commented 3 months ago

I'm not sure I understood it correctly. I understood that you prefer to hide all application icons if we can't assure that all kinds of application would work.

To clarify, here is the sum up the current situation as I understand:

Currently flatpak pwvucontrol without any override at all, it already displays all host "system" applications (deb, rpm, etc...) and "user space" installed (using ~/.local/share/ for desktop files and icons).

As for flatpak applications, with the initial proposed permission change (#2) it will also display the flatpak --system installed applications. Additionally I proposed I can also update the PR with a fix for flatpak --user installed applications.

For the snap applications, I believe I can also update the PR to make it work too but this I haven't tested yet.

For the rest of applications like AppImage and custom installers using non-standard icon paths (ex. /opt/), as I understand even flatpak supports giving full read access to the whole filesystem, since the paths will change (/run/host/) it will not work.

To conclude, the only apps we can't fix as of now would be AppImage and custom installers. And I respect that you prefer to hide all application icons if we can't assure that all kinds of application would work.

Feel free to answer me if I misunderstood you and I can help in any way as offered above. And in any case, thank you for creating this app 🥳.

saivert commented 3 months ago

I think flatpak doesn't provide access to /usr/local/share/icons. I was testing with Deadbeef which I have installed from source and then it is installed to /usr/local by default, the icon wasn't showing in pwvucontrol run as flatpak and thus I concluded that host icons was not available as well. This was an error on my part. I tested with the Videos app now and I can see the icon.

prodrigestivill commented 3 months ago

Oh, yes, true! I forgot about this path! Some distros have this path empty and I forgot.

So yes, applications installed in /usr/local doesn't seam to be able to get discovered by default (even if they come from rpm or deb or whatever).

For those we might also be able to fix its discovery by using something like that:

flatpak override com.saivert.pwvucontrol \
        --filesystem=host-os \
        --filesystem=/var/lib/flatpak:ro \
        --env="XDG_DATA_DIRS=/app/share:/usr/share:/usr/share/runtime/share:/run/host/user-share:/var/lib/flatpak/exports/share:/run/host/usr/local/share:/run/host/share"

In any case, and as said, AppImage and custom installers might not have a chance to get fixed.

But if you as the application developer decide to always hide the icon in the flatpak version (as mentioned) or prefers to add a workaround please tell me.

As said I believe I can do a workaround for:

Thanks for all.

saivert commented 3 months ago

What I'm unsure about is some sort of justification for enabling this many sandbox holes just to get icons working.

When I got pwvucontrol accepted on Flathub it was with the current set of access which is very limited.

At the end of the day icons is just a nice to have thing and not mandatory for the functioning of the application.

prodrigestivill commented 3 months ago

I agree, thanks. 🙂

Feel free to close this issue or leave it open for future reference.