This commit is contained in:
Alexander Mohr 2025-05-10 22:27:41 +02:00
parent 0467217c23
commit 5bc008495e
19 changed files with 838 additions and 144 deletions

709
Cargo.lock generated
View file

@ -67,13 +67,152 @@ version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
[[package]]
name = "async-broadcast"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"
dependencies = [
"event-listener",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-channel"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a"
dependencies = [
"concurrent-queue",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-executor"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb812ffb58524bdd10860d7d974e2f01cc0950c2438a74ee5ec2e2280c6c4ffa"
dependencies = [
"async-task",
"concurrent-queue",
"fastrand",
"futures-lite",
"pin-project-lite",
"slab",
]
[[package]]
name = "async-io"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059"
dependencies = [
"async-lock",
"cfg-if",
"concurrent-queue",
"futures-io",
"futures-lite",
"parking",
"polling",
"rustix 0.38.44",
"slab",
"tracing",
"windows-sys",
]
[[package]]
name = "async-lock"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18"
dependencies = [
"event-listener",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-process"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb"
dependencies = [
"async-channel",
"async-io",
"async-lock",
"async-signal",
"async-task",
"blocking",
"cfg-if",
"event-listener",
"futures-lite",
"rustix 0.38.44",
"tracing",
]
[[package]]
name = "async-recursion"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.101",
]
[[package]]
name = "async-signal"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3"
dependencies = [
"async-io",
"async-lock",
"atomic-waker",
"cfg-if",
"futures-core",
"futures-io",
"rustix 0.38.44",
"signal-hook-registry",
"slab",
"windows-sys",
]
[[package]]
name = "async-task"
version = "4.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
[[package]]
name = "async-trait"
version = "0.1.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.101",
]
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi 0.1.19",
"libc", "libc",
"winapi", "winapi",
] ]
@ -96,6 +235,28 @@ version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "block2"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "340d2f0bdb2a43c1d3cd40513185b2bd7def0aa1052f956455114bc98f82dcf2"
dependencies = [
"objc2",
]
[[package]]
name = "blocking"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea"
dependencies = [
"async-channel",
"async-task",
"futures-io",
"futures-lite",
"piper",
]
[[package]] [[package]]
name = "cairo-rs" name = "cairo-rs"
version = "0.20.7" version = "0.20.7"
@ -221,6 +382,15 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "concurrent-queue"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
dependencies = [
"crossbeam-utils",
]
[[package]] [[package]]
name = "crossbeam" name = "crossbeam"
version = "0.8.4" version = "0.8.4"
@ -277,6 +447,15 @@ version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "deranged"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e"
dependencies = [
"powerfmt",
]
[[package]] [[package]]
name = "dirs" name = "dirs"
version = "6.0.0" version = "6.0.0"
@ -298,6 +477,16 @@ dependencies = [
"windows-sys", "windows-sys",
] ]
[[package]]
name = "dispatch2"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec"
dependencies = [
"bitflags 2.9.0",
"objc2",
]
[[package]] [[package]]
name = "downcast-rs" name = "downcast-rs"
version = "1.2.1" version = "1.2.1"
@ -322,6 +511,33 @@ dependencies = [
"phf", "phf",
] ]
[[package]]
name = "endi"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf"
[[package]]
name = "enumflags2"
version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba2f4b465f5318854c6f8dd686ede6c0a9dc67d4b1ac241cf0eb51521a309147"
dependencies = [
"enumflags2_derive",
"serde",
]
[[package]]
name = "enumflags2_derive"
version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc4caf64a58d7a6d65ab00639b046ff54399a39f5f2554728895ace4b297cd79"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.101",
]
[[package]] [[package]]
name = "env_filter" name = "env_filter"
version = "0.1.3" version = "0.1.3"
@ -367,6 +583,27 @@ dependencies = [
"windows-sys", "windows-sys",
] ]
[[package]]
name = "event-listener"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae"
dependencies = [
"concurrent-queue",
"parking",
"pin-project-lite",
]
[[package]]
name = "event-listener-strategy"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
dependencies = [
"event-listener",
"pin-project-lite",
]
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.3.0" version = "2.3.0"
@ -437,6 +674,19 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]]
name = "futures-lite"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"parking",
"pin-project-lite",
]
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.31" version = "0.3.31"
@ -835,6 +1085,18 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hermit-abi"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.3" version = "1.9.3"
@ -952,6 +1214,18 @@ version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "mac-notification-sys"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b95dfb34071d1592b45622bf93e315e3a72d414b6782aca9a015c12bec367ef"
dependencies = [
"cc",
"objc2",
"objc2-foundation",
"time",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.7.4"
@ -983,6 +1257,19 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "nix"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
"bitflags 2.9.0",
"cfg-if",
"cfg_aliases",
"libc",
"memoffset",
]
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.30.1" version = "0.30.1"
@ -1011,6 +1298,65 @@ dependencies = [
"minimal-lexical", "minimal-lexical",
] ]
[[package]]
name = "notify-rust"
version = "4.11.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6442248665a5aa2514e794af3b39661a8e73033b1cc5e59899e1276117ee4400"
dependencies = [
"futures-lite",
"log",
"mac-notification-sys",
"serde",
"tauri-winrt-notification",
"zbus",
]
[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "objc2"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88c6597e14493ab2e44ce58f2fdecf095a51f12ca57bec060a11c57332520551"
dependencies = [
"objc2-encode",
]
[[package]]
name = "objc2-core-foundation"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
dependencies = [
"bitflags 2.9.0",
"dispatch2",
"objc2",
]
[[package]]
name = "objc2-encode"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
[[package]]
name = "objc2-foundation"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c"
dependencies = [
"bitflags 2.9.0",
"block2",
"libc",
"objc2",
"objc2-core-foundation",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.21.3" version = "1.21.3"
@ -1023,6 +1369,16 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ordered-stream"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"
dependencies = [
"futures-core",
"pin-project-lite",
]
[[package]] [[package]]
name = "os_pipe" name = "os_pipe"
version = "1.2.1" version = "1.2.1"
@ -1063,6 +1419,12 @@ dependencies = [
"system-deps", "system-deps",
] ]
[[package]]
name = "parking"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
[[package]] [[package]]
name = "petgraph" name = "petgraph"
version = "0.6.5" version = "0.6.5"
@ -1129,12 +1491,38 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "piper"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066"
dependencies = [
"atomic-waker",
"fastrand",
"futures-io",
]
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.32" version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
[[package]]
name = "polling"
version = "3.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f"
dependencies = [
"cfg-if",
"concurrent-queue",
"hermit-abi 0.4.0",
"pin-project-lite",
"rustix 0.38.44",
"tracing",
"windows-sys",
]
[[package]] [[package]]
name = "portable-atomic" name = "portable-atomic"
version = "1.11.0" version = "1.11.0"
@ -1150,6 +1538,12 @@ dependencies = [
"portable-atomic", "portable-atomic",
] ]
[[package]]
name = "powerfmt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.21" version = "0.2.21"
@ -1407,6 +1801,17 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_repr"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.101",
]
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "0.6.8" version = "0.6.8"
@ -1422,6 +1827,15 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "signal-hook-registry"
version = "1.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "siphasher" name = "siphasher"
version = "0.3.11" version = "0.3.11"
@ -1443,6 +1857,12 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.10.0"
@ -1496,6 +1916,18 @@ version = "0.12.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]]
name = "tauri-winrt-notification"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b1e66e07de489fe43a46678dd0b8df65e0c973909df1b60ba33874e297ba9b9"
dependencies = [
"quick-xml 0.37.5",
"thiserror",
"windows",
"windows-version",
]
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.19.1" version = "3.19.1"
@ -1554,6 +1986,25 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "time"
version = "0.3.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40"
dependencies = [
"deranged",
"num-conv",
"powerfmt",
"serde",
"time-core",
]
[[package]]
name = "time-core"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c"
[[package]] [[package]]
name = "tini" name = "tini"
version = "1.3.0" version = "1.3.0"
@ -1601,6 +2052,37 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076"
[[package]]
name = "tracing"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.101",
]
[[package]]
name = "tracing-core"
version = "0.1.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
dependencies = [
"once_cell",
]
[[package]] [[package]]
name = "tree_magic_mini" name = "tree_magic_mini"
version = "3.1.6" version = "3.1.6"
@ -1614,6 +2096,17 @@ dependencies = [
"petgraph", "petgraph",
] ]
[[package]]
name = "uds_windows"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
dependencies = [
"memoffset",
"tempfile",
"winapi",
]
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.18" version = "1.0.18"
@ -1766,6 +2259,107 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.61.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419"
dependencies = [
"windows-collections",
"windows-core",
"windows-future",
"windows-link",
"windows-numerics",
]
[[package]]
name = "windows-collections"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
dependencies = [
"windows-core",
]
[[package]]
name = "windows-core"
version = "0.61.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
dependencies = [
"windows-implement",
"windows-interface",
"windows-link",
"windows-result",
"windows-strings",
]
[[package]]
name = "windows-future"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a1d6bbefcb7b60acd19828e1bc965da6fcf18a7e39490c5f8be71e54a19ba32"
dependencies = [
"windows-core",
"windows-link",
]
[[package]]
name = "windows-implement"
version = "0.60.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.101",
]
[[package]]
name = "windows-interface"
version = "0.59.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.101",
]
[[package]]
name = "windows-link"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
[[package]]
name = "windows-numerics"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
dependencies = [
"windows-core",
"windows-link",
]
[[package]]
name = "windows-result"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
dependencies = [
"windows-link",
]
[[package]]
name = "windows-strings"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97"
dependencies = [
"windows-link",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.59.0" version = "0.59.0"
@ -1791,6 +2385,15 @@ dependencies = [
"windows_x86_64_msvc", "windows_x86_64_msvc",
] ]
[[package]]
name = "windows-version"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e04a5c6627e310a23ad2358483286c7df260c964eb2d003d8efd6d0f4e79265c"
dependencies = [
"windows-link",
]
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.52.6" version = "0.52.6"
@ -1899,7 +2502,8 @@ dependencies = [
"libc", "libc",
"log", "log",
"meval", "meval",
"nix", "nix 0.30.1",
"notify-rust",
"rayon", "rayon",
"regex", "regex",
"serde", "serde",
@ -1948,6 +2552,66 @@ dependencies = [
"linked-hash-map", "linked-hash-map",
] ]
[[package]]
name = "zbus"
version = "5.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2522b82023923eecb0b366da727ec883ace092e7887b61d3da5139f26b44da58"
dependencies = [
"async-broadcast",
"async-executor",
"async-io",
"async-lock",
"async-process",
"async-recursion",
"async-task",
"async-trait",
"blocking",
"enumflags2",
"event-listener",
"futures-core",
"futures-lite",
"hex",
"nix 0.29.0",
"ordered-stream",
"serde",
"serde_repr",
"tracing",
"uds_windows",
"windows-sys",
"winnow",
"zbus_macros",
"zbus_names",
"zvariant",
]
[[package]]
name = "zbus_macros"
version = "5.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05d2e12843c75108c00c618c2e8ef9675b50b6ec095b36dc965f2e5aed463c15"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.101",
"zbus_names",
"zvariant",
"zvariant_utils",
]
[[package]]
name = "zbus_names"
version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97"
dependencies = [
"serde",
"static_assertions",
"winnow",
"zvariant",
]
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.8.25" version = "0.8.25"
@ -1967,3 +2631,44 @@ dependencies = [
"quote", "quote",
"syn 2.0.101", "syn 2.0.101",
] ]
[[package]]
name = "zvariant"
version = "5.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "557e89d54880377a507c94cd5452f20e35d14325faf9d2958ebeadce0966c1b2"
dependencies = [
"endi",
"enumflags2",
"serde",
"winnow",
"zvariant_derive",
"zvariant_utils",
]
[[package]]
name = "zvariant_derive"
version = "5.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "757779842a0d242061d24c28be589ce392e45350dfb9186dfd7a042a2e19870c"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.101",
"zvariant_utils",
]
[[package]]
name = "zvariant_utils"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e16edfee43e5d7b553b77872d99bc36afdda75c223ca7ad5e3fbecd82ca5fc34"
dependencies = [
"proc-macro2",
"quote",
"serde",
"static_assertions",
"syn 2.0.101",
"winnow",
]

View file

@ -53,18 +53,21 @@ Styling names and classes are inspired by wofi, so most of the documentation and
### Selectors ### Selectors
|name|description| | name | description |
window|Entire main window| |-------------------------|---------------------------------------------------------------|
|outer-box|A box that everything else sits inside of| | `window` | Entire main window. |
|input|Text box for filtering items| | `outer-box` | A box that everything else sits inside of. |
|scroll|Scroll window containing inner-box| | `input` | Text box for filtering items. |
|inner-box|Box containing the menu entries| | `scroll` | Scrollable container that holds the `inner-box`. |
|entry|Box containing the text and optionally the image of an entry| | `inner-box` | Box containing the menu entries. |
|text|Name of the program/option inserted| | `entry` | Box containing the text and optionally the image of an entry. |
|img|Images displayed in entries| | `text` | Name of the program/option displayed in an entry. |
|row|The row containing the entry, i.e. used to control hover effects| | `img` | Image displayed in an entry (optional). |
| `row` | Row containing the entry, used to control hover effects. |
| `custom-key-label-text` | The label for custom keys |
| `custom-key-label-box` | Box containing the label, can be used for borders etc. |
Checkout more showcases in the styles directory of this repo. Checkout more showcases in the [styles directory of this repo](styles).
![](styles/compact/example.png) ![](styles/compact/example.png)

View file

@ -1,11 +1,12 @@
# Worf Warden # Worf Warden
Simple password manager build upon Simple password manager build upon these additional tools aside worf
* [rbw](https://github.com/doy/rbw) * [rbw](https://github.com/doy/rbw)
* TOTP needs this PR https://github.com/doy/rbw/pull/247 * TOTP needs [this PR ](https://github.com/doy/rbw/pull/247)
* [pinentry](https://www.gnupg.org/related_software/pinentry/index.en.html) is required to show a dialog show password entry
* As worf warden
* [ydotool](https://github.com/ReimuNotMoe/ydotool) * [ydotool](https://github.com/ReimuNotMoe/ydotool)
The idea it taken from https://github.com/mattydebie/bitwarden-rofi/blob/master/bwmenu The idea it taken from https://github.com/mattydebie/bitwarden-rofi/blob/master/bwmenu
Additional dependencies <img src="images/worf-warden.png">
* https://www.gnupg.org/related_software/pinentry/index.en.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

View file

@ -4,7 +4,7 @@ use std::process::Command;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
use worf_lib::config::Config; use worf_lib::config::Config;
use worf_lib::desktop::spawn_fork; use worf_lib::desktop::{copy_to_clipboard, spawn_fork};
use worf_lib::gui::{ItemProvider, Key, KeyBinding, MenuItem, Modifier}; use worf_lib::gui::{ItemProvider, Key, KeyBinding, MenuItem, Modifier};
use worf_lib::{config, gui}; use worf_lib::{config, gui};
@ -215,30 +215,6 @@ fn key_sync() -> KeyBinding {
} }
} }
fn key_urls() -> KeyBinding {
KeyBinding {
key: Key::U,
modifiers: Modifier::Alt,
label: "<b>Alt+u</b> Urls".to_string(),
}
}
fn key_names() -> KeyBinding {
KeyBinding {
key: Key::N,
modifiers: Modifier::Alt,
label: "<b>Alt+n</b> NAmes".to_string(),
}
}
fn key_folders() -> KeyBinding {
KeyBinding {
key: Key::C,
modifiers: Modifier::Alt,
label: "<b>Alt+c</b> Folders".to_string(),
}
}
/// copies totp to clipboard /// copies totp to clipboard
fn key_totp() -> KeyBinding { fn key_totp() -> KeyBinding {
KeyBinding { KeyBinding {
@ -268,9 +244,6 @@ fn show(config: Config, provider: PasswordProvider) -> Result<(), String> {
key_type_password(), key_type_password(),
key_type_totp(), key_type_totp(),
key_sync(), key_sync(),
key_urls(),
key_names(),
key_folders(),
key_totp(), key_totp(),
key_lock(), key_lock(),
]), ]),
@ -299,17 +272,14 @@ fn show(config: Config, provider: PasswordProvider) -> Result<(), String> {
rbw("lock", None)?; rbw("lock", None)?;
} else if key == key_sync() { } else if key == key_sync() {
rbw("sync", None)?; rbw("sync", None)?;
} else if key == key_urls() {
todo!("key urls");
} else if key == key_names() {
todo!("key names");
} else if key == key_folders() {
todo!("key folders");
} else if key == key_totp() { } else if key == key_totp() {
rbw_get_totp(id, true)?; rbw_get_totp(id, true)?;
} }
} else { } else {
rbw_get_password(id, true)?; let pw = rbw_get_password(id, true)?;
if let Err(e) = copy_to_clipboard(pw, None) {
log::error!("failed to copy to clipboard: {e}");
}
} }
Ok(()) Ok(())
} else { } else {
@ -330,7 +300,9 @@ fn main() -> Result<(), String> {
let config = config::load_config(Some(&args)).unwrap_or(args); let config = config::load_config(Some(&args)).unwrap_or(args);
if !groups().contains("input") { if !groups().contains("input") {
log::error!("User must be in input group. 'sudo usermod -aG input $USER', then login again"); log::error!(
"User must be in input group. 'sudo usermod -aG input $USER', then login again"
);
std::process::exit(1) std::process::exit(1)
} }

View file

@ -1,5 +1,6 @@
* { * {
font-family: DejaVu; font-family: DejaVu;
transition: opacity 500ms ease;
} }
#window { #window {
@ -28,12 +29,13 @@ font-family: DejaVu;
background-color: rgba(32, 32, 32, 0.6); background-color: rgba(32, 32, 32, 0.6);
color: #f2f2f2; color: #f2f2f2;
border-bottom: 2px solid rgba(214, 174, 2, 1); border-bottom: 2px solid rgba(214, 174, 2, 1);
padding: 1.2rem 1.2rem 1.2rem 1rem; padding: 1.2rem;
padding-left: 1rem;
font-size: 1rem; font-size: 1rem;
} }
#window #outer-box #scroll { #window #outer-box #scroll {
/* The name of the box containing all of the entries */ border-top: 2px solid rgba(214, 174, 0, 1);
} }
#window #outer-box #scroll #inner-box { #window #outer-box #scroll #inner-box {
/* The name of all entries */ /* The name of all entries */
@ -48,7 +50,6 @@ font-family: DejaVu;
/* The name of all the text in entries */ /* The name of all the text in entries */
} }
#window #outer-box #scroll #inner-box #entry #img { #window #outer-box #scroll #inner-box #entry #img {
width: 1rem;
margin-right: 0.5rem; margin-right: 0.5rem;
} }
#window #outer-box #scroll #inner-box #entry:selected { #window #outer-box #scroll #inner-box #entry:selected {
@ -58,7 +59,7 @@ font-family: DejaVu;
} }
#row:hover { #row:hover {
background-color: rgba(255, 255, 255, 0);; background-color: rgba(255, 255, 255, 0);
outline: inherit; outline: inherit;
outline-color: inherit; outline-color: inherit;
} }
@ -67,3 +68,14 @@ font-family: DejaVu;
outline: inherit; outline: inherit;
outline-color: inherit; outline-color: inherit;
} }
#custom-key-label-box {
margin-top: 0.25em;
margin-bottom: 0.25em;
border-right: 1px solid rgba(214, 174, 0, 1);
border-left: 1px solid rgba(214, 174, 0, 1);
padding-left: 1em;
}
#custom-key-label-text {
}

View file

@ -51,3 +51,4 @@ rayon = "1.10.0"
nix = { version = "0.30.0", features = ["process"] } nix = { version = "0.30.0", features = ["process"] }
emoji = "0.2.1" emoji = "0.2.1"
wl-clipboard-rs = "0.9.2" wl-clipboard-rs = "0.9.2"
notify-rust="4.11.7"

View file

@ -8,6 +8,7 @@ use std::time::Instant;
use std::{env, fs, io}; use std::{env, fs, io};
use freedesktop_file_parser::DesktopFile; use freedesktop_file_parser::DesktopFile;
use notify_rust::Notification;
use rayon::prelude::*; use rayon::prelude::*;
use regex::Regex; use regex::Regex;
use wl_clipboard_rs::copy::{ClipboardType, MimeType, ServeRequests, Source}; use wl_clipboard_rs::copy::{ClipboardType, MimeType, ServeRequests, Source};
@ -298,14 +299,29 @@ pub fn is_executable(entry: &Path) -> bool {
/// Copy the given text into the clipboard. /// Copy the given text into the clipboard.
/// # Errors /// # Errors
/// Will return an error if copying to the clipboard failed. /// Will return an error if copying to the clipboard failed.
pub fn copy_to_clipboard(text: String) -> Result<(), Error> { pub fn copy_to_clipboard(text: String, notify_body: Option<&str>) -> Result<(), Error> {
let mut opts = wl_clipboard_rs::copy::Options::new(); let mut opts = wl_clipboard_rs::copy::Options::new();
opts.clipboard(ClipboardType::Regular); opts.clipboard(ClipboardType::Regular);
opts.serve_requests(ServeRequests::Only(1)); opts.serve_requests(ServeRequests::Only(1));
let result = opts.copy(Source::Bytes(text.into_bytes().into()), MimeType::Text); let result = opts.copy(Source::Bytes(text.into_bytes().into()), MimeType::Text);
match result { match result {
Ok(()) => Ok(()), Ok(()) => {
Err(e) => Err(Error::Clipboard(e.to_string())), let mut notification = Notification::new();
notification.summary("Copied to clipboard");
if let Some(notify_body) = notify_body {
notification.body(notify_body);
}
notification.show().map_err(|e| Error::Io(e.to_string()))?;
Ok(())
}
Err(e) => {
Notification::new()
.summary("Failed to copy to clipboard")
.show()
.map_err(|e| Error::Io(e.to_string()))?;
Err(Error::Clipboard(e.to_string()))
}
} }
} }

View file

@ -794,8 +794,8 @@ fn handle_key_press<T: Clone + 'static + Send>(
{ {
let search_lock = ui.search_text.lock().unwrap(); let search_lock = ui.search_text.lock().unwrap();
if let Err(e) = handle_selected_item( if let Err(e) = handle_selected_item(
ui.clone(), ui,
meta.clone(), Rc::<MetaData<T>>::clone(meta),
Some(&search_lock), Some(&search_lock),
None, None,
meta.new_on_empty, meta.new_on_empty,
@ -817,8 +817,8 @@ fn handle_key_press<T: Clone + 'static + Send>(
gdk4::Key::Return => { gdk4::Key::Return => {
let search_lock = ui.search_text.lock().unwrap(); let search_lock = ui.search_text.lock().unwrap();
if let Err(e) = handle_selected_item( if let Err(e) = handle_selected_item(
ui.clone(), ui,
meta.clone(), Rc::<MetaData<T>>::clone(meta),
Some(&search_lock), Some(&search_lock),
None, None,
meta.new_on_empty, meta.new_on_empty,
@ -953,7 +953,7 @@ fn close_gui(app: &Application) {
} }
fn handle_selected_item<T>( fn handle_selected_item<T>(
ui: Rc<UiElements<T>>, ui: &Rc<UiElements<T>>,
meta: Rc<MetaData<T>>, meta: Rc<MetaData<T>>,
query: Option<&str>, query: Option<&str>,
item: Option<MenuItem<T>>, item: Option<MenuItem<T>>,
@ -964,19 +964,14 @@ where
T: Clone + Send + 'static, T: Clone + Send + 'static,
{ {
if let Some(selected_item) = item { if let Some(selected_item) = item {
send_selected_item(ui, meta, custom_key.map(|c| c.clone()), selected_item); send_selected_item(ui, meta, custom_key.cloned(), selected_item);
return Ok(()); return Ok(());
} else if let Some(s) = ui.main_box.selected_children().into_iter().next() { } else if let Some(s) = ui.main_box.selected_children().into_iter().next() {
let list_items = ui.menu_rows.lock().unwrap(); let list_items = ui.menu_rows.lock().unwrap();
let item = list_items.get(&s); let item = list_items.get(&s);
if let Some(selected_item) = item { if let Some(selected_item) = item {
if selected_item.visible { if selected_item.visible {
send_selected_item( send_selected_item(ui, meta, custom_key.cloned(), selected_item.clone());
ui.clone(),
meta,
custom_key.map(|c| c.clone()),
selected_item.clone(),
);
return Ok(()); return Ok(());
} }
} }
@ -995,7 +990,7 @@ where
visible: true, visible: true,
}; };
send_selected_item(ui, meta, custom_key.map(|c| c.clone()), item); send_selected_item(ui, meta, custom_key.cloned(), item);
Ok(()) Ok(())
} else { } else {
Err("selected item cannot be resolved".to_owned()) Err("selected item cannot be resolved".to_owned())
@ -1003,14 +998,14 @@ where
} }
fn send_selected_item<T>( fn send_selected_item<T>(
ui: Rc<UiElements<T>>, ui: &Rc<UiElements<T>>,
meta: Rc<MetaData<T>>, meta: Rc<MetaData<T>>,
custom_key: Option<KeyBinding>, custom_key: Option<KeyBinding>,
selected_item: MenuItem<T>, selected_item: MenuItem<T>,
) where ) where
T: Clone + Send + 'static, T: Clone + Send + 'static,
{ {
let ui_clone = Rc::clone(&ui); let ui_clone = Rc::clone(ui);
ui.window.connect_hide(move |_| { ui.window.connect_hide(move |_| {
if let Err(e) = meta.selected_sender.send(Ok(Selection { if let Err(e) = meta.selected_sender.send(Ok(Selection {
menu: selected_item.clone(), menu: selected_item.clone(),
@ -1127,8 +1122,8 @@ fn create_menu_row<T: Clone + 'static + Send>(
click.connect_pressed(move |_gesture, n_press, _x, _y| { click.connect_pressed(move |_gesture, n_press, _x, _y| {
if n_press == 2 { if n_press == 2 {
if let Err(e) = handle_selected_item( if let Err(e) = handle_selected_item(
click_ui.clone(), &click_ui,
click_meta.clone(), Rc::<MetaData<T>>::clone(&click_meta),
None, None,
Some(element_clone.clone()), Some(element_clone.clone()),
false, false,
@ -1278,12 +1273,8 @@ fn set_menu_visibility_for_search<T: Clone>(
} }
} }
MatchMethod::MultiContains => { MatchMethod::MultiContains => {
let score = query let contains = query.split(' ').all(|x| menu_item_search.contains(x));
.split(' ') (if contains { 1.0 } else { 0.0 }, contains)
.filter(|i| menu_item_search.contains(i))
.map(|_| 1.0)
.sum();
(score, score > 0.0)
} }
}; };

View file

@ -9,7 +9,6 @@ pub mod gui;
/// Out of the box supported modes, like drun, dmenu, etc... /// Out of the box supported modes, like drun, dmenu, etc...
pub mod modes; pub mod modes;
/// Defines error the lib can encounter /// Defines error the lib can encounter
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub enum Error { pub enum Error {

View file

@ -1,14 +1,14 @@
use regex::Regex;
use crate::config::Config; use crate::config::Config;
use crate::desktop::{copy_to_clipboard, spawn_fork}; use crate::desktop::{copy_to_clipboard, spawn_fork};
use crate::{gui, Error};
use crate::gui::{ItemProvider, MenuItem}; use crate::gui::{ItemProvider, MenuItem};
use crate::modes::math::MathProvider; use crate::modes::drun::{DRunProvider, update_drun_cache_and_run};
use crate::modes::drun::{update_drun_cache_and_run, DRunProvider};
use crate::modes::emoji::EmojiProvider; use crate::modes::emoji::EmojiProvider;
use crate::modes::file::FileItemProvider; use crate::modes::file::FileItemProvider;
use crate::modes::math::MathProvider;
use crate::modes::ssh; use crate::modes::ssh;
use crate::modes::ssh::SshProvider; use crate::modes::ssh::SshProvider;
use crate::{Error, gui};
use regex::Regex;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
enum AutoRunType { enum AutoRunType {
@ -78,19 +78,17 @@ impl ItemProvider<AutoRunType> for AutoItemProvider {
_ => return self.default_auto_elements(search_opt), _ => return self.default_auto_elements(search_opt),
}; };
let (mode, (changed, items)) = let (mode, (changed, items)) = if contains_math_functions_or_starts_with_number(search) {
if contains_math_functions_or_starts_with_number(search) { (AutoRunType::Math, self.math.get_elements(search_opt))
(AutoRunType::Math, self.math.get_elements(search_opt)) } else if search.starts_with('$') || search.starts_with('/') || search.starts_with('~') {
} else if search.starts_with('$') || search.starts_with('/') || search.starts_with('~') (AutoRunType::File, self.file.get_elements(search_opt))
{ } else if search.starts_with("ssh") {
(AutoRunType::File, self.file.get_elements(search_opt)) (AutoRunType::Ssh, self.ssh.get_elements(search_opt))
} else if search.starts_with("ssh") { } else if search.starts_with("emoji") {
(AutoRunType::Ssh, self.ssh.get_elements(search_opt)) (AutoRunType::Emoji, self.emoji.get_elements(search_opt))
} else if search.starts_with("emoji") { } else {
(AutoRunType::Emoji, self.emoji.get_elements(search_opt)) return self.default_auto_elements(search_opt);
} else { };
return self.default_auto_elements(search_opt);
};
if self.last_mode.as_ref().is_some_and(|m| m == &mode) { if self.last_mode.as_ref().is_some_and(|m| m == &mode) {
(changed, items) (changed, items)
@ -109,7 +107,6 @@ impl ItemProvider<AutoRunType> for AutoItemProvider {
} }
} }
/// Shows the auto mode /// Shows the auto mode
/// # Errors /// # Errors
/// ///
@ -161,7 +158,7 @@ pub fn show(config: &Config) -> Result<(), Error> {
} }
AutoRunType::Emoji => { AutoRunType::Emoji => {
if let Some(action) = selection_result.action { if let Some(action) = selection_result.action {
copy_to_clipboard(action)?; copy_to_clipboard(action, None)?;
} else { } else {
return Err(Error::MissingAction); return Err(Error::MissingAction);
} }
@ -179,4 +176,4 @@ pub fn show(config: &Config) -> Result<(), Error> {
} }
Ok(()) Ok(())
} }

View file

@ -1,8 +1,8 @@
use crate::config::{Config, SortOrder};
use crate::gui::{ItemProvider, MenuItem};
use crate::{Error, gui};
use std::io; use std::io;
use std::io::Read; use std::io::Read;
use crate::config::{Config, SortOrder};
use crate::{gui, Error};
use crate::gui::{ItemProvider, MenuItem};
#[derive(Clone)] #[derive(Clone)]
struct DMenuProvider { struct DMenuProvider {
@ -37,7 +37,6 @@ impl ItemProvider<String> for DMenuProvider {
} }
} }
/// Shows the dmenu mode /// Shows the dmenu mode
/// # Errors /// # Errors
/// ///
@ -53,4 +52,4 @@ pub fn show(config: &Config) -> Result<(), Error> {
} }
Err(_) => Err(Error::InvalidSelection), Err(_) => Err(Error::InvalidSelection),
} }
} }

View file

@ -1,14 +1,16 @@
use std::collections::{HashMap, HashSet}; use crate::config::{Config, SortOrder};
use std::path::PathBuf; use crate::desktop::{
use std::time::Instant; find_desktop_files, get_locale_variants, lookup_name_with_locale, save_cache_file, spawn_fork,
};
use crate::gui::{ItemProvider, MenuItem};
use crate::modes::load_cache;
use crate::{Error, gui};
use freedesktop_file_parser::EntryType; use freedesktop_file_parser::EntryType;
use rayon::prelude::*; use rayon::prelude::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::config::{Config, SortOrder}; use std::collections::{HashMap, HashSet};
use crate::desktop::{find_desktop_files, get_locale_variants, lookup_name_with_locale, save_cache_file, spawn_fork}; use std::path::PathBuf;
use crate::{gui, Error}; use std::time::Instant;
use crate::gui::{ItemProvider, MenuItem};
use crate::modes::load_cache;
#[derive(Debug, Deserialize, Serialize, Clone)] #[derive(Debug, Deserialize, Serialize, Clone)]
struct DRunCache { struct DRunCache {

View file

@ -1,7 +1,7 @@
use crate::config::{Config, SortOrder}; use crate::config::{Config, SortOrder};
use crate::{gui, Error};
use crate::desktop::copy_to_clipboard; use crate::desktop::copy_to_clipboard;
use crate::gui::{ItemProvider, MenuItem}; use crate::gui::{ItemProvider, MenuItem};
use crate::{Error, gui};
#[derive(Clone)] #[derive(Clone)]
pub(crate) struct EmojiProvider<T: Clone> { pub(crate) struct EmojiProvider<T: Clone> {
@ -55,6 +55,6 @@ pub fn show(config: &Config) -> Result<(), Error> {
let selection_result = gui::show(config.clone(), provider, true, None, None)?; let selection_result = gui::show(config.clone(), provider, true, None, None)?;
match selection_result.menu.action { match selection_result.menu.action {
None => Err(Error::MissingAction), None => Err(Error::MissingAction),
Some(action) => copy_to_clipboard(action), Some(action) => copy_to_clipboard(action, None),
} }
} }

View file

@ -1,11 +1,11 @@
use crate::config::{Config, SortOrder, expand_path};
use crate::desktop::spawn_fork;
use crate::gui::{ItemProvider, MenuItem};
use crate::{Error, gui};
use regex::Regex;
use std::fs; use std::fs;
use std::os::unix::fs::FileTypeExt; use std::os::unix::fs::FileTypeExt;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use regex::Regex;
use crate::config::{expand_path, Config, SortOrder};
use crate::{gui, Error};
use crate::desktop::spawn_fork;
use crate::gui::{ItemProvider, MenuItem};
#[derive(Clone)] #[derive(Clone)]
pub(crate) struct FileItemProvider<T: Clone> { pub(crate) struct FileItemProvider<T: Clone> {
@ -185,8 +185,6 @@ impl<T: Clone> ItemProvider<T> for FileItemProvider<T> {
} }
} }
/// Shows the file browser mode /// Shows the file browser mode
/// # Errors /// # Errors
/// ///

View file

@ -1,16 +1,15 @@
use crate::desktop::{create_file_if_not_exists, load_cache_file};
use std::collections::HashMap; use std::collections::HashMap;
use std::path::PathBuf; use std::path::PathBuf;
use crate::desktop::{create_file_if_not_exists, load_cache_file};
pub mod auto;
pub mod dmenu; pub mod dmenu;
pub mod drun;
pub mod emoji;
pub mod file; pub mod file;
pub mod math; pub mod math;
pub mod auto;
pub mod drun;
pub mod run; pub mod run;
pub mod ssh; pub mod ssh;
pub mod emoji;
pub(crate) fn load_cache(cache_path: Option<PathBuf>) -> (Option<PathBuf>, HashMap<String, i64>) { pub(crate) fn load_cache(cache_path: Option<PathBuf>) -> (Option<PathBuf>, HashMap<String, i64>) {
let cache = { let cache = {

View file

@ -1,12 +1,12 @@
use std::collections::{HashMap, HashSet};
use std::{env, fs};
use std::ffi::CString;
use std::path::PathBuf;
use crate::config::{Config, SortOrder}; use crate::config::{Config, SortOrder};
use crate::desktop::{is_executable, save_cache_file}; use crate::desktop::{is_executable, save_cache_file};
use crate::{gui, Error};
use crate::gui::{ItemProvider, MenuItem}; use crate::gui::{ItemProvider, MenuItem};
use crate::modes::load_cache; use crate::modes::load_cache;
use crate::{Error, gui};
use std::collections::{HashMap, HashSet};
use std::ffi::CString;
use std::path::PathBuf;
use std::{env, fs};
impl ItemProvider<i32> for RunProvider { impl ItemProvider<i32> for RunProvider {
fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec<MenuItem<i32>>) { fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec<MenuItem<i32>>) {
@ -92,7 +92,6 @@ impl RunProvider {
} }
} }
fn load_run_cache() -> (Option<PathBuf>, HashMap<String, i64>) { fn load_run_cache() -> (Option<PathBuf>, HashMap<String, i64>) {
let cache_path = dirs::cache_dir().map(|x| x.join("worf-run")); let cache_path = dirs::cache_dir().map(|x| x.join("worf-run"));
load_cache(cache_path) load_cache(cache_path)
@ -122,7 +121,6 @@ fn update_run_cache_and_run<T: Clone>(
} }
} }
/// Shows the run mode /// Shows the run mode
/// # Errors /// # Errors
/// ///

View file

@ -1,9 +1,9 @@
use std::fs;
use regex::Regex;
use crate::config::{Config, SortOrder}; use crate::config::{Config, SortOrder};
use crate::{gui, Error};
use crate::desktop::spawn_fork; use crate::desktop::spawn_fork;
use crate::gui::{ItemProvider, MenuItem}; use crate::gui::{ItemProvider, MenuItem};
use crate::{Error, gui};
use regex::Regex;
use std::fs;
#[derive(Clone)] #[derive(Clone)]
pub(crate) struct SshProvider<T: Clone> { pub(crate) struct SshProvider<T: Clone> {
@ -12,7 +12,7 @@ pub(crate) struct SshProvider<T: Clone> {
impl<T: Clone> SshProvider<T> { impl<T: Clone> SshProvider<T> {
pub(crate) fn new(menu_item_data: T, order: &SortOrder) -> Self { pub(crate) fn new(menu_item_data: T, order: &SortOrder) -> Self {
let re = Regex::new(r"(?m)^\s*Host\s+(.+)$").unwrap(); let re = Regex::new(r"(?m)^\s*Host\s+(.+)$").unwrap();
let mut items: Vec<_> = dirs::home_dir() let mut items: Vec<_> = dirs::home_dir()
.map(|home| home.join(".ssh").join("config")) .map(|home| home.join(".ssh").join("config"))
.filter(|path| path.exists()) .filter(|path| path.exists())
@ -92,4 +92,4 @@ pub fn show(config: &Config) -> Result<(), Error> {
log::error!("No item selected"); log::error!("No item selected");
} }
Ok(()) Ok(())
} }

View file

@ -2,7 +2,8 @@ use std::env;
use anyhow::anyhow; use anyhow::anyhow;
use worf_lib::config::Mode; use worf_lib::config::Mode;
use worf_lib::{Error, config, mode, modes}; use worf_lib::{Error, config, modes};
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
env_logger::Builder::new() env_logger::Builder::new()
.parse_filters(&env::var("RUST_LOG").unwrap_or_else(|_| "error".to_owned())) .parse_filters(&env::var("RUST_LOG").unwrap_or_else(|_| "error".to_owned()))