-
Notifications
You must be signed in to change notification settings - Fork 570
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
X11 dialogs, take 2. #2153
X11 dialogs, take 2. #2153
Conversation
if let Err(e) = block_on(async { | ||
let conn = zbus::Connection::session().await?; | ||
let proxy = file_chooser::FileChooserProxy::new(&conn).await?; | ||
// TODO: use the window id. This requires changes in ashpd. |
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.
Yes that is something I want to change, by splitting things between x11 and the Wayland implementation.
Could you open an issue for that and I will have a look at doing that this weekend ?
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.
Unrelated but doesn't the crate supports passing a window handle under Wayland as well?
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.
Eventually yes, but this is just in our x11 backend for now.
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.
LGTM! Just a minor nit.
if open { | ||
callback(proxy.open_file(&id, title, options.into()).await?.uris()); | ||
} else { | ||
callback(proxy.save_file(&id, title, options.into()).await?.uris()); | ||
}; |
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.
any reason to use a callback? can't we just let uris = if open .....
and then inline callback
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.
Yeah, the result of uris()
is borrowed from the objects returned from open_file
or save_file
, so that version will drop the temporary objects too soon. But it works with some extra temporary variables, and indeed I think it's nicer. Thanks!
This doesn't actually have any effect (because ashpd doesn't support XcbHandle yet) and it brings in unnecessary dependencies.
Use xdg-desktop-portal's dbus APIs for open/save dialogs on x11.
Use xdg-desktop-portal's dbus APIs for open/save dialogs on x11.
Use xdg-desktop-portal's dbus APIs for open/save dialogs on x11.
This supersedes #1774 (which I'll close). It has the same bug, which doesn't seem solvable without some acknowledgement from
xdg-desktop-portal
. I'm still not thrilled about this situation, but I don't see another viable path forward to native file dialogs on x11 (and wayland). Therefore I'm inclined to just merge this despite the issue.