Giter Club home page Giter Club logo

Comments (13)

Blist avatar Blist commented on July 17, 2024 1

Hello,

I come from Tauri v2 alpha here, and open a Dialog freeze the application. I'm using archlinux with wayland and hyprland, seems to be related to this.
With the taui v1.3 version I don't have the problem.

from rfd.

RenjiSann avatar RenjiSann commented on July 17, 2024

For references, here are my main.rs and Cargo.toml. I also add that everything works well when using the default feature flags with the gtk backend.

use rfd::FileDialog;

fn main() {
    println!("Hello, world!");

    let files = FileDialog::new()
        .set_directory("/")
        .pick_file();

    println!("files: {:?}", files);
}
[package]
name = "test"
version = "0.1.0"
edition = "2021"


[dependencies]
rfd = { version = "0.12.1", default-features = false, features = [
    "xdg-portal",
] }

from rfd.

alerque avatar alerque commented on July 17, 2024

I'm having similar issues. The main difference in my setup is I'm using xdg-desktop-portal-hyprland as the backend instead of -gtk.

from rfd.

LIMPIX31 avatar LIMPIX31 commented on July 17, 2024

I have encountered this problem in tauri with xdg-desktop-portal-hyprland

from rfd.

Friz64 avatar Friz64 commented on July 17, 2024

running cargo run --example save --no-default-features --features xdg-portal works on both my desktop arch box running gnome and xdg-desktop-portal 1.18.2 as well as my fedora laptop running the same configuration

from rfd.

PolyMeilex avatar PolyMeilex commented on July 17, 2024
Name         : xdg-desktop-portal
Version      : 1.18.2
Name         : xdg-desktop-portal-gtk
Version      : 1.15.1
Name         : xdg-desktop-portal-gnome
Version      : 45.0

Works fine here.

@alerque

The main difference in my setup is I'm using xdg-desktop-portal-hyprland as the backend instead of -gtk.

hyperland portal does not provide a file picker, or anything beyond screen sharing. You have to have a portal that does next to hyperland portal. (You can, and should run both)

I have encountered this problem in tauri with xdg-desktop-portal-hyprland

@LIMPIX31
Probably same as above

(PS. just don't mistake freedesktop's gtk portal for gnome portal, as the former one will most likely not work for you on hyperland)

EDIT: Yep. hyperland wiki says the same thing: https://wiki.hyprland.org/Useful-Utilities/Hyprland-desktop-portal/#installing

from rfd.

LIMPIX31 avatar LIMPIX31 commented on July 17, 2024

Hello,

I come from Tauri v2 alpha here, and open a Dialog freeze the application. I'm using archlinux with wayland and hyprland, seems to be related to this. With the taui v1.3 version I don't have the problem.

The same. I have tried different versions of rfd and xdg-desktop-portal but no result.

from rfd.

PolyMeilex avatar PolyMeilex commented on July 17, 2024

That's unrelated, Tauri does not use xdp backend

from rfd.

mibuthu avatar mibuthu commented on July 17, 2024

For me a workaround is to pin the rfd version to 0.12.0:
rfd = "=0.12.0"

Change this to a newer version (e.g. 0.12.1) causes this issue again.

from rfd.

PolyMeilex avatar PolyMeilex commented on July 17, 2024

How about master? We updated ashpd perhaps that helps somehow

from rfd.

mibuthu avatar mibuthu commented on July 17, 2024

With master:
rfd = { git = "https://github.com/PolyMeilex/rfd.git", branch = "master" }
I still have the same issue as with version 0.12.1 or 0.13.0

from rfd.

PolyMeilex avatar PolyMeilex commented on July 17, 2024

How about now? Either master or new 0.14
XDG Backend now has zenity fallback.
And XDG Backend is not the default, without the need to enable any features.

from rfd.

mibuthu avatar mibuthu commented on July 17, 2024

Great, for me the issue is solved with version 0.14.0.

==============

Some more information from my testing in the last days:
I my case it seems to be an issue with a combination of rfd with some other framework (in my case slint).

The following minimal code was also working with the problematic versions 0.12.1 and 0.13.0:

use std::path::PathBuf;

fn main() {
	rfd();
}

fn rfd() {
    let current_dir = PathBuf::from("/tmp");
    println!("Current dir: {}", current_dir.display());
    let new_dir: PathBuf = rfd::FileDialog::new()
        .set_title("Folder selection")
        .set_directory(&current_dir)
        .pick_folder()
        .unwrap_or(current_dir)
        .to_string_lossy()
        .to_string()
        .into();
    println!("New dir: {}", new_dir.display());
}

But adding slint to the party with the following code, the problem was reproducible:

use std::path::PathBuf;

slint::slint!{
	import { Button } from "std-widgets.slint";

    export component HelloWorld {
        callback rfd;
        
        Button {
            text: "rfd";
            clicked => { rfd() }
        }
    }
}

fn main() {
	let app = HelloWorld::new().unwrap();
	app.on_rfd({
		move || {
			rfd()
		}
	});
	app.run().unwrap();
}

fn rfd() {
    let current_dir = PathBuf::from("/tmp");
    println!("Current dir: {}", current_dir.display());
    let new_dir: PathBuf = rfd::FileDialog::new()
        .set_title("Folder selection")
        .set_directory(&current_dir)
        .pick_folder()
        .unwrap_or(current_dir)
        .to_string_lossy()
        .to_string()
        .into();
    println!("New dir: {}", new_dir.display());
}

from rfd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.