Skip to content

app-chooser: Relax app-id requirement for choices#1741

Open
agx wants to merge 1 commit into
flatpak:mainfrom
agx:app-chooser-desktop-file
Open

app-chooser: Relax app-id requirement for choices#1741
agx wants to merge 1 commit into
flatpak:mainfrom
agx:app-chooser-desktop-file

Conversation

@agx

@agx agx commented Jun 18, 2025

Copy link
Copy Markdown
Contributor

This is a follow up from a discussion in the matrix room coming from ashdp requiring an actual app-id where as other current portal backends don't:

Many system apps still use a desktop file name that isn't an app-id as they don't contain a dot. Popular examples are firefox, emacs and vim.

Thus relax the app-id requirement allowing for the base name of the desktop file.

/cc @bilelmoussaoui @arun-mani-j

Many system apps still use a desktop file name that isn't an app-id as
they don't contain a dot. Popular examples are firefox, emacs and vim.

Thus relax the app-id requirement allowing for the base name of the
desktop file.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
@agx agx force-pushed the app-chooser-desktop-file branch from deff176 to 6f7e972 Compare June 18, 2025 14:57
@GeorgesStavracas

Copy link
Copy Markdown
Member

I don't think this is desired, sorry. Instead of relaxing a well known, easy to conform requirement, these apps should provide a properly named desktop file.

Comment on lines +115 to +118

Note: To be able to handle legacy system apps the ids in `choices` are
in practice the base name of the desktop file without the `.desktop`
extension.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GeorgesStavracas we are not trying to lower the requirement, we are just clarifying the meaning, so that future backend implementation authors don't end up in the same confusion loop.

The changes made explicitly says that it is for legacy apps. Newly made apps and apps already following the standard are in no way affected too.

If you think we can reword it better so that it is clear, we can use those words instead :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think that backend implementations should reject invalid app IDs, then XDP should be changed to validate the IDs before sending to the backend implementations, but that's going to be a break change.

Or the spec must be reworded to say that it is up to the backend implementation to decide if they want to accept the request of invalid app IDs or not. But that will unofficially move everyone to supporting as the major portal implementations - GNOME and KDE do support them.

Also, we are talking about the app IDs sent by XDP in AppChooser interface.
So the invalid app ID does not come from the backend or XDP or the original requesting app, but just because user has a random app in their system that has an invalid app ID and it registers itself to handle a file type.

Either way, the ultimate goal is the spec must clearly express something instead of leaving it in ambiguity :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GeorgesStavracas The change documents the current practice the portal implementations follow. The alternative would be to have open-uri reject all non valid app-ids in the first place to have the result not being dependent on the backend implementation. Currently e.g. the gtk and gnome portals happily list vim/emacs for their given mime types although the desktop file is vim.desktop.

@bilelmoussaoui

Copy link
Copy Markdown
Member

I am not so sure we really want this even if xdp internally sends you actual desktop file name and not an app-id here and in various other places as fallbacks (for host apps?).

So is this requirement specific to flatpak apps? how does snap behave in this case for portals other than the AppChooser? before committing to clarify this, we should investigate what is the most correct way forward and either fix those apps to use a RDNN desktop file name, fix xdp & the docs or fix ashpd.

@agx

agx commented Jun 19, 2025

Copy link
Copy Markdown
Contributor Author

Can you elaborate what "various other places" you mean? I did look around for similar places but this backend is the only one I could find where the portal would send the ids of other apps to the backend so this particular solution would be for just this case.

@bilelmoussaoui

Copy link
Copy Markdown
Member

Can you elaborate what "various other places" you mean? I did look around for similar places but this backend is the only one I could find where the portal would send the ids of other apps to the backend so this particular solution would be for just this case.

Not exposed to the frontends but they are used in places like https://github.com/flatpak/xdg-desktop-portal/blob/main/src/wallpaper.c#L191-L208

@bilelmoussaoui

Copy link
Copy Markdown
Member

If we decide what is passed here is the actual destkop files basenames, the param names should be renamed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants