rfd icon indicating copy to clipboard operation
rfd copied to clipboard

starting directory support with XDG Desktop Portal backend

Open Be-ing opened this issue 2 years ago • 6 comments

https://github.com/PolyMeilex/rfd/blob/e331eff49a95b095e2e82750af114cf0c81c3dfd/src/backend/xdg_desktop_portal.rs#L199

Be-ing avatar Jan 19 '22 05:01 Be-ing

This was fixed in ashpd 0.3 btw

bilelmoussaoui avatar Mar 19 '22 20:03 bilelmoussaoui

But it is still not supported for OpenFileOptions

ogoffart avatar May 10 '22 09:05 ogoffart

But it is still not supported for OpenFileOptions

That needs to be implemented in the portals themselves, so in https://github.com/flatpak/xdg-desktop-portal/. ashpd is just a rust wrapper for the dbus interfaces.

bilelmoussaoui avatar May 10 '22 09:05 bilelmoussaoui

Issue was opened at https://github.com/flatpak/xdg-desktop-portal/issues/796, i will look into fixing it in the upcoming days

bilelmoussaoui avatar May 10 '22 12:05 bilelmoussaoui

Waiting on https://github.com/bilelmoussaoui/ashpd/pull/90 to get merged.

bjorn avatar Nov 10 '23 08:11 bjorn

The replacement PR https://github.com/bilelmoussaoui/ashpd/pull/173 was merged, so this is waiting on a new release of ashpd now.

bjorn avatar Dec 20 '23 14:12 bjorn

https://docs.rs/ashpd/latest/ashpd/desktop/file_chooser/struct.OpenFileRequest.html#method.current_folder Support for default directories has been added in ashpd 0.7.0

I'll try to create a PR for this since it would be nice to have feature parity, and especially since xdg is now the default.

theRookieCoder avatar Feb 20 '24 15:02 theRookieCoder

Yep, just copy and paste this line: https://github.com/PolyMeilex/rfd/blob/8646b508e9c85c29e1865e83d2f7f444595d98ac/src/backend/xdg_desktop_portal.rs#L211C18-L211C32 to all dialog types

PolyMeilex avatar Feb 20 '24 15:02 PolyMeilex

Support for default directories has been added in ashpd 0.7.0

According to https://github.com/bilelmoussaoui/ashpd/releases current_folder support has been added to OpenFile in ashpd 0.6.8, just in case that is relevant in terms of compatibility.

Thanks for contributing to this functionality!

bjorn avatar Feb 20 '24 15:02 bjorn

~Hmm I can't compile zbus_names 2.6.0 on linux because zvariant::Str<'_>: From<Cow<'_, str>> is not satisfied, is this a known issue? Also occurs with the rfd 0.14.0 crates.io release, no problems on 0.13~ Sorry for the false alarm, it seems to be an issue with a different dependency I have.

Edit: I can reproduce the compilation error by using both rfd 0.14.0 and dark-light 1.0.0 in an empty project. rfd uses zbus v4 through ashpd but dark-light seems to use zbus v3, I believe some sort of clash between these two is what is causing the error.

theRookieCoder avatar Feb 21 '24 06:02 theRookieCoder

Doesn't seem to work. No errors or anything, the picker just doesn't open the given directory.

image

Edit: FileDialog.save_file() somehow still works despite using the same code

theRookieCoder avatar Feb 21 '24 07:02 theRookieCoder

Doesn't seem to work. No errors or anything, the picker just doesn't open the given directory.

image

Edit: FileDialog.save_file() somehow still works despite using the same code

Sounds like a KDE portal implementation error/issue

bilelmoussaoui avatar Feb 21 '24 07:02 bilelmoussaoui

Yup I can confirm it works on GNOME. Although it's weird that the save file works properly, because that means it's still partially implemented elsewhere.

theRookieCoder avatar Feb 21 '24 08:02 theRookieCoder

Would be great to get a new version with this fix, as it currently is a regression when running rfd version 0.14.0 with default features:

  • with versions < 0.14.0 the the set_directory function is working correctly
  • with version 0.14.0 the set_directory function is not working
  • with master the set_directory function is working correctly again

mibuthu avatar Mar 06 '24 21:03 mibuthu