-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement support for XDG Desktop Portal #4406
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Never mind. I've decided to only use these portals when compiling with a new |
I couldn't figure out how to get the Wayland window handle so I think I'll leave that until another time. The way file filters work also seem to be very different so I think it would be wise to tackle that later as well. This should be good to be reviewed now. It is working very nicely :) |
06c675b
to
212042d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really cool thanks so much.
Can you open a new issue (or PR? ;) ) to track the missing waylaid handle lookup and file filter etc?
Sure. I'll open an issue for now but will likely try to implement it myself going forward. Especially now with Wayland takin shape |
Description:
This is a WIP PR to implement support for using XDG Desktop Portal (https://flatpak.github.io/xdg-desktop-portal/) for interacting with the host system (notifications, file choosers etc.). At this point only notifications are added.
I have decided to only use these when we compile with
-tags flatpak
for now. If we want to use native file dialogs outside of the sandbox then that's a different decision to be had.Fixes #3378, #3377
File and folder dialogs
Everything except for file filters and changing the dismiss button text has been set up and is working perfect. The first one seems like it might be problematic to get working but should be possible. The latter will not be possible to implement (and probably doesn't matter that much).
Running inside Flatpak with no added file or notification permissions:
Screencast from 2023-11-19 21-50-07.webm
Opening URLS
The
app.OpenURL()
method has been updated to use theOpenURI
portal. Not 100% necessary because thexdg-open
command we used before already works but going through the portal is the recommended approach as far as I know. It should allow the user to theoretically deny an app from opening links.Notifications
From the documentation:
I decided to go with the last part where we can use the name of the application icon. It has the downside of resulting in applications having no icon unless they have been installed. It is perhaps not optimal but it is a lot better than no icon at all and I didn't want to mess around with some GTK icon serialization stuff.
The code is currently using the appID as the icon key even though we are building tarballs where the icon is named after the application name in
fyne package
. Flatpak and other tools want the desktop files and icons to be named after the application id and not the application name so we were doing the wrong thing all along. I will update the code to use that instead.No icon:

Using

io.github.jacalz.rymdport
as appID (with it installed) works:TODO:
Switch Linux/BSD tarballs usingfyne package
to use appid instead of app name for files.FileChooser
.OpenURI
.-tags flatpak
.Checklist: