plugins-workspace icon indicating copy to clipboard operation
plugins-workspace copied to clipboard

Upgrade `tauri-plugin-dialog` to `gtk4-rs` (potentially updating the upstream crate `rfd`)

Open tweidinger opened this issue 10 months ago • 6 comments

We need to upgrade from gtk to gtk4-rs to migrate a unsoundness issue found in glib < 0.2. Please claim this issue if you want to support or work on this and keep in mind this is a prioritized issue and we try to migrate as soon as possible. If the issue is already assigned to someone you can either reach out with comments or questions reach out for collaboration to the assigned person.

This transition includes:

  • [ ] Upgrading gtk to gtk4-rs and handling all errors caused by the dependency change
  • [ ] Handle all changes in a backwards compatible way if possible
    • [ ] Raise awareness to the working group if breaking changes are required
  • [ ] Document migration errors that may be issues in the future or which were complicated to handle
  • [ ] Reach out to the working group (alternatively @tweidinger first) if blockers or upstream issues are hit

A possible alternative would be using the xdg feature instead, at least to unblock us and focus on the other upgrades. We'll lose the message dialogs on Linux but imo that can be a fair tradeoff. Further discussion on this should happen if no one claims and implements the transition including potential work on rfd.

tweidinger avatar Jan 30 '25 02:01 tweidinger

Hello,

I've come here to say that the status of the rfd documentation have been outdated for a bit and I've just help updated them PolyMeilex/rfd#272.

The xdg_desktop backend can actually do message dialogs using zenity.

Additionally, there is an open issue for upgrading rfd to gtk4-rs PolyMeilex/rfd#227 but it seems the gtk backend isn't really recommended and described as a hacky feature.

I could see if I could try to create a backend for gtk4 if it really is required, but I can't promise anything.

Personally, I'd prefer using xdg_destkop backend as that allows the user to use their file manager of their desktop environment, but I can see the case where a user doesn't have any desktop portal installed, though I'm pretty that would be rare case.

If we do use gtk4 for the dialogs, maybe we could add an option between xdg_desktop and gtk adding an optional xdg_desktop feature for tauri-plugin-dialog so developers can pick between them.

I would love to here any thoughts on this, I really like tauri, it's what got me into rust.

Lepidopteran avatar Nov 11 '25 16:11 Lepidopteran

If we can open message dialogs now then there's no reason to keep the GTK backend an option in v3 (I wouldn't bother adding xdg in v2)

FabianLars avatar Nov 11 '25 16:11 FabianLars

Awesome!

I wouldn't bother adding xdg in v2.

That's understandable, I'll probably just use rfd and invoke it as a command for my application or create a plugin similar to tauri-plugin-dialog that just uses xdg backend while I wait for V3.

Thank you for time!

Lepidopteran avatar Nov 11 '25 16:11 Lepidopteran

Tbh I didn't expect anyone to have a use case for it yet. So if you do I don't actually mind adding a feature flag

FabianLars avatar Nov 11 '25 16:11 FabianLars

That would be awesome!

I wouldn't mind making a PR if you are too busy!

Lepidopteran avatar Nov 11 '25 16:11 Lepidopteran

PRs are always appreciated :)

FabianLars avatar Nov 11 '25 17:11 FabianLars