~robertgzr/porta

af194fb1cd34220dc0db4f956d31699937ba6297 — Robert Günzler 8 months ago 11a6e6c
refactor

Signed-off-by: Robert Günzler <r@gnzler.io>
5 files changed, 500 insertions(+), 378 deletions(-)

M Cargo.lock
M src/filechooser.rs
A src/inhibit.rs
M src/main.rs
M src/openuri.rs
M Cargo.lock => Cargo.lock +349 -291
@@ 4,22 4,21 @@ version = 3

[[package]]
name = "aho-corasick"
version = "0.7.20"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
dependencies = [
 "memchr",
]

[[package]]
name = "async-broadcast"
version = "0.5.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b19760fa2b7301cf235360ffd6d3558b1ed4249edd16d6cca8d690cee265b95"
checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b"
dependencies = [
 "event-listener",
 "futures-core",
 "parking_lot",
]

[[package]]


@@ 35,9 34,9 @@ dependencies = [

[[package]]
name = "async-executor"
version = "1.5.0"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b"
checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb"
dependencies = [
 "async-lock",
 "async-task",


@@ 48,6 47,18 @@ dependencies = [
]

[[package]]
name = "async-fs"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06"
dependencies = [
 "async-lock",
 "autocfg",
 "blocking",
 "futures-lite",
]

[[package]]
name = "async-global-executor"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 64,43 75,60 @@ dependencies = [

[[package]]
name = "async-io"
version = "1.12.0"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794"
checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
dependencies = [
 "async-lock",
 "autocfg",
 "cfg-if",
 "concurrent-queue",
 "futures-lite",
 "libc",
 "log",
 "parking",
 "polling",
 "rustix",
 "slab",
 "socket2",
 "waker-fn",
 "windows-sys",
]

[[package]]
name = "async-lock"
version = "2.6.0"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7"
dependencies = [
 "event-listener",
]

[[package]]
name = "async-process"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685"
checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9"
dependencies = [
 "async-io",
 "async-lock",
 "autocfg",
 "blocking",
 "cfg-if",
 "event-listener",
 "futures-lite",
 "rustix",
 "signal-hook",
 "windows-sys",
]

[[package]]
name = "async-recursion"
version = "1.0.0"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cda8f4bcc10624c4e85bc66b3f452cca98cfa5ca002dc83a16aad2367641bea"
checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "syn 2.0.22",
]

[[package]]


@@ 131,26 159,26 @@ dependencies = [

[[package]]
name = "async-task"
version = "4.3.0"
version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524"
checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae"

[[package]]
name = "async-trait"
version = "0.1.61"
version = "0.1.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282"
checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "syn 2.0.22",
]

[[package]]
name = "atomic-waker"
version = "1.1.0"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599"
checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3"

[[package]]
name = "autocfg"


@@ 166,18 194,18 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"

[[package]]
name = "block-buffer"
version = "0.10.3"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
 "generic-array",
]

[[package]]
name = "blocking"
version = "1.3.0"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8"
checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65"
dependencies = [
 "async-channel",
 "async-lock",


@@ 185,13 213,14 @@ dependencies = [
 "atomic-waker",
 "fastrand",
 "futures-lite",
 "log",
]

[[package]]
name = "bumpalo"
version = "3.11.1"
version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"

[[package]]
name = "byteorder"


@@ 201,9 230,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"

[[package]]
name = "cc"
version = "1.0.78"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"

[[package]]
name = "cfg-if"


@@ 213,27 242,27 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "concurrent-queue"
version = "2.1.0"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e"
checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c"
dependencies = [
 "crossbeam-utils",
]

[[package]]
name = "cpufeatures"
version = "0.2.5"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c"
dependencies = [
 "libc",
]

[[package]]
name = "crossbeam-utils"
version = "0.8.14"
version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
 "cfg-if",
]


@@ 249,16 278,6 @@ dependencies = [
]

[[package]]
name = "ctor"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
dependencies = [
 "quote",
 "syn",
]

[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 266,58 285,59 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "syn 1.0.109",
]

[[package]]
name = "digest"
version = "0.10.6"
version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
 "block-buffer",
 "crypto-common",
]

[[package]]
name = "dirs"
version = "4.0.0"
name = "enumflags2"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
checksum = "c041f5090df68b32bcd905365fd51769c8b9d553fe87fde0b683534f10c01bd2"
dependencies = [
 "dirs-sys",
 "enumflags2_derive",
 "serde",
]

[[package]]
name = "dirs-sys"
version = "0.3.7"
name = "enumflags2_derive"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745"
dependencies = [
 "libc",
 "redox_users",
 "winapi",
 "proc-macro2",
 "quote",
 "syn 2.0.22",
]

[[package]]
name = "enumflags2"
version = "0.7.5"
name = "errno"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [
 "enumflags2_derive",
 "serde",
 "errno-dragonfly",
 "libc",
 "windows-sys",
]

[[package]]
name = "enumflags2_derive"
version = "0.7.4"
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "cc",
 "libc",
]

[[package]]


@@ 328,39 348,39 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"

[[package]]
name = "fastrand"
version = "1.8.0"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
 "instant",
]

[[package]]
name = "futures-channel"
version = "0.3.25"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
dependencies = [
 "futures-core",
]

[[package]]
name = "futures-core"
version = "0.3.25"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"

[[package]]
name = "futures-io"
version = "0.3.25"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"

[[package]]
name = "futures-lite"
version = "1.12.0"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
dependencies = [
 "fastrand",
 "futures-core",


@@ 373,25 393,27 @@ dependencies = [

[[package]]
name = "futures-sink"
version = "0.3.25"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"

[[package]]
name = "futures-task"
version = "0.3.25"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"
checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"

[[package]]
name = "futures-util"
version = "0.3.25"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
dependencies = [
 "futures-core",
 "futures-io",
 "futures-sink",
 "futures-task",
 "memchr",
 "pin-project-lite",
 "pin-utils",
 "slab",


@@ 399,9 421,9 @@ dependencies = [

[[package]]
name = "generic-array"
version = "0.14.6"
version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
 "typenum",
 "version_check",


@@ 409,9 431,9 @@ dependencies = [

[[package]]
name = "getrandom"
version = "0.2.8"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
 "cfg-if",
 "libc",


@@ 420,9 442,9 @@ dependencies = [

[[package]]
name = "gloo-timers"
version = "0.2.5"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b"
checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"
dependencies = [
 "futures-channel",
 "futures-core",


@@ 431,12 453,34 @@ dependencies = [
]

[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"

[[package]]
name = "hermit-abi"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"

[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"

[[package]]
name = "indexmap"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
 "autocfg",
 "hashbrown",
]

[[package]]
name = "instant"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 446,10 490,21 @@ dependencies = [
]

[[package]]
name = "io-lifetimes"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
 "hermit-abi",
 "libc",
 "windows-sys",
]

[[package]]
name = "js-sys"
version = "0.3.60"
version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
dependencies = [
 "wasm-bindgen",
]


@@ 465,27 520,22 @@ dependencies = [

[[package]]
name = "libc"
version = "0.2.139"
version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"

[[package]]
name = "lock_api"
version = "0.4.9"
name = "linux-raw-sys"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
dependencies = [
 "autocfg",
 "scopeguard",
]
checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"

[[package]]
name = "log"
version = "0.4.17"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
dependencies = [
 "cfg-if",
 "value-bag",
]



@@ 497,38 547,37 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"

[[package]]
name = "memoffset"
version = "0.6.5"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
 "autocfg",
]

[[package]]
name = "nix"
version = "0.25.1"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4"
checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
dependencies = [
 "autocfg",
 "bitflags",
 "cfg-if",
 "libc",
 "memoffset",
 "pin-utils",
 "static_assertions",
]

[[package]]
name = "once_cell"
version = "1.17.0"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"

[[package]]
name = "ordered-stream"
version = "0.1.3"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4eb9ba3f3e42dbdd3b7b122de5ca169c81e93d561eb900da3a8c99bcfcf381a"
checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"
dependencies = [
 "futures-core",
 "pin-project-lite",


@@ 536,32 585,9 @@ dependencies = [

[[package]]
name = "parking"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"

[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
 "lock_api",
 "parking_lot_core",
]

[[package]]
name = "parking_lot_core"
version = "0.9.6"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf"
dependencies = [
 "cfg-if",
 "libc",
 "redox_syscall",
 "smallvec",
 "windows-sys",
]
checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e"

[[package]]
name = "pin-project-lite"


@@ 577,15 603,17 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"

[[package]]
name = "polling"
version = "2.5.2"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6"
checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
dependencies = [
 "autocfg",
 "bitflags",
 "cfg-if",
 "concurrent-queue",
 "libc",
 "log",
 "wepoll-ffi",
 "pin-project-lite",
 "windows-sys",
]



@@ 605,29 633,28 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"

[[package]]
name = "proc-macro-crate"
version = "1.2.1"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [
 "once_cell",
 "thiserror",
 "toml",
 "toml_edit",
]

[[package]]
name = "proc-macro2"
version = "1.0.49"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb"
dependencies = [
 "unicode-ident",
]

[[package]]
name = "quote"
version = "1.0.23"
version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
dependencies = [
 "proc-macro2",
]


@@ 664,29 691,18 @@ dependencies = [

[[package]]
name = "redox_syscall"
version = "0.2.16"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [
 "bitflags",
]

[[package]]
name = "redox_users"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
 "getrandom",
 "redox_syscall",
 "thiserror",
]

[[package]]
name = "regex"
version = "1.7.1"
version = "1.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
dependencies = [
 "aho-corasick",
 "memchr",


@@ 695,54 711,53 @@ dependencies = [

[[package]]
name = "regex-syntax"
version = "0.6.28"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"

[[package]]
name = "remove_dir_all"
version = "0.5.3"
name = "rustix"
version = "0.37.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0"
dependencies = [
 "winapi",
 "bitflags",
 "errno",
 "io-lifetimes",
 "libc",
 "linux-raw-sys",
 "windows-sys",
]

[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"

[[package]]
name = "serde"
version = "1.0.152"
version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
dependencies = [
 "serde_derive",
]

[[package]]
name = "serde_derive"
version = "1.0.152"
version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "syn 2.0.22",
]

[[package]]
name = "serde_repr"
version = "0.1.10"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e"
checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "syn 2.0.22",
]

[[package]]


@@ 757,25 772,38 @@ dependencies = [
]

[[package]]
name = "slab"
version = "0.4.7"
name = "signal-hook"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9"
dependencies = [
 "autocfg",
 "libc",
 "signal-hook-registry",
]

[[package]]
name = "smallvec"
version = "1.10.0"
name = "signal-hook-registry"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
dependencies = [
 "libc",
]

[[package]]
name = "slab"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
dependencies = [
 "autocfg",
]

[[package]]
name = "socket2"
version = "0.4.7"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
dependencies = [
 "libc",
 "winapi",


@@ 789,9 817,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"

[[package]]
name = "syn"
version = "1.0.107"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
 "proc-macro2",
 "quote",


@@ 799,46 827,45 @@ dependencies = [
]

[[package]]
name = "tempfile"
version = "3.3.0"
name = "syn"
version = "2.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616"
dependencies = [
 "cfg-if",
 "fastrand",
 "libc",
 "redox_syscall",
 "remove_dir_all",
 "winapi",
 "proc-macro2",
 "quote",
 "unicode-ident",
]

[[package]]
name = "thiserror"
version = "1.0.38"
name = "tempfile"
version = "3.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
dependencies = [
 "thiserror-impl",
 "autocfg",
 "cfg-if",
 "fastrand",
 "redox_syscall",
 "rustix",
 "windows-sys",
]

[[package]]
name = "thiserror-impl"
version = "1.0.38"
name = "toml_datetime"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
]
checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"

[[package]]
name = "toml"
version = "0.5.10"
name = "toml_edit"
version = "0.19.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f"
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
dependencies = [
 "serde",
 "indexmap",
 "toml_datetime",
 "winnow",
]

[[package]]


@@ 855,20 882,20 @@ dependencies = [

[[package]]
name = "tracing-attributes"
version = "0.1.23"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "syn 2.0.22",
]

[[package]]
name = "tracing-core"
version = "0.1.30"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
dependencies = [
 "once_cell",
]


@@ 891,19 918,15 @@ dependencies = [

[[package]]
name = "unicode-ident"
version = "1.0.6"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"

[[package]]
name = "value-bag"
version = "1.0.0-alpha.9"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55"
dependencies = [
 "ctor",
 "version_check",
]
checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3"

[[package]]
name = "version_check"


@@ 925,9 948,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"

[[package]]
name = "wasm-bindgen"
version = "0.2.83"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [
 "cfg-if",
 "wasm-bindgen-macro",


@@ 935,24 958,24 @@ dependencies = [

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.83"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
dependencies = [
 "bumpalo",
 "log",
 "once_cell",
 "proc-macro2",
 "quote",
 "syn",
 "syn 2.0.22",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-futures"
version = "0.4.33"
version = "0.4.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
dependencies = [
 "cfg-if",
 "js-sys",


@@ 962,9 985,9 @@ dependencies = [

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.83"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
dependencies = [
 "quote",
 "wasm-bindgen-macro-support",


@@ 972,43 995,34 @@ dependencies = [

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.83"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "syn 2.0.22",
 "wasm-bindgen-backend",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.83"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"

[[package]]
name = "web-sys"
version = "0.3.60"
version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
dependencies = [
 "js-sys",
 "wasm-bindgen",
]

[[package]]
name = "wepoll-ffi"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
dependencies = [
 "cc",
]

[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1032,9 1046,18 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

[[package]]
name = "windows-sys"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
 "windows-targets",
]

[[package]]
name = "windows-targets"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
dependencies = [
 "windows_aarch64_gnullvm",
 "windows_aarch64_msvc",


@@ 1047,62 1070,82 @@ dependencies = [

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.1"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"

[[package]]
name = "windows_aarch64_msvc"
version = "0.42.1"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"

[[package]]
name = "windows_i686_gnu"
version = "0.42.1"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"

[[package]]
name = "windows_i686_msvc"
version = "0.42.1"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"

[[package]]
name = "windows_x86_64_gnu"
version = "0.42.1"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.1"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"

[[package]]
name = "windows_x86_64_msvc"
version = "0.42.1"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"

[[package]]
name = "winnow"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28"
dependencies = [
 "memchr",
]

[[package]]
name = "xdg-home"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd"
dependencies = [
 "nix",
 "winapi",
]

[[package]]
name = "zbus"
version = "3.7.0"
version = "3.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "379d587c0ccb632d1179cf44082653f682842f0535f0fdfaefffc34849cc855e"
checksum = "6c3d77c9966c28321f1907f0b6c5a5561189d1f7311eea6d94180c6be9daab29"
dependencies = [
 "async-broadcast",
 "async-executor",
 "async-fs",
 "async-io",
 "async-lock",
 "async-process",
 "async-recursion",
 "async-task",
 "async-trait",
 "byteorder",
 "derivative",
 "dirs",
 "enumflags2",
 "event-listener",
 "futures-core",


@@ 1120,6 1163,7 @@ dependencies = [
 "tracing",
 "uds_windows",
 "winapi",
 "xdg-home",
 "zbus_macros",
 "zbus_names",
 "zvariant",


@@ 1127,22 1171,24 @@ dependencies = [

[[package]]
name = "zbus_macros"
version = "3.7.0"
version = "3.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66492a2e90c0df7190583eccb8424aa12eb7ff06edea415a4fff6688fae18cf8"
checksum = "f6e341d12edaff644e539ccbbf7f161601294c9a84ed3d7e015da33155b435af"
dependencies = [
 "proc-macro-crate",
 "proc-macro2",
 "quote",
 "regex",
 "syn",
 "syn 1.0.109",
 "winnow",
 "zvariant_utils",
]

[[package]]
name = "zbus_names"
version = "2.5.0"
version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f34f314916bd89bdb9934154627fab152f4f28acdda03e7c4c68181b214fe7e3"
checksum = "82441e6033be0a741157a72951a3e4957d519698f3a824439cc131c5ba77ac2a"
dependencies = [
 "serde",
 "static_assertions",


@@ 1151,9 1197,9 @@ dependencies = [

[[package]]
name = "zvariant"
version = "3.10.0"
version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "576cc41e65c7f283e5460f5818073e68fb1f1631502b969ef228c2e03c862efb"
checksum = "622cc473f10cef1b0d73b7b34a266be30ebdcfaea40ec297dd8cbda088f9f93c"
dependencies = [
 "byteorder",
 "enumflags2",


@@ 1165,12 1211,24 @@ dependencies = [

[[package]]
name = "zvariant_derive"
version = "3.10.0"
version = "3.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fd4aafc0dee96ae7242a24249ce9babf21e1562822f03df650d4e68c20e41ed"
checksum = "5d9c1b57352c25b778257c661f3c4744b7cefb7fc09dd46909a153cce7773da2"
dependencies = [
 "proc-macro-crate",
 "proc-macro2",
 "quote",
 "syn",
 "syn 1.0.109",
 "zvariant_utils",
]

[[package]]
name = "zvariant_utils"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 1.0.109",
]

M src/filechooser.rs => src/filechooser.rs +14 -16
@@ 1,7 1,7 @@
use std::collections::HashMap;
use std::error::Error;

use zbus::{blocking::Connection, dbus_proxy, zvariant};
use zbus::{blocking::Connection, dbus_proxy, zvariant::{Value, OwnedObjectPath}};

#[dbus_proxy(
    default_service = "org.freedesktop.portal.Desktop",


@@ 13,26 13,24 @@ trait FileChooser {
        &self,
        parent_window: &str,
        title: &str,
        options: HashMap<&str, &zvariant::Value<'_>>,
    ) -> zbus::Result<zvariant::OwnedObjectPath>;
        options: HashMap<&str, &Value<'_>>,
    ) -> zbus::Result<OwnedObjectPath>;
}

pub fn call(conn: &Connection, argument: Option<&str>) {
    FileChooserProxyBlocking::new(conn)
        .unwrap()
        .open_file(
            "",
            argument.unwrap_or_default(),
            HashMap::from([("multiple", &zvariant::Value::Bool(true))]),
        )
        .unwrap();
pub fn call(conn: &Connection, args: Vec<String>) -> zbus::Result<OwnedObjectPath> {
    FileChooserProxyBlocking::new(conn)?.open_file(
        "",
        args.get(0).unwrap_or(&"".to_owned()),
        HashMap::from([("multiple", &Value::Bool(true))]),
    )
}

pub fn handle_reply(mut body: HashMap<String, zvariant::Value<'_>>) -> Result<(), Box<dyn Error>> {
    let results: Vec<String> = body.remove("uris").unwrap().try_into()?;
    results
        .iter()
pub fn handle_reply(result: &HashMap<String, Value<'_>>) -> Result<(), Box<dyn Error>> {
    let uris: Vec<String> = result.get("uris").unwrap().clone().try_into()?;

    uris.iter()
        .map(|uri| uri.trim_start_matches("file://"))
        .for_each(|uri| println!("{}", uri));

    Ok(())
}

A src/inhibit.rs => src/inhibit.rs +69 -0
@@ 0,0 1,69 @@
use std::error::Error;
use std::{collections::HashMap, str::FromStr};

use zbus::{blocking::Connection, dbus_proxy, zvariant::{OwnedObjectPath, Value}};

#[dbus_proxy(
    default_service = "org.freedesktop.portal.Desktop",
    default_path = "/org/freedesktop/portal/desktop",
    interface = "org.freedesktop.portal.Inhibit"
)]
trait Inhibit {
    fn inhibit(
        &self,
        parent_window: &str,
        flags: u32,
        options: HashMap<&str, &Value<'_>>,
    ) -> zbus::Result<OwnedObjectPath>;

    fn create_monitor(
        &self,
        parent_window: &str,
        options: HashMap<&str, &Value<'_>>,
    ) -> zbus::Result<OwnedObjectPath>;
}

pub enum Flag {
    Logout = 1,
    Switch = 2,
    Suspend = 4,
    Idle = 8,
}

impl FromStr for Flag {
    type Err = Box<dyn Error>;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        Ok(match s {
            "logout" => Flag::Logout,
            "switch" => Flag::Switch,
            "suspend" => Flag::Suspend,
            "idle" => Flag::Idle,
            _ => return Err(format!("unknown flag {}", s).into()),
        })
    }
}

pub fn call(conn: &Connection, args: Vec<String>) -> zbus::Result<OwnedObjectPath> {
    let flag = Flag::from_str(args.get(0).unwrap()).unwrap();
    let mut options = HashMap::<&str, &Value<'_>>::new();

    let reason_value: Value;
    if let Some(reason_) = args.get(1) {
        reason_value = Value::new(reason_);
        options.insert("reason", &reason_value);
    }

    InhibitProxyBlocking::new(conn)
        .unwrap()
        .inhibit("", flag as u32, options)
}

pub fn handle_reply(result: &HashMap<String, Value<'_>>) -> Result<(), Box<dyn Error>> {
    let (tx, rx) = std::sync::mpsc::channel();
    ctrlc::set_handler(move || tx.send(()).expect("Failed to send signal on channel"))?;
    rx.recv()?;

    // ctx.request().call_noreply::<&str, ()>("Close", &())?;
    Ok(())
}

M src/main.rs => src/main.rs +43 -46
@@ 4,38 4,54 @@ mod openuri;
use std::collections::HashMap;
use std::error::Error;

use zbus::{
    blocking::{Connection, Proxy},
    zvariant,
};
use zbus::blocking::Connection;
use zbus::dbus_proxy;
use zbus::zvariant::{Value, OwnedObjectPath};

static mut REQUEST: Option<Proxy> = None;
#[dbus_proxy(
    default_service = "org.freedesktop.portal.Desktop",
    interface = "org.freedesktop.portal.Request",
)]
trait Request {
    fn close(&self) -> zbus::Result<()>;

type ResponseBody<'a> = (u32, HashMap<String, zvariant::Value<'a>>);
    #[dbus_proxy(signal)]
    fn response(&self, response: u32, results: HashMap<String, Value<'_>>) -> zbus::Result<()>;
}

fn execute(
    call: impl FnOnce() + Send + 'static,
    handle: impl FnOnce(HashMap<String, zvariant::Value<'_>>) -> Result<(), Box<dyn Error>>,
    conn: &Connection,
    args: Vec<String>,
    call: impl FnOnce(&Connection, Vec<String>) -> zbus::Result<OwnedObjectPath>,
    handle_reply: impl FnOnce(&HashMap<String, Value<'_>>) -> Result<(), Box<dyn Error>>,
) -> Result<(), Box<dyn Error>> {
    std::thread::spawn(call);
    let req = unsafe { REQUEST.as_ref().unwrap() };
    let response = req.receive_signal("Response")?.next().unwrap();
    let result: ResponseBody = response.body()?;
    // execute call code
    let request_path = call(conn, args)?;

    if result.0 != 0 {
        std::process::exit(1);
    // receive Response signal
    let request_proxy = RequestProxyBlocking::builder(conn).path(request_path)?.build()?;
    let resp = request_proxy.receive_response()?.next().unwrap();
    let args = resp.args()?;
    match args.response() {
        0 => handle_reply(args.results()),
        1 => Ok(()),
        2 => Err("user interaction was ended in some other way".into()),
        value @ _ =>  Err(format!("unexpected response: {}", value).into()),
    }
    handle(result.1)
}

fn usage() {
    println!(
        "usage: porta <command> [options]

    open-uri <uri>
    filechooser [window title]
"
    );
    println!("usage: porta <command> [options]");
    println!("");
    println!("invoke xdg-desktop-portal APIs from the command line");
    println!("");
    println!("available commands:");
    println!("");
    println!("  access       <title> <subtitle> <body>");
    println!("  filechooser  [window title]");
    // println!("  inhibit      <logout,switch,suspend,idle> [reason]");
    println!("  open-uri     <uri>");
    println!("");
    std::process::exit(0);
}



@@ 47,31 63,12 @@ fn main() -> Result<(), Box<dyn Error>> {

    let conn = Connection::session()?;

    let request_path = format!(
        "/org/freedesktop/portal/desktop/request/{}/t",
        conn.unique_name()
            .unwrap()
            .trim_start_matches(':')
            .replace('.', "_")
    );
    unsafe {
        REQUEST = Some(Proxy::new(
            &conn,
            "org.freedesktop.portal.Desktop",
            request_path,
            "org.freedesktop.portal.Request",
        )?);
    }
    let command = args[1].as_str();
    let args: Vec<String> = args[2..].into();

    match args[1].as_str() {
        "open-uri" => execute(
            move || openuri::call(&conn, args.get(2).map(|s| s.as_str())),
            openuri::handle_reply,
        )?,
        "filechooser" => execute(
            move || filechooser::call(&conn, args.get(2).map(|s| s.as_str())),
            filechooser::handle_reply,
        )?,
    match command {
        "filechooser" => execute(&conn, args, filechooser::call, filechooser::handle_reply)?,
        "open-uri" => execute(&conn, args, openuri::call, openuri::handle_reply)?,
        _ => usage(),
    }


M src/openuri.rs => src/openuri.rs +25 -25
@@ 3,7 3,11 @@ use std::error::Error;
use std::fs::File;
use std::os::fd::AsRawFd;

use zbus::{blocking::Connection, dbus_proxy, zvariant};
use zbus::{
    blocking::Connection,
    dbus_proxy,
    zvariant::{self, OwnedObjectPath, Value},
};

#[dbus_proxy(
    default_service = "org.freedesktop.portal.Desktop",


@@ 16,51 20,47 @@ trait OpenURI {
        &self,
        parent_win: &str,
        uri: &str,
        options: HashMap<&str, &zvariant::Value<'_>>,
    ) -> zbus::Result<zvariant::OwnedObjectPath>;
        options: HashMap<&str, &Value<'_>>,
    ) -> zbus::Result<OwnedObjectPath>;

    #[dbus_proxy(name = "OpenFile")]
    fn open_file(
        &self,
        parent_win: &str,
        fd: zvariant::Fd,
        options: HashMap<&str, &zvariant::Value<'_>>,
    ) -> zbus::Result<zvariant::OwnedObjectPath>;
        options: HashMap<&str, &Value<'_>>,
    ) -> zbus::Result<OwnedObjectPath>;

    #[dbus_proxy(name = "OpenFile")]
    fn open_directory(
        &self,
        parent_win: &str,
        fd: zvariant::Fd,
        options: HashMap<&str, &zvariant::Value<'_>>,
    ) -> zbus::Result<zvariant::OwnedObjectPath>;
        options: HashMap<&str, &Value<'_>>,
    ) -> zbus::Result<OwnedObjectPath>;
}

pub fn call(conn: &Connection, argument: Option<&str>) {
pub fn call(conn: &Connection, args: Vec<String>) -> zbus::Result<OwnedObjectPath> {
    let proxy = OpenURIProxyBlocking::new(conn).unwrap();
    let options = HashMap::from([("ask", &zvariant::Value::Bool(true))]);
    let options = HashMap::from([("ask", &Value::Bool(true))]);

    if let Some(a) = argument {
        let m = a.match_indices("://").next();
    let a = args.get(0).unwrap(); // required
    let m = a.match_indices("://").next();

        // NOTE: support passing local file uris without schema
        if m.is_none() || a.get(..(m.unwrap().0)) == Some("file") {
            if let Ok(fd) = File::open(a.trim_start_matches("file://")) {
                let meta = fd.metadata();
                if meta.is_ok() && meta.unwrap().is_dir() {
                    proxy
                        .open_directory("", fd.as_raw_fd().into(), options)
                        .unwrap();
                } else {
                    proxy.open_file("", fd.as_raw_fd().into(), options).unwrap();
                }
            }
    // NOTE: support passing local file uris without schema
    if m.is_none() || a.get(..(m.unwrap().0)) == Some("file") {
        let fd = File::open(a.trim_start_matches("file://"))?;
        let meta = fd.metadata();
        if meta.is_ok() && meta.unwrap().is_dir() {
            proxy.open_directory("", fd.as_raw_fd().into(), options)
        } else {
            proxy.open_uri("", a, options).unwrap();
            proxy.open_file("", fd.as_raw_fd().into(), options)
        }
    } else {
        proxy.open_uri("", a, options)
    }
}

pub fn handle_reply(_body: HashMap<String, zvariant::Value<'_>>) -> Result<(), Box<dyn Error>> {
pub fn handle_reply(_: &HashMap<String, Value<'_>>) -> Result<(), Box<dyn Error>> {
    Ok(())
}