Implementing AppImage desktop integration #7127
Replies: 2 comments 3 replies
For most of the questions that'll be a much better option.
I think it should follow the XDG settings, not blindly write to this location
How do we make sure it follows the apps internal ID?
I think in any case it should fail unless you force it. It doesn't really matter what the content is.
Yes
btop is not a cask though, it's a formula. I think there might be value in bringing symlinks for desktop files in formulae, but that's a separate discussion. |
|
Copy into ~/.local/share/applications is something that was already suggested to merge but rejected. There should be a better solution. See PR#23674 |
Uh oh!
There was an error while loading. Please reload this page.
Hi, I'm implementing desktop integration for AppImages. Currently they are copied to
~/Applications, but unlike macOS, an additional step is required on Linux before desktop environments, launchers, etc. see them. On the surface it's pretty simple - just extract the embedded*.desktopfile (which contains launch command and other metadata) into~/.local/share/applications. But there are several edge cases that need to be considered, so I thought I should open a discussion.If you'd like me to start a PR with my current implementation and discuss there instead, let me know. Here are my questions:
Imagine we are trying to install
~/Applications/Foo.AppImageand~/.local/share/applications/com.foo.desktopShould we rename/version/namespace the desktop file?
We could put them in a
homebrew/subdir, or prepend the name withhomebrew-. Most existing AppImage managers rename it in some way. But according to the spec the file name matters. I did extensive testing and if it doesn't match the app's internal ID, it breaks some things. So I think we should keep the name where possible.What if the file already exists?
If both the target AppImage and its desktop file exist, then the answer is obvious, fail unless
--forceor--adopt.But what if
com.foo.desktopexists and doesn't point to~/Applications/Foo.AppImage? This could happen if two packages have the same desktop file name, or the user manually downloaded~/Downloads/Foo.AppImage, ran it, and it self-installed the file. Is it reasonable then to fall back to a rename with a warning, even without--force, so as not to break the existing app's integration? We can ask them toreinstall -fto overwrite if they wish.What if the user changes the file before an upgrade?
The user might want to add custom parameters or env vars, etc. Do we just overwrite on package upgrade? Do some sort of merge? Ask the user?
There is another way that avoids most of these issues
Brew already has its own
.linuxbrew/share/applicationsand some packages likebtoplink their desktop files there, but they are currently unused on Linux. To use it, we would have to ask the user to add to their session's$XDG_DATA_DIRor just create~/.config/environment.d/homebrew.conf. We can't handle it atbrew shellenvlevel since it needs to reach the graphical session. If we do this, we can have complete ownership of all*.desktopfiles. The user can still override them by copying them to~/.local/share/applicationsand editing them. We will still have to deal with potential duplicate names across packages.The caveat is that this only works if the shell inherits
systemd --userenvironment. So may not work for some setups.My current implementation writes to the regular dir, but I think 4 would be the more conservative change. We are only ever adding a single file to
~/.config/environment.d. I have tested that approach on Noctalia/Niri and Gnome on Ubuntu. On setups where it doesn't work, the behavior remains the same as present (no desktop integration). So let me know what you think.All reactions