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.
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.
Unrelated but doesn't the crate supports passing a window handle under Wayland as well?
There was a problem hiding this comment.
Eventually yes, but this is just in our x11 backend for now.
maan2003
left a comment
There was a problem hiding this comment.
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.
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.
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.