bilelmoussaoui / ashpd Goto Github PK
View Code? Open in Web Editor NEWA Rust wrapper around XDG portals DBus interfaces
Home Page: https://bilelmoussaoui.github.io/ashpd/ashpd/
License: MIT License
A Rust wrapper around XDG portals DBus interfaces
Home Page: https://bilelmoussaoui.github.io/ashpd/ashpd/
License: MIT License
max_thread_high_priority_with_pid()
priority is supposed to be an i32
and not a u32
.
See flatpak/xdg-desktop-portal#834 and also the actual DBus interface xml.
I have trouble to save the picture by screenshot to the location of mine .
If it is posible?
It is very hard to reproduce as it happens very rarely. Although, it is reproducible from the demo through screencast by creating a session. (Haven't tested other)
The log shows the following:
** (process:43167): WARNING **: 14:41:02.960: Invalid client serial
The process 43167, according to system monitor, is xdg-dbus-proxy
.
I'll add some additional information, ill try to debug
In a lot of cases the inputs are optional and having a function that takes a lot of Option is sub-optimal.
This would allow people to write a portals implementations in rust.
Very low priority, just in case might want to work on this
org.freedesktop.impl.portal.Access
— Interface for presenting an access dialogorg.freedesktop.impl.portal.Account
— Backend for the portal for obtaining user informationorg.freedesktop.impl.portal.AppChooser
— Interface for choosing an applicationorg.freedesktop.impl.portal.Background
— Background portal backend interfaceorg.freedesktop.impl.portal.Email
— Email portal backend interfaceorg.freedesktop.impl.portal.FileChooser
— File chooser portal backend interfaceorg.freedesktop.impl.portal.GlobalShortcuts
org.freedesktop.impl.portal.Inhibit
— Inhibit portal backend interfaceorg.freedesktop.impl.portal.Lockdown
— Lockdown backend interfaceorg.freedesktop.impl.portal.Notification
— Notification portal backend interfaceorg.freedesktop.impl.portal.PermissionStore
— Database to store permissionsorg.freedesktop.impl.portal.Print
— Print portal backend interfaceorg.freedesktop.impl.portal.RemoteDesktop
— Remote desktop portal backend interfaceorg.freedesktop.impl.portal.Request
— Shared request interfaceorg.freedesktop.impl.portal.ScreenCast
— Screen cast portal backend interfaceorg.freedesktop.impl.portal.Screenshot
— Screenshot portal backend interfaceorg.freedesktop.impl.portal.Secret
— Secret portal backend interfaceorg.freedesktop.impl.portal.Session
— Shared session interfaceorg.freedesktop.impl.portal.Settings
— Settings portal backend interfaceorg.freedesktop.impl.portal.Wallpaper
— Portal for setting the desktop's WallpaperSee #41 (comment) and the TODO comment in src/window_identifier.rs
I'm getting the following error when trying to use the color_scheme()
method or trying to read it directly with the read()
method.
Error: ZBus Error: incorrect type
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let connection = ashpd::zbus::Connection::session().await?;
let proxy = ashpd::desktop::settings::SettingsProxy::new(&connection).await?;
let color_scheme = proxy.color_scheme().await?;
match color_scheme {
ashpd::desktop::settings::ColorScheme::PreferDark => println!("Dark"),
ashpd::desktop::settings::ColorScheme::PreferLight => println!("Light"),
ashpd::desktop::settings::ColorScheme::NoPreference => println!("Default"),
};
Ok(())
}
I'm able to get the key using qdbus
qdbus org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read "org.freedesktop.appearance" "color-scheme"
Output: 1
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Zbus(Variant(IncorrectType))', examples/color_scheme.rs:5:51
stack backtrace:
0: 0x55bd3181d350 - std::backtrace_rs::backtrace::libunwind::trace::he615646ea344481f
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x55bd3181d350 - std::backtrace_rs::backtrace::trace_unsynchronized::h6ea8eaac68705b9c
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x55bd3181d350 - std::sys_common::backtrace::_print_fmt::h7ac486a935ce0bf7
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:65:5
3: 0x55bd3181d350 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1b5a095d3db2e28f
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:44:22
4: 0x55bd3183d60e - core::fmt::write::h445545b92224a1cd
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/fmt/mod.rs:1209:17
5: 0x55bd31818155 - std::io::Write::write_fmt::h55a43474c6520b00
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/io/mod.rs:1682:15
6: 0x55bd3181d115 - std::sys_common::backtrace::_print::h65d20526fdb736b0
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:47:5
7: 0x55bd3181d115 - std::sys_common::backtrace::print::h6555fbe12a1cc41b
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:34:9
8: 0x55bd3181e9cf - std::panicking::default_hook::{{closure}}::hbdf58083140e7ac6
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:267:22
9: 0x55bd3181e70a - std::panicking::default_hook::haef8271c56b74d85
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:286:9
10: 0x55bd3181f0c8 - std::panicking::rust_panic_with_hook::hfd45b6b6c12d9fa5
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:688:13
11: 0x55bd3181ee67 - std::panicking::begin_panic_handler::{{closure}}::hf591e8609a75bd4b
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:579:13
12: 0x55bd3181d7fc - std::sys_common::backtrace::__rust_end_short_backtrace::h81899558795e4ff7
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:137:18
13: 0x55bd3181eb82 - rust_begin_unwind
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5
14: 0x55bd312dc8e3 - core::panicking::panic_fmt::h4235fa9b4675b332
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14
15: 0x55bd312dcba3 - core::result::unwrap_failed::ha17dbf463031a5e1
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/result.rs:1791:5
16: 0x55bd312e0565 - core::result::Result<T,E>::unwrap::hc76bc8ef087a958f
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/result.rs:1113:23
17: 0x55bd312e7beb - color_scheme::main::{{closure}}::h676b74a31767720a
at /home/eduardo/Developer/GitHub/edfloreshz/rust-dark-light/examples/color_scheme.rs:5:24
18: 0x55bd312e718c - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h9c10be68a6c43cf0
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
19: 0x55bd312e9b50 - tokio::runtime::park::CachedParkThread::block_on::{{closure}}::ha9c0fb5922d248b9
at /home/eduardo/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.23.0/src/runtime/park.rs:283:63
20: 0x55bd312e9959 - tokio::runtime::coop::with_budget::h374a6eb4c304d124
at /home/eduardo/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.23.0/src/runtime/coop.rs:102:5
21: 0x55bd312e9959 - tokio::runtime::coop::budget::hb7696c2b75afcb45
at /home/eduardo/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.23.0/src/runtime/coop.rs:68:5
22: 0x55bd312e9959 - tokio::runtime::park::CachedParkThread::block_on::h881e06b99f70fb52
at /home/eduardo/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.23.0/src/runtime/park.rs:283:31
23: 0x55bd312e82f5 - tokio::runtime::context::BlockingRegionGuard::block_on::h08783a21d0edfcfe
at /home/eduardo/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.23.0/src/runtime/context.rs:295:13
24: 0x55bd312e9fd5 - tokio::runtime::scheduler::multi_thread::MultiThread::block_on::h3159921632df782c
at /home/eduardo/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.23.0/src/runtime/scheduler/multi_thread/mod.rs:66:9
25: 0x55bd312eb449 - tokio::runtime::runtime::Runtime::block_on::h084150448d13be7b
at /home/eduardo/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.23.0/src/runtime/runtime.rs:284:45
26: 0x55bd312ea1a7 - color_scheme::main::h9b8b51354d52e12e
at /home/eduardo/Developer/GitHub/edfloreshz/rust-dark-light/examples/color_scheme.rs:6:5
27: 0x55bd312df37b - core::ops::function::FnOnce::call_once::hf3dbfc3dd1633528
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:251:5
28: 0x55bd312e454e - std::sys_common::backtrace::__rust_begin_short_backtrace::h93f5f078ce0a1b23
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:121:18
29: 0x55bd312e8871 - std::rt::lang_start::{{closure}}::h6b8a395c99773c0f
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:166:18
30: 0x55bd3181432b - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h072eb4cd8da964ba
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:286:13
31: 0x55bd3181432b - std::panicking::try::do_call::h8eca204fe9266946
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
32: 0x55bd3181432b - std::panicking::try::h12574e1b7b2cbacb
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
33: 0x55bd3181432b - std::panic::catch_unwind::hf71522d4448329d6
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
34: 0x55bd3181432b - std::rt::lang_start_internal::{{closure}}::h65b66ac9bff580f8
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:148:48
35: 0x55bd3181432b - std::panicking::try::do_call::hfff61e33ca3db9f1
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
36: 0x55bd3181432b - std::panicking::try::he48c8ecead279cad
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
37: 0x55bd3181432b - std::panic::catch_unwind::hd510a26bfc950ccc
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
38: 0x55bd3181432b - std::rt::lang_start_internal::hc680b25eab888da9
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:148:20
39: 0x55bd312e884a - std::rt::lang_start::hd05f42c2454c1d0c
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:165:17
40: 0x55bd312ea25e - main
41: 0x7f1363629d90 - <unknown>
42: 0x7f1363629e40 - __libc_start_main
43: 0x55bd312dcd85 - _start
44: 0x0 - <unknown>
I am playing with SaveFile, and want to copy the response uri to the 'current file' field for another request.
Making data selectable is always a good idea.
This function is supposed to take an app ID or an empty string, but TryFrom<String>
calls is_valid_app_id
, which returns false
for empty strings.
This should also apply to add_named_full
and list
.
Would it be better to skip using a TryFrom
generic here, and accept Option<AppId>
? That would probably be more idiomatic, and let the caller deal with (fallible) conversion.
From irc:
trying openuri, I added a file:/// uri for a pdf file, and then I click request
ashpd tells me "success", but nothing happens
and looking at the verbose portal output, it tells me that it refuses to handle file:// uris
it would be nice if a) ashpd didn't lie about the success and b) it used OpenFile instead of OpenUri for file uris
The label gets updated when one tries to start streaming. The flow should be something like
With the general scope in mind, design an icon for ASHPD.
The notification/dynamic launcher portals expect a serialized GIcon, currently there is no easy way for apps to provide that if they are not using gtk and even then you can't easily pass the result of a g_icon_serialize
as a zvariant::Value
.
The idea is to provide an enum that implements Serialize/Deserialize in a similar way how g_icon_serialize
/ g_icon_deserialize
works
Some of the method calls should make use of that as an error type internally so that we map the dbus errors to their actual rust counterparts
The D-Bus API makes use of URIs in several places, for example FileChooser. ashpd currently treats these URIs as std::string::String
s. It could be helpful to downstream developers to use a URI type from another crate for these URIs instead of simple Strings. I ran into an issue where I was not properly handling URI encoding which would have been easier to prevent if ashpd encoded more information about the data from the D-Bus API than treating it as a generic String.
https://github.com/bilelmoussaoui/ashpd/tags only shows one tag for 0.0.1-alpha.
raw_window_handle is a cross platform library abstracting over window handles for various windowing systems, including Wayland and X11. For cross platform code using ashpd, for example rfd, it would be helpful for ashpd to provide an API to convert its WindowIdentifier type to raw_window_handle's RawWindowHandle type. Alternatively, perhaps ashpd could switch to using RawWindowHandle in its own API.
The output looks fine
true
true
but nothing happens, nothing in the logs. I am currently running this outside of flatpak. I also tried logger test
to get a syslog entry, but also doesn't work.
$ flatpak --version
Flatpak 1.10.1
Some of the portals that requires a user interaction makes use of the wayland activation_token to activate/focus the window that requires the interaction.
We will need some way of automatically fetching that, maybe by making WindowIdentifier handle that as well
I was trying Kooha on Plasma Wayland and observed that it doesn't do anything after (kooha:2265): Gdk-WARNING **: 20:42:02.271: Server is missing xdg_foreign support
. Looking at
ashpd/src/window_identifier/gtk4.rs
Lines 42 to 51 in c26ec5d
ashpd/src/window_identifier/gtk3.rs
Lines 42 to 52 in c26ec5d
I'm getting an error when calling color_scheme
and read
on color-scheme
key.
Portal request failed: org.freedesktop.zbus.Error: no description
Using ashpd 0.2.0-beta-1
The key is present in my system and works if I call it on version 0.1.0
.
This may be an upstream issue, but here it is anyway: if I'm running multiple X servers on different ttys, there's a chance that the file dialog I request pops up on the wrong X server. I'm running arch linux, and it uses per-user (as opposed to per-session) dbus daemons.
Steps to reproduce:
cargo run
. If the file dialog shows up, switch to the other tty and repeat. At least one of them will show the file dialog on the other tty.Lines 121 to 122 in e082795
xdg-run/pipewire-0
unneccesary. The portal sets up security restrictions on the socket before returning the socket to the application, but always ensures that the application can iterate and access camera devices.--filesystem=xdg-run/pipewire-0
is insecure as it allows the application to effectively bypass the permission prompt.when you click the color scheme button, it disappears
ah it follows system - isn't updated on startup then?
It probably should be red.
Hello,
it seems like WindowIndentifier::from_native() can only be called once, otherwise the following GCritical is emitted:
(dev.Cogitri.Health:21): Gdk-CRITICAL **: 12:22:08.835: gdk_wayland_toplevel_export_handle: assertion '!impl->display_server.xdg_exported' failed
This GCritical origins from gdk_wayland_toplevel_export_handle
. The documentation for that function says:
* gdk_wayland_toplevel_export_handle:
[...]
* It is an error to call this function on a surface that is already
* exported.
Not sure what would be the best way to handle this, should we just put a notice in the docs?
Thanks for this crate! We are using it in frewsxcv/rust-dark-light#10 and I'll try using it for PolyMeilex/rfd#36 as well. I am confused by the name though. It doesn't show up when searching "xdg" on crates.io. Would you consider renaming this to xdg-desktop-portal
or xdg-portal
?
In GNOME 43 on NixOS, I tried requesting an account but the app crashed with the following:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { domain: g-file-error-quark, code: 4, message: "Failed to open file “/home/jtojnar/.face”: No such file or directory" }', src/portals/desktop/account.rs:84:66
The Demo does currently not support all Portals. Would be nice, if you could add the missing Portals to the Demo.
I build GTK 4 without X11 support, as I exclusively use Wayland on my systems, and this prevents this crate from building, with the given error log:
The following warnings were emitted during compilation:
warning: `"pkg-config" "--libs" "--cflags" "gtk4-x11" "gtk4-x11 >= 4.0.0"` did not exit successfully: exit status: 1
error: failed to run custom build command for `gdk4-x11-sys v0.4.2`
Caused by:
process didn't exit successfully: `/home/linkmauve/dev/rust/amberol/build/target/debug/build/gdk4-x11-sys-eae7525ab06d408a/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=GTK4_X11_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning=`"pkg-config" "--libs" "--cflags" "gtk4-x11" "gtk4-x11 >= 4.0.0"` did not exit successfully: exit status: 1
error: could not find system library 'gtk4-x11' required by the 'gdk4-x11-sys' crate
--- stderr
Package gtk4-x11 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4-x11.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk4-x11', required by 'virtual:world', not found
Package 'gtk4-x11', required by 'virtual:world', not found
warning: build failed, waiting for other jobs to finish...
When I try to use trash::trash_file()
inside a Flatpak, it fails.
Heres the error I get with my small test program when its running inside a Flatpak.
An error occured while trying to trash the test file: Portal request failed: org.freedesktop.portal.Error.Failed: no description
Hi, I'm currently trying to use ashpd to get a PipeWire video stream to extract the mouse metadata (position, specifically).
However, when I try the examples given in the README, it fails on the use ashpd::
portion:
|
1 | use ashpd::desktop::screenshot::ColorResponse;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ColorResponse` in `desktop::screenshot`
Is there some other way I'm supposed to use this?
If I have an XID or a wayland surface, I can convert it to WindowIdentifier
using from_raw_handle
. But, it requires the "raw_handle" feature (including potentially unnecessary dependencies) and a side-trip through RawWindowHandle
. It would be nice to have a more direct path.
#51 has a quick fix for x11, but a wayland version would be nice too (and maybe there's a better way to organize them? #51 was literally just the first thing that I thought of)
Basically making use of adw::Application that should automatically load style-dark.css for us where we need to override the color defined in
https://github.com/bilelmoussaoui/ashpd/blob/master/ashpd-demo/data/resources/style.css#L14-L16
cc @A6GibKm
Is there any way of running the example?
I got this error when trying to start screen sharing when I ran the flat pack example and I wanted to try to troubleshoot it.
2022-03-01T21:00:51.806977Z ERROR ashpd_demo::portals::desktop::screencast: Zbus(
Variant(
Message(
"missing field `streams`",
),
),
)
Env: the lastest archlinux with GNOME
This is the error message.
Sep 14 21:26:59.638 ERROR ashpd_demo::portals::desktop::screencast: Portal(
ZBus(
FDO(
NameHasNoOwner(
"Could not get owner of name 'org.freedesktop.portal.Desktop': no such name",
),
),
),
)
It seems that the org.freedesktop.portal.Desktop service is not start automatically. ashpd-demo works fine after I launch the service manually.
Instead store it in a OnceCell, that would simplify the API for end-user and would allow #64 without having to expose zbus stuff.
Creating a FileFilter with an empty name (FileFilter::new("")
) makes the OpenFile portal to error out. I think it is generally possible to create an unnamed filter, or at least this seems possible with GtkFileChooserNative, so I guess this is a bug.
As we have seen with the background portal, there are cases where it is required to know if an app is run inside a flatpak or not. Maybe this would fit for ashpd?
xdg-open uses the existence of $XDG_RUNTIME_DIR/flatpak-info
as indicator. I also spotted
FLATPAK_ID=...
container=flatpak
which might be better because they can be overwritten?
When you select a window in select sources window
, and pick the select sources window
itself from the selection. It sometimes crash, and when it doesn't, it will make the parts of the demo, where the window identifier needs to be exported unusable, unless you restart the demo.
The ashpd-demo is an awesome example for how to use the camera portal, however it currently lacks rotation support which is needed on many mobile devices as their cameras are often mounted rotated and the drivers don't support transparently per-rotating the image. Here's an example from the Pinephone Pro:
On the right side you see the output from https://gitlab.gnome.org/-/snippets/4781, providing a simple example for how to enable it with a Gstreamer element that supports rotate-method=auto
. That property doesn't have to be supported by the sink though - other possible elements that could do the job include glvideoflip
and videoflip
.
Related:
If I want to wait for a result (using the non-async API), it looks something like:
let connection = Connection::new_session()?;
let proxy = FileChooserProxy::new(&connection);
let req = proxy.open_file(Default::default(), "Title", Default::default())?;
req.connect_response(|r: Response<SelectedFiles>| {
// Do something
Ok(())
})?;
while reply.next_signal()?.is_some() {}
Would you consider adding (or accepting a PR to add) an API that just blocks until a response is ready? Like:
let connection = Connection::new_session()?;
let proxy = FileChooserProxy::new(&connection);
let selected: SelectedFiles = proxy.open_file(Default::default(), "Title", Default::default())?;
Or maybe something in between, which would still allow for cancellation:
let connection = Connection::new_session()?;
let proxy = FileChooserProxy::new(&connection);
let req = proxy.open_file(Default::default(), "Title", Default::default())?;
let selected: SelectedFiles = req.response()?;
It would be even cooler if the type of req
encoded the fact that the response has to be of type SelectedFiles
. Although from what I can tell, doing this would involve some changes to the dbus_proxy
macro...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.