diff --git a/.gitignore b/.gitignore index 3a8cabc..d57451d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target .idea +*target* diff --git a/Cargo.lock b/Cargo.lock index 25f5eb1..950e04e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,9 +63,148 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" +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]] name = "atty" @@ -73,7 +212,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -96,6 +235,28 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "cairo-rs" version = "0.20.7" @@ -168,9 +329,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.35" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944" +checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" dependencies = [ "clap_builder", "clap_derive", @@ -178,9 +339,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.35" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9" +checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" dependencies = [ "anstream", "anstyle", @@ -197,7 +358,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -221,6 +382,15 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "crossbeam" version = "0.8.4" @@ -236,9 +406,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.14" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" dependencies = [ "crossbeam-utils", ] @@ -277,6 +447,15 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "deranged" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +dependencies = [ + "powerfmt", +] + [[package]] name = "dirs" version = "6.0.0" @@ -298,6 +477,16 @@ dependencies = [ "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]] name = "downcast-rs" version = "1.2.1" @@ -322,6 +511,33 @@ dependencies = [ "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]] name = "env_filter" version = "0.1.3" @@ -367,6 +583,27 @@ dependencies = [ "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]] name = "fastrand" version = "2.3.0" @@ -437,6 +674,19 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "futures-macro" version = "0.3.31" @@ -445,7 +695,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -548,9 +798,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", @@ -650,7 +900,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -786,7 +1036,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -816,9 +1066,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" [[package]] name = "heck" @@ -835,6 +1085,18 @@ dependencies = [ "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]] name = "indexmap" version = "1.9.3" @@ -852,7 +1114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown 0.15.2", + "hashbrown 0.15.3", ] [[package]] @@ -878,9 +1140,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jiff" -version = "0.2.5" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c102670231191d07d37a35af3eb77f1f0dbf7a71be51a962dcd57ea607be7260" +checksum = "d07d8d955d798e7a4d6f9c58cd1f1916e790b42b092758a9ef6e16fef9f1b3fd" dependencies = [ "jiff-static", "log", @@ -891,13 +1153,13 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.5" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cdde31a9d349f1b1f51a0b3714a5940ac022976f4b49485fc04be052b183b4c" +checksum = "f244cfe006d98d26f859c7abd1318d85327e1882dc9cef80f62daeeb0adcf300" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -914,9 +1176,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.171" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "libredox" @@ -952,6 +1214,18 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "memchr" version = "2.7.4" @@ -985,9 +1259,22 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "nix" -version = "0.30.0" +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]] +name = "nix" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537bc3c4a347b87fd52ac6c03a02ab1302962cfd93373c5d7a112cdc337854cc" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ "bitflags 2.9.0", "cfg-if", @@ -1011,6 +1298,65 @@ dependencies = [ "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]] name = "once_cell" version = "1.21.3" @@ -1023,6 +1369,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "os_pipe" version = "1.2.1" @@ -1063,6 +1419,12 @@ dependencies = [ "system-deps", ] +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[package]] name = "petgraph" version = "0.6.5" @@ -1129,12 +1491,38 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "pkg-config" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "portable-atomic" version = "1.11.0" @@ -1150,6 +1538,12 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1176,9 +1570,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -1294,7 +1688,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", "libredox", "thiserror", ] @@ -1352,9 +1746,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags 2.9.0", "errno", @@ -1392,7 +1786,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1407,6 +1801,17 @@ dependencies = [ "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]] name = "serde_spanned" version = "0.6.8" @@ -1422,6 +1827,15 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "siphasher" version = "0.3.11" @@ -1443,6 +1857,12 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.10.0" @@ -1468,9 +1888,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -1496,6 +1916,18 @@ version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "tempfile" version = "3.19.1" @@ -1505,7 +1937,7 @@ dependencies = [ "fastrand", "getrandom 0.3.2", "once_cell", - "rustix 1.0.5", + "rustix 1.0.7", "windows-sys", ] @@ -1541,7 +1973,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1554,6 +1986,25 @@ dependencies = [ "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]] name = "tini" version = "1.3.0" @@ -1562,9 +2013,9 @@ checksum = "e004df4c5f0805eb5f55883204a514cfa43a6d924741be29e871753a53d5565a" [[package]] name = "toml" -version = "0.8.20" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" dependencies = [ "serde", "serde_spanned", @@ -1574,26 +2025,64 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.24" +version = "0.22.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" dependencies = [ "indexmap 2.9.0", "serde", "serde_spanned", "toml_datetime", + "toml_write", "winnow", ] +[[package]] +name = "toml_write" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +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]] name = "tree_magic_mini" version = "3.1.6" @@ -1607,6 +2096,17 @@ dependencies = [ "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]] name = "unicode-ident" version = "1.0.18" @@ -1724,7 +2224,7 @@ checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" dependencies = [ "either", "env_home", - "rustix 1.0.5", + "rustix 1.0.7", "winsafe", ] @@ -1759,6 +2259,107 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "windows-sys" version = "0.59.0" @@ -1784,6 +2385,15 @@ dependencies = [ "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]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -1834,9 +2444,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.4" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" +checksum = "d9fb597c990f03753e08d3c29efbfcf2019a003b4bf4ba19225c158e1549f0f3" dependencies = [ "memchr", ] @@ -1880,7 +2490,7 @@ name = "worf" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.5.35", + "clap 4.5.37", "crossbeam", "dirs", "emoji", @@ -1892,7 +2502,8 @@ dependencies = [ "libc", "log", "meval", - "nix", + "nix 0.30.1", + "notify-rust", "rayon", "regex", "serde", @@ -1905,6 +2516,15 @@ dependencies = [ "wl-clipboard-rs", ] +[[package]] +name = "worf-warden" +version = "0.1.0" +dependencies = [ + "env_logger", + "log", + "worf", +] + [[package]] name = "xdgkit" version = "3.2.5" @@ -1919,9 +2539,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.25" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5b940ebc25896e71dd073bad2dbaa2abfe97b0a391415e22ad1326d9c54e3c4" +checksum = "a62ce76d9b56901b19a74f19431b0d8b3bc7ca4ad685a746dfd78ca8f4fc6bda" [[package]] name = "yaml-rust" @@ -1932,6 +2552,66 @@ dependencies = [ "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]] name = "zerocopy" version = "0.8.25" @@ -1949,5 +2629,46 @@ checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "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", ] diff --git a/Cargo.toml b/Cargo.toml index ca23d5c..a9cac66 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,51 +1,7 @@ -[package] -name = "worf" -version = "0.1.0" -edition = "2024" +[workspace] +members = [ + "worf", + "examples/worf-warden", +] -[lints.clippy] -# enable pedantic -pedantic = { level = "warn", priority = -1 } -## exclude some too pedantic lints for now -similar_names = "allow" - -# additional lints -clone_on_ref_ptr = "warn" - -[lib] -name = "worf_lib" -path = "src/lib/mod.rs" - -[[bin]] -name = "worf" -path = "src/main.rs" - - -[package.metadata.docs.rs] -no-deps = true - -[dependencies] -gtk4 = { version = "0.9.5", default-features = true, features = ["v4_6"] } -gtk4-layer-shell = "0.5.0" -gdk4 = "0.9.6" -anyhow = "1.0.97" -env_logger = "0.11.8" -log = "0.4.27" -regex = "1.11.1" -clap = { version = "4.5.35", features = ["derive"] } -thiserror = "2.0.12" -serde = { version = "1.0.219", features = ["derive"] } -toml = "0.8.20" -serde_json = "1.0.140" -crossbeam = "0.8.4" -libc = "0.2.171" -freedesktop-file-parser = "0.1.3" -strsim = "0.11.1" -dirs = "6.0.0" -which = "7.0.3" -meval = "0.2.0" -tree_magic_mini = "3.1.6" -rayon = "1.10.0" -nix = { version = "0.30.0", features = ["process"] } -emoji = "0.2.1" -wl-clipboard-rs = "0.9.2" +resolver = "3" diff --git a/README.md b/README.md index 3c66e01..350c96f 100644 --- a/README.md +++ b/README.md @@ -53,18 +53,21 @@ Styling names and classes are inspired by wofi, so most of the documentation and ### Selectors -|name|description| -window|Entire main window| -|outer-box|A box that everything else sits inside of| -|input|Text box for filtering items| -|scroll|Scroll window containing inner-box| -|inner-box|Box containing the menu entries| -|entry|Box containing the text and optionally the image of an entry| -|text|Name of the program/option inserted| -|img|Images displayed in entries| -|row|The row containing the entry, i.e. used to control hover effects| - -Checkout more showcases in the styles directory of this repo. +| name | description | +|-------------------------|---------------------------------------------------------------| +| `window` | Entire main window. | +| `outer-box` | A box that everything else sits inside of. | +| `input` | Text box for filtering items. | +| `scroll` | Scrollable container that holds the `inner-box`. | +| `inner-box` | Box containing the menu entries. | +| `entry` | Box containing the text and optionally the image of an entry. | +| `text` | Name of the program/option displayed in an entry. | +| `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](styles). ![](styles/compact/example.png) diff --git a/examples/dmenu.sh b/examples/dmenu.sh index 50991d4..1173480 100755 --- a/examples/dmenu.sh +++ b/examples/dmenu.sh @@ -1,12 +1,13 @@ #!/bin/bash # A list of options, one per line -options="Option 1 -Option 2 -Option 3" +options="" +for i in $(seq 1 2000); do + options+="Option $i"$'\n' +done # Pipe options to wofi and capture the selection -selection=$(echo "$options" | cargo run -- --show dmenu) +selection=$(echo "$options" | cargo run --bin worf -- --show dmenu --sort-order default) #selection=$(echo "$options" | wofi --show dmenu) # Do something with the selection diff --git a/examples/worf-warden/Cargo.lock b/examples/worf-warden/Cargo.lock new file mode 100644 index 0000000..29ab8a1 --- /dev/null +++ b/examples/worf-warden/Cargo.lock @@ -0,0 +1,2142 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +dependencies = [ + "anstyle", + "once_cell", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" + +[[package]] +name = "cairo-rs" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae50b5510d86cf96ac2370e66d8dc960882f3df179d6a5a1e52bd94a1416c0f7" +dependencies = [ + "bitflags 2.9.0", + "cairo-sys-rs", + "glib", + "libc", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18b6bb8e43c7eb0f2aac7976afe0c61b6f5fc2ab7bc4c139537ea56c92290df" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "cc" +version = "1.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-expr" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d4ba6e40bd1184518716a6e1a781bf9160e286d219ccdb8ab2612e74cfe4789" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "clap" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +dependencies = [ + "atty", + "bitflags 1.3.2", + "clap_lex 0.2.4", + "indexmap 1.9.3", + "strsim 0.10.0", + "termcolor", + "textwrap", + "yaml-rust", +] + +[[package]] +name = "clap" +version = "4.5.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" +dependencies = [ + "anstream", + "anstyle", + "clap_lex 0.7.4", + "strsim 0.11.1", +] + +[[package]] +name = "clap_derive" +version = "4.5.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "clap_lex" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" + +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "crossbeam" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "emoji" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e9309870371f7fa7767752e5048fc0c0675b017a27d9c601dffe9a1efe0301" +dependencies = [ + "fuzzy-matcher", + "itertools", + "lazy_static", + "phf", +] + +[[package]] +name = "enigo" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "802e4b2ae123615659085369b453cba87c5562e46ed8050a909fee18a9bc3157" +dependencies = [ + "core-graphics", + "libc", + "objc", + "pkg-config", + "windows", +] + +[[package]] +name = "env_filter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_home" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "freedesktop-file-parser" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6059d3997cc694ec3e9a378db855866233ef7edfeafd85afcb2239fd130e6e6b" +dependencies = [ + "thiserror", + "xdgkit", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fuzzy-matcher" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94" +dependencies = [ + "thread_local", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7563afd6ff0a221edfbb70a78add5075b8d9cb48e637a40a24c3ece3fea414d0" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67f2587c9202bf997476bbba6aaed4f78a11538a2567df002a5f57f5331d0b5c" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gdk4" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4850c9d9c1aecd1a3eb14fadc1cdb0ac0a2298037e116264c7473e1740a32d60" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk4-sys", + "gio", + "gl", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk4-sys" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f6eb95798e2b46f279cf59005daf297d5b69555428f185650d71974a910473a" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "gio" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f00c70f8029d84ea7572dd0e1aaa79e5329667b4c17f329d79ffb1e6277487" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "pin-project-lite", + "smallvec", +] + +[[package]] +name = "gio-sys" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "160eb5250a26998c3e1b54e6a3d4ea15c6c7762a6062a19a7b63eff6e2b33f9e" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "windows-sys", +] + +[[package]] +name = "gl" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a94edab108827d67608095e269cf862e60d920f144a5026d3dbcfd8b877fb404" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glib" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707b819af8059ee5395a2de9f2317d87a53dbad8846a2f089f0bb44703f37686" +dependencies = [ + "bitflags 2.9.0", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "smallvec", +] + +[[package]] +name = "glib-macros" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715601f8f02e71baef9c1f94a657a9a77c192aea6097cf9ae7e5e177cd8cde68" +dependencies = [ + "heck", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "glib-sys" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8928869a44cfdd1fccb17d6746e4ff82c8f82e41ce705aa026a52ca8dc3aefb" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "gobject-sys" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c773a3cb38a419ad9c26c81d177d96b4b08980e8bdbbf32dace883e96e96e7e3" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "graphene-rs" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbc5911bfb32d68dcfa92c9510c462696c2f715548fcd7f3f1be424c739de19" +dependencies = [ + "glib", + "graphene-sys", + "libc", +] + +[[package]] +name = "graphene-sys" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11a68d39515bf340e879b72cecd4a25c1332557757ada6e8aba8654b4b81d23a" +dependencies = [ + "glib-sys", + "libc", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gsk4" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f5e72f931c8c9f65fbfc89fe0ddc7746f147f822f127a53a9854666ac1f855" +dependencies = [ + "cairo-rs", + "gdk4", + "glib", + "graphene-rs", + "gsk4-sys", + "libc", + "pango", +] + +[[package]] +name = "gsk4-sys" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "755059de55fa6f85a46bde8caf03e2184c96bfda1f6206163c72fb0ea12436dc" +dependencies = [ + "cairo-sys-rs", + "gdk4-sys", + "glib-sys", + "gobject-sys", + "graphene-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "gtk4" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1c491051f030994fd0cde6f3c44f3f5640210308cff1298c7673c47408091d" +dependencies = [ + "cairo-rs", + "field-offset", + "futures-channel", + "gdk-pixbuf", + "gdk4", + "gio", + "glib", + "graphene-rs", + "gsk4", + "gtk4-macros", + "gtk4-sys", + "libc", + "pango", +] + +[[package]] +name = "gtk4-layer-shell" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aec4fd3226bb6aa8dda5370142e14a4d15f00bba99bfb355b6ef7bb49d100758" +dependencies = [ + "bitflags 2.9.0", + "gdk4", + "glib", + "glib-sys", + "gtk4", + "gtk4-layer-shell-sys", + "libc", +] + +[[package]] +name = "gtk4-layer-shell-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3057dc117db2d664a9b45f1956568701914e80cf9f2c8cef0a755af4c1c8105" +dependencies = [ + "gdk4-sys", + "glib-sys", + "gtk4-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gtk4-macros" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed1786c4703dd196baf7e103525ce0cf579b3a63a0570fe653b7ee6bac33999" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "gtk4-sys" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41e03b01e54d77c310e1d98647d73f996d04b2f29b9121fe493ea525a7ec03d6" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk4-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "graphene-sys", + "gsk4-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown 0.15.3", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jiff" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07d8d955d798e7a4d6f9c58cd1f1916e790b42b092758a9ef6e16fef9f1b3fd" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", +] + +[[package]] +name = "jiff-static" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f244cfe006d98d26f859c7abd1318d85327e1882dc9cef80f62daeeb0adcf300" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.9.0", + "libc", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "meval" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f79496a5651c8d57cd033c5add8ca7ee4e3d5f7587a4777484640d9cb60392d9" +dependencies = [ + "fnv", + "nom 1.2.4", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags 2.9.0", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "os_pipe" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + +[[package]] +name = "pango" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1f5dc1b8cf9bc08bfc0843a04ee0fa2e78f1e1fa4b126844a383af4f25f0ec" +dependencies = [ + "gio", + "glib", + "libc", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dbb9b751673bd8fe49eb78620547973a1e719ed431372122b20abd12445bab5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.9.0", +] + +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_macros", + "phf_shared", + "proc-macro-hack", +] + +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "portable-atomic" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-crate" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-xml" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0452695941410a58c8ce4391707ba9bad26a247173bd9886a05a5e8a8babec75" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "quick-xml" +version = "0.37.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", + "rand_pcg", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_users" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" +dependencies = [ + "getrandom 0.2.16", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.9.0", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys", +] + +[[package]] +name = "rustix" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +dependencies = [ + "bitflags 2.9.0", + "errno", + "libc", + "linux-raw-sys 0.9.4", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-deps" +version = "7.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tempfile" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" +dependencies = [ + "fastrand", + "getrandom 0.3.2", + "once_cell", + "rustix 1.0.7", + "windows-sys", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tini" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e004df4c5f0805eb5f55883204a514cfa43a6d924741be29e871753a53d5565a" + +[[package]] +name = "toml" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" +dependencies = [ + "indexmap 2.9.0", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" + +[[package]] +name = "tree_magic_mini" +version = "3.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac5e8971f245c3389a5a76e648bfc80803ae066a1243a75db0064d7c1129d63" +dependencies = [ + "fnv", + "memchr", + "nom 7.1.3", + "once_cell", + "petgraph", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wayland-backend" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe770181423e5fc79d3e2a7f4410b7799d5aab1de4372853de3c6aa13ca24121" +dependencies = [ + "cc", + "downcast-rs", + "rustix 0.38.44", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978fa7c67b0847dbd6a9f350ca2569174974cd4082737054dbb7fbb79d7d9a61" +dependencies = [ + "bitflags 2.9.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "779075454e1e9a521794fed15886323ea0feda3f8b0fc1390f5398141310422a" +dependencies = [ + "bitflags 2.9.0", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cb6cdc73399c0e06504c437fe3cf886f25568dd5454473d565085b36d6a8bbf" +dependencies = [ + "bitflags 2.9.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484" +dependencies = [ + "proc-macro2", + "quick-xml 0.37.5", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "which" +version = "7.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" +dependencies = [ + "either", + "env_home", + "rustix 1.0.7", + "winsafe", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +dependencies = [ + "windows-core", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9fb597c990f03753e08d3c29efbfcf2019a003b4bf4ba19225c158e1549f0f3" +dependencies = [ + "memchr", +] + +[[package]] +name = "winsafe" +version = "0.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags 2.9.0", +] + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5ff8d0e60065f549fafd9d6cb626203ea64a798186c80d8e7df4f8af56baeb" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 0.38.44", + "tempfile", + "thiserror", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "worf" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap 4.5.37", + "crossbeam", + "dirs", + "emoji", + "env_logger", + "freedesktop-file-parser", + "gdk4", + "gtk4", + "gtk4-layer-shell", + "libc", + "log", + "meval", + "nix", + "rayon", + "regex", + "serde", + "serde_json", + "strsim 0.11.1", + "thiserror", + "toml", + "tree_magic_mini", + "which", + "wl-clipboard-rs", +] + +[[package]] +name = "worf-warden" +version = "0.1.0" +dependencies = [ + "enigo", + "worf", +] + +[[package]] +name = "xdgkit" +version = "3.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aeac9c0125f3c131c6a2898d2a9f25c11b7954c3ff644a018cb9e06fa92919b" +dependencies = [ + "clap 3.2.25", + "quick-xml 0.21.0", + "serde", + "tini", +] + +[[package]] +name = "xml-rs" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62ce76d9b56901b19a74f19431b0d8b3bc7ca4ad685a746dfd78ca8f4fc6bda" + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "zerocopy" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] diff --git a/examples/worf-warden/Cargo.toml b/examples/worf-warden/Cargo.toml new file mode 100644 index 0000000..f7244ae --- /dev/null +++ b/examples/worf-warden/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "worf-warden" +version = "0.1.0" +edition = "2024" + +[dependencies] +worf = {path = "../../worf"} +env_logger = "0.11.8" +log = "0.4.27" + +# todo re-add this +#[features] +#default = [] # nothing enabled by default +#warden = ["worf-warden"] diff --git a/examples/worf-warden/Readme.md b/examples/worf-warden/Readme.md new file mode 100644 index 0000000..b383f57 --- /dev/null +++ b/examples/worf-warden/Readme.md @@ -0,0 +1,12 @@ +# Worf Warden + +Simple password manager build upon these additional tools aside worf +* [rbw](https://github.com/doy/rbw) + * 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) + +The idea it taken from https://github.com/mattydebie/bitwarden-rofi/blob/master/bwmenu + + diff --git a/examples/worf-warden/images/worf-warden.png b/examples/worf-warden/images/worf-warden.png new file mode 100644 index 0000000..b3dfe4d Binary files /dev/null and b/examples/worf-warden/images/worf-warden.png differ diff --git a/examples/worf-warden/src/main.rs b/examples/worf-warden/src/main.rs new file mode 100644 index 0000000..13c2b41 --- /dev/null +++ b/examples/worf-warden/src/main.rs @@ -0,0 +1,316 @@ +use std::collections::HashMap; +use std::env; +use std::process::Command; +use std::thread::sleep; +use std::time::Duration; +use worf_lib::config::Config; +use worf_lib::desktop::{copy_to_clipboard, spawn_fork}; +use worf_lib::gui::{ItemProvider, Key, KeyBinding, MenuItem, Modifier}; +use worf_lib::{config, gui}; + +#[derive(Clone)] +struct MenuItemMetaData { + ids: Vec, +} + +#[derive(Clone)] +struct PasswordProvider { + items: Vec>, +} + +fn split_at_tab(input: &str) -> Option<(&str, &str)> { + let mut parts = input.splitn(2, '\t'); + Some((parts.next()?, parts.next()?)) +} + +impl PasswordProvider { + fn new(config: &Config) -> Self { + let output = rbw("list", Some(vec!["--fields", "id,name"])); + let items = match output { + Ok(output) => { + let mut items = output + .lines() + .filter_map(|s| split_at_tab(s)) + .fold( + HashMap::new(), + |mut acc: HashMap>, (id, name)| { + acc.entry(name.to_owned()).or_default().push(id.to_owned()); + acc + }, + ) + .iter() + .map(|(key, value)| { + MenuItem::new( + key.clone(), + None, + None, + vec![], + None, + 0.0, + Some(MenuItemMetaData { ids: value.clone() }), + ) + }) + .collect::>(); + gui::apply_sort(&mut items, &config.sort_order()); + items + } + Err(error) => { + let item = MenuItem::new( + format!("Error from rbw: {error}"), + None, + None, + vec![], + None, + 0.0, + None, + ); + vec![item] + } + }; + + Self { items } + } + + fn sub_provider(ids: Vec) -> Result { + let items = ids + .iter() + .map(|id| { + Ok(MenuItem::new( + rbw_get_user(id, false)?, + None, + None, + vec![], + None, + 0.0, + Some(MenuItemMetaData { + ids: vec![id.clone()], + }), + )) + }) + .collect::, String>>()?; + + Ok(Self { items }) + } +} + +impl ItemProvider for PasswordProvider { + fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { + (false, self.items.clone()) + } + + fn get_sub_elements( + &mut self, + _: &MenuItem, + ) -> (bool, Option>>) { + (false, None) + } +} + +fn groups() -> String { + let output = Command::new("groups") + .output() + .expect("Failed to get groups"); + String::from_utf8_lossy(&output.stdout) + .trim_end() + .to_string() +} + +fn keyboard_type(text: &str) { + Command::new("ydotool") + .arg("type") + .arg(text) + .output() + .expect("Failed to execute ydotool"); +} + +fn keyboard_tab() { + Command::new("ydotool") + .arg("TAB") + .output() + .expect("Failed to execute ydotool"); +} + +fn rbw(cmd: &str, args: Option>) -> Result { + let mut command = Command::new("rbw"); + command.arg(cmd); + + if let Some(args) = args { + for arg in args { + command.arg(arg); + } + } + + let output = command + .output() + .map_err(|e| format!("Failed to execute command: {}", e))?; + + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + return Err(format!("rbw command failed: {}", stderr.trim())); + } + + let stdout = + String::from_utf8(output.stdout).map_err(|e| format!("Invalid UTF-8 output: {}", e))?; + + Ok(stdout.trim().to_string()) +} + +fn rbw_get(id: &str, field: &str, copy: bool) -> Result { + let mut args = vec![id, "--field", field]; + if copy { + args.push("--clipboard"); + } + rbw("get", Some(args)) +} + +fn rbw_get_user(id: &str, copy: bool) -> Result { + rbw_get(id, "user", copy) +} + +fn rbw_get_password(id: &str, copy: bool) -> Result { + rbw_get(id, "password", copy) +} + +fn rbw_get_totp(id: &str, copy: bool) -> Result { + rbw_get(id, "totp", copy) +} + +fn key_type_all() -> KeyBinding { + KeyBinding { + key: Key::Num1, + modifiers: Modifier::Alt, + label: "Alt+1 Type All".to_string(), + } +} + +fn key_type_user() -> KeyBinding { + KeyBinding { + key: Key::Num2, + modifiers: Modifier::Alt, + label: "Alt+2 Type User".to_string(), + } +} + +fn key_type_password() -> KeyBinding { + KeyBinding { + key: Key::Num3, + modifiers: Modifier::Alt, + label: "Alt+3 Type Password".to_string(), + } +} + +fn key_type_totp() -> KeyBinding { + KeyBinding { + key: Key::Num4, + modifiers: Modifier::Alt, + label: "Alt+4 Type Totp".to_string(), + } +} + +fn key_sync() -> KeyBinding { + KeyBinding { + key: Key::R, + modifiers: Modifier::Alt, + label: "Alt+r Sync".to_string(), + } +} + +/// copies totp to clipboard +fn key_totp() -> KeyBinding { + KeyBinding { + key: Key::T, + modifiers: Modifier::Alt, + label: "Alt+t Totp".to_string(), + } +} + +fn key_lock() -> KeyBinding { + KeyBinding { + key: Key::L, + modifiers: Modifier::Alt, + label: "Alt+l Lock".to_string(), + } +} + +fn show(config: Config, provider: PasswordProvider) -> Result<(), String> { + match gui::show( + config.clone(), + provider, + false, + None, + Some(vec![ + key_type_all(), + key_type_user(), + key_type_password(), + key_type_totp(), + key_sync(), + key_totp(), + key_lock(), + ]), + ) { + Ok(selection) => { + if let Some(meta) = selection.menu.data { + if meta.ids.len() > 1 { + return show(config, PasswordProvider::sub_provider(meta.ids)?); + } + + let id = meta.ids.first().unwrap_or(&selection.menu.label); + + sleep(Duration::from_millis(250)); + if let Some(key) = selection.custom_key { + if key == key_type_all() { + keyboard_type(&rbw_get_user(id, false)?); + keyboard_tab(); + keyboard_type(&rbw_get_password(id, false)?); + } else if key == key_type_user() { + keyboard_type(&rbw_get_user(id, false)?); + } else if key == key_type_password() { + keyboard_type(&rbw_get_password(id, false)?); + } else if key == key_type_totp() { + keyboard_type(&rbw_get_totp(id, false)?); + } else if key == key_lock() { + rbw("lock", None)?; + } else if key == key_sync() { + rbw("sync", None)?; + } else if key == key_totp() { + rbw_get_totp(id, true)?; + } + } else { + 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(()) + } else { + Err("missing meta data".to_owned()) + } + } + Err(e) => Err(e.to_string()), + } +} + +fn main() -> Result<(), String> { + env_logger::Builder::new() + .parse_filters(&env::var("RUST_LOG").unwrap_or_else(|_| "error".to_owned())) + .format_timestamp_micros() + .init(); + + let args = config::parse_args(); + let config = config::load_config(Some(&args)).unwrap_or(args); + + if !groups().contains("input") { + log::error!( + "User must be in input group. 'sudo usermod -aG input $USER', then login again" + ); + std::process::exit(1) + } + + // will exit if there is a daemon running already, so it's fine to call this everytime. + spawn_fork("ydotoold", None).expect("failed to spawn ydotoold"); + + // todo eventually use a propper rust client for this, for now rbw is good enough + let provider = PasswordProvider::new(&config); + + show(config, provider) +} diff --git a/src/lib/mode.rs b/src/lib/mode.rs deleted file mode 100644 index 41b8dc4..0000000 --- a/src/lib/mode.rs +++ /dev/null @@ -1,988 +0,0 @@ -use crate::config::{Config, SortOrder, expand_path}; -use crate::desktop::{ - copy_to_clipboard, create_file_if_not_exists, find_desktop_files, get_locale_variants, - is_executable, load_cache_file, lookup_name_with_locale, save_cache_file, spawn_fork, -}; -use crate::gui::{ItemProvider, MenuItem}; -use crate::{Error, gui}; -use freedesktop_file_parser::EntryType; -use rayon::prelude::*; -use regex::Regex; -use serde::{Deserialize, Serialize}; -use std::collections::{HashMap, HashSet}; -use std::ffi::CString; -use std::io::Read; -use std::os::unix::fs::FileTypeExt; -use std::path::{Path, PathBuf}; -use std::time::Instant; -use std::{env, fs, io}; - -#[derive(Debug, Deserialize, Serialize, Clone)] -struct DRunCache { - desktop_entry: String, - run_count: usize, -} - -#[derive(Clone)] -struct DRunProvider { - items: Option>>, - cache_path: Option, - cache: HashMap, - data: T, - no_actions: bool, - sort_order: SortOrder, -} - -impl DRunProvider { - fn new(menu_item_data: T, no_actions: bool, sort_order: SortOrder) -> Self { - let (cache_path, d_run_cache) = load_d_run_cache(); - DRunProvider { - items: None, - cache_path, - cache: d_run_cache, - data: menu_item_data, - no_actions, - sort_order, - } - } - - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_precision_loss)] - fn load(&self) -> Vec> { - let locale_variants = get_locale_variants(); - let default_icon = "application-x-executable".to_string(); - let start = Instant::now(); - - let entries: Vec> = find_desktop_files() - .into_par_iter() - .filter(|file| { - !file.entry.no_display.unwrap_or(false) - && !file.entry.hidden.unwrap_or(false) - }) - .filter_map(|file| { - let name = lookup_name_with_locale( - &locale_variants, - &file.entry.name.variants, - &file.entry.name.default, - )?; - - let (action, working_dir) = match &file.entry.entry_type { - EntryType::Application(app) => (app.exec.clone(), app.path.clone()), - _ => return None, - }; - - let cmd_exists = action - .as_ref() - .and_then(|a| { - a.split(' ') - .next() - .map(|cmd| cmd.replace('"', "")) - .map(|cmd| PathBuf::from(&cmd).exists() || which::which(&cmd).is_ok()) - }) - .unwrap_or(false); - - if !cmd_exists { - log::warn!("Skipping desktop entry for {name:?} because action {action:?} does not exist"); - return None; - } - - let icon = file - .entry - .icon - .as_ref() - .map(|s| s.content.clone()) - .or(Some(default_icon.clone())); - - let sort_score = *self.cache.get(&name).unwrap_or(&0) as f64; - - let mut entry = MenuItem::new( - name.clone(), - icon.clone(), - action.clone(), - Vec::new(), - working_dir.clone(), - sort_score, - Some(self.data.clone()), - ); - if !self.no_actions { - for action in file.actions.values() { - if let Some(action_name) = lookup_name_with_locale( - &locale_variants, - &action.name.variants, - &action.name.default, - ) { - let action_icon = action - .icon - .as_ref() - .map(|s| s.content.clone()) - .or(icon.clone()) - .unwrap_or("application-x-executable".to_string()); - - - entry.sub_elements.push(MenuItem::new( - action_name, - Some(action_icon), - action.exec.clone(), - Vec::new(), - working_dir.clone(), - 0.0, - Some(self.data.clone()), - )); - } - } - } - Some(entry) - }) - .collect(); - - let mut seen_actions = HashSet::new(); - let mut entries: Vec> = entries - .into_iter() - .filter(|entry| seen_actions.insert(entry.action.clone())) - .collect(); - - log::info!( - "parsing desktop files took {}ms", - start.elapsed().as_millis() - ); - - gui::apply_sort(&mut entries, &self.sort_order); - entries - } -} - -impl ItemProvider for RunProvider { - fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { - if self.items.is_none() { - self.items = Some(self.load().clone()); - } - (false, self.items.clone().unwrap()) - } - - fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { - (false, None) - } -} - -#[derive(Clone)] -struct RunProvider { - items: Option>>, - cache_path: Option, - cache: HashMap, - sort_order: SortOrder, -} - -impl RunProvider { - fn new(sort_order: SortOrder) -> Self { - let (cache_path, d_run_cache) = load_run_cache(); - RunProvider { - items: None, - cache_path, - cache: d_run_cache, - sort_order, - } - } - - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_precision_loss)] - fn load(&self) -> Vec> { - let path_var = env::var("PATH").unwrap_or_default(); - let paths = env::split_paths(&path_var); - - let entries: Vec<_> = paths - .filter(|dir| dir.is_dir()) - .flat_map(|dir| { - fs::read_dir(dir) - .into_iter() - .flatten() - .filter_map(Result::ok) - .filter_map(|entry| { - let path = entry.path(); - if !is_executable(&path) { - return None; - } - - let label = path.file_name()?.to_str()?.to_string(); - let sort_score = *self.cache.get(&label).unwrap_or(&0) as f64; - - Some(MenuItem::new( - label, - None, - path.to_str().map(ToString::to_string), - vec![], - None, - sort_score, - None, - )) - }) - }) - .collect(); - - let mut seen_actions = HashSet::new(); - let mut entries: Vec> = entries - .into_iter() - .filter(|entry| { - entry - .action - .as_ref() - .and_then(|action| action.split('/').next_back()) - .is_some_and(|cmd| seen_actions.insert(cmd.to_string())) - }) - .collect(); - - gui::apply_sort(&mut entries, &self.sort_order); - entries - } -} - -impl ItemProvider for DRunProvider { - fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { - if self.items.is_none() { - self.items = Some(self.load().clone()); - } - (false, self.items.clone().unwrap()) - } - - fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { - (false, None) - } -} - -#[derive(Clone)] -struct FileItemProvider { - last_result: Option>>, - menu_item_data: T, - sort_order: SortOrder, -} - -impl FileItemProvider { - fn new(menu_item_data: T, sort_order: SortOrder) -> Self { - FileItemProvider { - last_result: None, - menu_item_data, - sort_order, - } - } - - fn resolve_icon_for_name(path: &Path) -> String { - let type_result = fs::symlink_metadata(path) - .map(|meta| meta.file_type()) - .map(|file_type| { - if file_type.is_symlink() { - Some("edit-redo") - } else if file_type.is_char_device() { - Some("input-keyboard") - } else if file_type.is_block_device() { - Some("drive-harddisk") - } else if file_type.is_socket() { - Some("network-transmit-receive") - } else if file_type.is_fifo() { - Some("rotation-allowed") - } else { - None - } - }) - .unwrap_or(Some("system-lock-screen")); - - if let Some(tr) = type_result { - return tr.to_owned(); - } - - let Some(mime) = tree_magic_mini::from_filepath(path) else { - return "image-not-found".to_string(); - }; - - if mime.starts_with("image") { - return "image-x-generic".to_string(); - } - - if mime.starts_with("inode") { - return mime.replace('/', "-"); - } - - if mime.starts_with("text") { - return if mime.contains("plain") { - "text-x-generic".to_string() - } else if mime.contains("python") { - "text-x-script".to_string() - } else if mime.contains("html") { - "text-html".to_string() - } else { - "text-x-generic".to_string() - }; - } - - if mime.starts_with("application") { - return if mime.contains("octet") { - "application-x-executable".to_string() - } else if mime.contains("tar") - || mime.contains("lz") - || mime.contains("zip") - || mime.contains("7z") - || mime.contains("xz") - { - "package-x-generic".to_string() - } else { - "text-html".to_string() - }; - } - - log::debug!("unsupported mime type {mime}"); - "application-x-generic".to_string() - } -} - -impl ItemProvider for FileItemProvider { - fn get_elements(&mut self, search: Option<&str>) -> (bool, Vec>) { - let default_path = if let Some(home) = dirs::home_dir() { - home.display().to_string() - } else { - "/".to_string() - }; - - let mut trimmed_search = search.unwrap_or(&default_path).to_owned(); - if !trimmed_search.starts_with('/') - && !trimmed_search.starts_with('~') - && !trimmed_search.starts_with('$') - { - trimmed_search = format!("{default_path}/{trimmed_search}"); - } - - let path = expand_path(&trimmed_search); - let mut items: Vec> = Vec::new(); - - if !path.exists() { - if let Some(last) = &self.last_result { - return (false, last.clone()); - } - - return (true, vec![]); - } - - if path.is_dir() { - items.push(MenuItem::new( - trimmed_search.clone(), - Some(FileItemProvider::::resolve_icon_for_name(&path)), - Some(format!("xdg-open {}", path.display())), - vec![], - None, - 100.0, - Some(self.menu_item_data.clone()), - )); - - if let Ok(entries) = path.read_dir() { - for entry in entries.flatten() { - if let Some(mut path_str) = - entry.path().to_str().map(std::string::ToString::to_string) - { - if trimmed_search.starts_with('~') { - if let Some(home_dir) = dirs::home_dir() { - if let Some(home_str) = home_dir.to_str() { - path_str = path_str.replace(home_str, "~"); - } - } - } - - if entry.path().is_dir() { - path_str.push('/'); - } - - items.push(MenuItem::new( - path_str.clone(), - Some(FileItemProvider::::resolve_icon_for_name(&entry.path())), - Some(format!("xdg-open {path_str}")), - vec![], - None, - 0.0, - Some(self.menu_item_data.clone()), - )); - } - } - } - } else { - items.push({ - MenuItem::new( - trimmed_search.clone(), - Some(FileItemProvider::::resolve_icon_for_name( - &PathBuf::from(&trimmed_search), - )), - Some(format!("xdg-open {trimmed_search}")), - vec![], - None, - 0.0, - Some(self.menu_item_data.clone()), - ) - }); - } - - gui::apply_sort(&mut items, &self.sort_order); - - self.last_result = Some(items.clone()); - (true, items) - } - - fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { - (false, self.last_result.clone()) - } -} - -#[derive(Clone)] -struct SshProvider { - elements: Vec>, -} - -impl SshProvider { - fn new(menu_item_data: T, order: &SortOrder) -> Self { - let re = Regex::new(r"(?m)^\s*Host\s+(.+)$").unwrap(); - let mut items: Vec<_> = dirs::home_dir() - .map(|home| home.join(".ssh").join("config")) - .filter(|path| path.exists()) - .map(|path| fs::read_to_string(&path).unwrap_or_default()) - .into_iter() - .flat_map(|content| { - re.captures_iter(&content) - .flat_map(|cap| { - cap[1] - .split_whitespace() - .map(|host| { - log::debug!("found ssh host {host}"); - MenuItem::new( - host.to_owned(), - Some("computer".to_owned()), - Some(format!("ssh {host}")), - vec![], - None, - 0.0, - Some(menu_item_data.clone()), - ) - }) - .collect::>() - }) - .collect::>() - }) - .collect(); - - gui::apply_sort(&mut items, order); - Self { elements: items } - } -} - -impl ItemProvider for SshProvider { - fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { - (false, self.elements.clone()) - } - - fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { - (false, None) - } -} - -#[derive(Clone)] -struct MathProvider { - menu_item_data: T, - elements: Vec>, -} - -impl MathProvider { - fn new(menu_item_data: T) -> Self { - Self { - menu_item_data, - elements: vec![], - } - } - - fn contains_math_functions_or_starts_with_number(input: &str) -> bool { - // Regex for function names (word boundaries to match whole words) - let math_functions = r"\b(sqrt|abs|exp|ln|sin|cos|tan|asin|acos|atan|atan2|sinh|cosh|tanh|asinh|acosh|atanh|floor|ceil|round|signum|min|max|pi|e)\b"; - - // Regex for strings that start with a number (including decimals) - let starts_with_number = r"^\s*[+-]?(\d+(\.\d*)?|\.\d+)"; - - let math_regex = Regex::new(math_functions).unwrap(); - let number_regex = Regex::new(starts_with_number).unwrap(); - - math_regex.is_match(input) || number_regex.is_match(input) - } - - fn add_elements(&mut self, elements: &mut Vec>) { - self.elements.append(elements); - } -} - -impl ItemProvider for MathProvider { - fn get_elements(&mut self, search: Option<&str>) -> (bool, Vec>) { - if let Some(search_text) = search { - let result = match meval::eval_str(search_text) { - Ok(result) => result.to_string(), - Err(e) => format!("failed to calculate {e:?}"), - }; - - let item = MenuItem::new( - result, - None, - search.map(String::from), - vec![], - None, - 0.0, - Some(self.menu_item_data.clone()), - ); - let mut result = vec![item]; - result.append(&mut self.elements.clone()); - (true, result) - } else { - (false, self.elements.clone()) - } - } - - fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { - (false, None) - } -} - -#[derive(Clone)] -struct EmojiProvider { - elements: Vec>, - #[allow(dead_code)] // needed for the detection of mode in 'auto' - menu_item_data: T, -} - -impl EmojiProvider { - fn new(data: T, sort_order: &SortOrder) -> Self { - let emoji = emoji::search::search_annotation_all(""); - let mut menus = emoji - .into_iter() - .map(|e| { - MenuItem::new( - format!("{} — Category: {} — Name: {}", e.glyph, e.group, e.name), - None, - Some(format!("emoji {}", e.glyph)), - vec![], - None, - 0.0, - Some(data.clone()), - ) - }) - .collect::>(); - gui::apply_sort(&mut menus, sort_order); - - Self { - elements: menus, - menu_item_data: data.clone(), - } - } -} - -impl ItemProvider for EmojiProvider { - fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { - (false, self.elements.clone()) - } - - fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { - (false, None) - } -} - -#[derive(Clone)] -struct DMenuProvider { - items: Vec>, -} - -impl DMenuProvider { - fn new(sort_order: &SortOrder) -> Result { - let mut input = String::new(); - io::stdin() - .read_to_string(&mut input) - .map_err(|_| Error::StdInReadFail)?; - - let mut items: Vec> = input - .lines() - .map(String::from) - .map(|s| MenuItem::new(s.clone(), None, None, vec![], None, 0.0, None)) - .collect(); - - gui::apply_sort(&mut items, sort_order); - - Ok(Self { items }) - } -} - -impl ItemProvider for DMenuProvider { - fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { - (false, self.items.clone()) - } - - fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { - (false, None) - } -} - -#[derive(Debug, Clone, PartialEq)] -enum AutoRunType { - Math, - DRun, - File, - Ssh, - Emoji, - // WebSearch, -} - -#[derive(Clone)] -struct AutoItemProvider { - drun: DRunProvider, - file: FileItemProvider, - math: MathProvider, - ssh: SshProvider, - emoji: EmojiProvider, - last_mode: Option, -} - -impl AutoItemProvider { - fn new(config: &Config) -> Self { - AutoItemProvider { - drun: DRunProvider::new(AutoRunType::DRun, config.no_actions(), config.sort_order()), - file: FileItemProvider::new(AutoRunType::File, config.sort_order()), - math: MathProvider::new(AutoRunType::Math), - ssh: SshProvider::new(AutoRunType::Ssh, &config.sort_order()), - emoji: EmojiProvider::new(AutoRunType::Emoji, &config.sort_order()), - last_mode: None, - } - } - - fn default_auto_elements( - &mut self, - search_opt: Option<&str>, - ) -> (bool, Vec>) { - // return ssh and drun items - let (changed, mut items) = self.drun.get_elements(search_opt); - items.append(&mut self.ssh.get_elements(search_opt).1); - if self.last_mode == Some(AutoRunType::DRun) { - (changed, items) - } else { - self.last_mode = Some(AutoRunType::DRun); - (true, items) - } - } -} - -impl ItemProvider for AutoItemProvider { - fn get_elements(&mut self, search_opt: Option<&str>) -> (bool, Vec>) { - let search = match search_opt { - Some(s) if !s.trim().is_empty() => s.trim(), - _ => return self.default_auto_elements(search_opt), - }; - - let (mode, (changed, items)) = - if MathProvider::::contains_math_functions_or_starts_with_number(search) { - (AutoRunType::Math, self.math.get_elements(search_opt)) - } 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::Ssh, self.ssh.get_elements(search_opt)) - } else if search.starts_with("emoji") { - (AutoRunType::Emoji, self.emoji.get_elements(search_opt)) - } else { - return self.default_auto_elements(search_opt); - }; - - if self.last_mode.as_ref().is_some_and(|m| m == &mode) { - (changed, items) - } else { - self.last_mode = Some(mode); - (true, items) - } - } - - fn get_sub_elements( - &mut self, - item: &MenuItem, - ) -> (bool, Option>>) { - let (changed, items) = self.get_elements(Some(item.label.as_ref())); - (changed, Some(items)) - } -} - -/// Shows the drun mode -/// # Errors -/// -/// Will return `Err` if it was not able to spawn the process -pub fn d_run(config: &Config) -> Result<(), Error> { - let provider = DRunProvider::new(0, config.no_actions(), config.sort_order()); - let cache_path = provider.cache_path.clone(); - let mut cache = provider.cache.clone(); - - // todo ues a arc instead of cloning the config - let selection_result = gui::show(config.clone(), provider, false, None); - match selection_result { - Ok(s) => update_drun_cache_and_run(cache_path, &mut cache, s)?, - Err(_) => { - log::error!("No item selected"); - } - } - - Ok(()) -} - -/// Shows the run mode -/// # Errors -/// -/// Will return `Err` if it was not able to spawn the process -pub fn run(config: &Config) -> Result<(), Error> { - let provider = RunProvider::new(config.sort_order()); - let cache_path = provider.cache_path.clone(); - let mut cache = provider.cache.clone(); - - let selection_result = gui::show(config.clone(), provider, false, None); - match selection_result { - Ok(s) => update_run_cache_and_run(cache_path, &mut cache, s)?, - Err(_) => { - log::error!("No item selected"); - } - } - - Ok(()) -} - -/// Shows the auto mode -/// # Errors -/// -/// Will return `Err` -/// * if it was not able to spawn the process -/// -/// # Panics -/// Panics if an internal static regex cannot be passed anymore, should never happen -pub fn auto(config: &Config) -> Result<(), Error> { - let mut provider = AutoItemProvider::new(config); - let cache_path = provider.drun.cache_path.clone(); - let mut cache = provider.drun.cache.clone(); - - loop { - // todo ues a arc instead of cloning the config - let selection_result = gui::show( - config.clone(), - provider.clone(), - true, - Some( - vec!["ssh", "emoji", "^\\$\\w+"] - .into_iter() - .map(|s| Regex::new(s).unwrap()) - .collect(), - ), - ); - - if let Ok(mut selection_result) = selection_result { - if let Some(data) = &selection_result.data { - match data { - AutoRunType::Math => { - provider.math.elements.push(selection_result); - } - AutoRunType::DRun => { - update_drun_cache_and_run(cache_path, &mut cache, selection_result)?; - break; - } - AutoRunType::File => { - if let Some(action) = selection_result.action { - spawn_fork(&action, selection_result.working_dir.as_ref())?; - } - break; - } - AutoRunType::Ssh => { - ssh_launch(&selection_result, config)?; - break; - } - AutoRunType::Emoji => { - if let Some(action) = selection_result.action { - copy_to_clipboard(action)?; - } else { - return Err(Error::MissingAction); - } - break; - } - } - } else if selection_result.label.starts_with("ssh") { - selection_result.label = selection_result.label.chars().skip(4).collect(); - ssh_launch(&selection_result, config)?; - } - } else { - log::error!("No item selected"); - break; - } - } - - Ok(()) -} - -/// Shows the file browser mode -/// # Errors -/// -/// Will return `Err` -/// * if it was not able to spawn the process -/// -/// # Panics -/// In case an internal regex does not parse anymore, this should never happen -pub fn file(config: &Config) -> Result<(), Error> { - let provider = FileItemProvider::new(0, config.sort_order()); - - // todo ues a arc instead of cloning the config - let selection_result = gui::show( - config.clone(), - provider, - false, - Some(vec![Regex::new("^\\$\\w+").unwrap()]), - )?; - if let Some(action) = selection_result.action { - spawn_fork(&action, selection_result.working_dir.as_ref()) - } else { - Err(Error::MissingAction) - } -} - -fn ssh_launch(menu_item: &MenuItem, config: &Config) -> Result<(), Error> { - let ssh_cmd = if let Some(action) = &menu_item.action { - action.clone() - } else { - let cmd = config - .term() - .map(|s| format!("{s} ssh {}", menu_item.label)); - if let Some(cmd) = cmd { - cmd - } else { - return Err(Error::MissingAction); - } - }; - - let cmd = format!( - "{} bash -c \"source ~/.bashrc; {ssh_cmd}\"", - config.term().unwrap_or_default() - ); - spawn_fork(&cmd, menu_item.working_dir.as_ref()) -} - -/// Shows the ssh mode -/// # Errors -/// -/// Will return `Err` -/// * if it was not able to spawn the process -/// * if it didn't find a terminal -pub fn ssh(config: &Config) -> Result<(), Error> { - let provider = SshProvider::new(0, &config.sort_order()); - let selection_result = gui::show(config.clone(), provider, true, None); - if let Ok(mi) = selection_result { - ssh_launch(&mi, config)?; - } else { - log::error!("No item selected"); - } - Ok(()) -} - -/// Shows the math mode -pub fn math(config: &Config) { - let mut calc: Vec> = vec![]; - loop { - let mut provider = MathProvider::new(String::new()); - provider.add_elements(&mut calc.clone()); - let selection_result = gui::show(config.clone(), provider, true, None); - if let Ok(mi) = selection_result { - calc.push(mi); - } else { - log::error!("No item selected"); - break; - } - } -} - -/// Shows the emoji mode -/// # Errors -/// -/// Forwards errors from the gui. See `gui::show` for details. -pub fn emoji(config: &Config) -> Result<(), Error> { - let provider = EmojiProvider::new(0, &config.sort_order()); - let selection_result = gui::show(config.clone(), provider, true, None)?; - match selection_result.action { - None => Err(Error::MissingAction), - Some(action) => copy_to_clipboard(action), - } -} - -/// Shows the dmenu mode -/// # Errors -/// -/// Forwards errors from the gui. See `gui::show` for details. -pub fn dmenu(config: &Config) -> Result<(), Error> { - let provider = DMenuProvider::new(&config.sort_order())?; - - let selection_result = gui::show(config.clone(), provider, true, None); - match selection_result { - Ok(s) => { - println!("{}", s.label); - Ok(()) - } - Err(_) => Err(Error::InvalidSelection), - } -} - -fn update_drun_cache_and_run( - cache_path: Option, - cache: &mut HashMap, - selection_result: MenuItem, -) -> Result<(), Error> { - if let Some(cache_path) = cache_path { - *cache.entry(selection_result.label).or_insert(0) += 1; - if let Err(e) = save_cache_file(&cache_path, cache) { - log::warn!("cannot save drun cache {e:?}"); - } - } - - if let Some(action) = selection_result.action { - spawn_fork(&action, selection_result.working_dir.as_ref()) - } else { - Err(Error::MissingAction) - } -} - -fn update_run_cache_and_run( - cache_path: Option, - cache: &mut HashMap, - selection_result: MenuItem, -) -> Result<(), Error> { - if let Some(cache_path) = cache_path { - *cache.entry(selection_result.label).or_insert(0) += 1; - if let Err(e) = save_cache_file(&cache_path, cache) { - log::warn!("cannot save run cache {e:?}"); - } - } - - if let Some(action) = selection_result.action { - let program = CString::new(action).unwrap(); - let args = [program.clone()]; - - // This replaces the current process image - nix::unistd::execvp(&program, &args).map_err(|e| Error::RunFailed(e.to_string()))?; - Ok(()) - } else { - Err(Error::MissingAction) - } -} - -fn load_d_run_cache() -> (Option, HashMap) { - let cache_path = dirs::cache_dir().map(|x| x.join("worf-drun")); - load_cache(cache_path) -} - -fn load_run_cache() -> (Option, HashMap) { - let cache_path = dirs::cache_dir().map(|x| x.join("worf-run")); - load_cache(cache_path) -} - -fn load_cache(cache_path: Option) -> (Option, HashMap) { - let cache = { - if let Some(ref cache_path) = cache_path { - if let Err(e) = create_file_if_not_exists(cache_path) { - log::warn!("No drun cache file and cannot create: {e:?}"); - } - } - - load_cache_file(cache_path.as_ref()).unwrap_or_default() - }; - (cache_path, cache) -} diff --git a/styles/compact/style.css b/styles/compact/style.css index a87c642..81837dd 100644 --- a/styles/compact/style.css +++ b/styles/compact/style.css @@ -1,5 +1,6 @@ * { font-family: DejaVu; + transition: opacity 500ms ease; } #window { @@ -28,12 +29,13 @@ font-family: DejaVu; background-color: rgba(32, 32, 32, 0.6); color: #f2f2f2; 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; } #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 { /* The name of all entries */ @@ -48,7 +50,6 @@ font-family: DejaVu; /* The name of all the text in entries */ } #window #outer-box #scroll #inner-box #entry #img { - width: 1rem; margin-right: 0.5rem; } #window #outer-box #scroll #inner-box #entry:selected { @@ -58,7 +59,7 @@ font-family: DejaVu; } #row:hover { - background-color: rgba(255, 255, 255, 0);; + background-color: rgba(255, 255, 255, 0); outline: inherit; outline-color: inherit; } @@ -67,3 +68,14 @@ font-family: DejaVu; outline: 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 { + } diff --git a/worf/Cargo.lock b/worf/Cargo.lock new file mode 100644 index 0000000..25f5eb1 --- /dev/null +++ b/worf/Cargo.lock @@ -0,0 +1,1953 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +dependencies = [ + "anstyle", + "once_cell", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" + +[[package]] +name = "cairo-rs" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae50b5510d86cf96ac2370e66d8dc960882f3df179d6a5a1e52bd94a1416c0f7" +dependencies = [ + "bitflags 2.9.0", + "cairo-sys-rs", + "glib", + "libc", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18b6bb8e43c7eb0f2aac7976afe0c61b6f5fc2ab7bc4c139537ea56c92290df" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "cc" +version = "1.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-expr" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d4ba6e40bd1184518716a6e1a781bf9160e286d219ccdb8ab2612e74cfe4789" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "clap" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +dependencies = [ + "atty", + "bitflags 1.3.2", + "clap_lex 0.2.4", + "indexmap 1.9.3", + "strsim 0.10.0", + "termcolor", + "textwrap", + "yaml-rust", +] + +[[package]] +name = "clap" +version = "4.5.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9" +dependencies = [ + "anstream", + "anstyle", + "clap_lex 0.7.4", + "strsim 0.11.1", +] + +[[package]] +name = "clap_derive" +version = "4.5.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "clap_lex" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" + +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + +[[package]] +name = "crossbeam" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "emoji" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e9309870371f7fa7767752e5048fc0c0675b017a27d9c601dffe9a1efe0301" +dependencies = [ + "fuzzy-matcher", + "itertools", + "lazy_static", + "phf", +] + +[[package]] +name = "env_filter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_home" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "freedesktop-file-parser" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6059d3997cc694ec3e9a378db855866233ef7edfeafd85afcb2239fd130e6e6b" +dependencies = [ + "thiserror", + "xdgkit", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fuzzy-matcher" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94" +dependencies = [ + "thread_local", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7563afd6ff0a221edfbb70a78add5075b8d9cb48e637a40a24c3ece3fea414d0" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67f2587c9202bf997476bbba6aaed4f78a11538a2567df002a5f57f5331d0b5c" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gdk4" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4850c9d9c1aecd1a3eb14fadc1cdb0ac0a2298037e116264c7473e1740a32d60" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk4-sys", + "gio", + "gl", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk4-sys" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f6eb95798e2b46f279cf59005daf297d5b69555428f185650d71974a910473a" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "gio" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f00c70f8029d84ea7572dd0e1aaa79e5329667b4c17f329d79ffb1e6277487" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "pin-project-lite", + "smallvec", +] + +[[package]] +name = "gio-sys" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "160eb5250a26998c3e1b54e6a3d4ea15c6c7762a6062a19a7b63eff6e2b33f9e" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "windows-sys", +] + +[[package]] +name = "gl" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a94edab108827d67608095e269cf862e60d920f144a5026d3dbcfd8b877fb404" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glib" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707b819af8059ee5395a2de9f2317d87a53dbad8846a2f089f0bb44703f37686" +dependencies = [ + "bitflags 2.9.0", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "smallvec", +] + +[[package]] +name = "glib-macros" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715601f8f02e71baef9c1f94a657a9a77c192aea6097cf9ae7e5e177cd8cde68" +dependencies = [ + "heck", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "glib-sys" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8928869a44cfdd1fccb17d6746e4ff82c8f82e41ce705aa026a52ca8dc3aefb" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "gobject-sys" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c773a3cb38a419ad9c26c81d177d96b4b08980e8bdbbf32dace883e96e96e7e3" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "graphene-rs" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbc5911bfb32d68dcfa92c9510c462696c2f715548fcd7f3f1be424c739de19" +dependencies = [ + "glib", + "graphene-sys", + "libc", +] + +[[package]] +name = "graphene-sys" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11a68d39515bf340e879b72cecd4a25c1332557757ada6e8aba8654b4b81d23a" +dependencies = [ + "glib-sys", + "libc", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gsk4" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f5e72f931c8c9f65fbfc89fe0ddc7746f147f822f127a53a9854666ac1f855" +dependencies = [ + "cairo-rs", + "gdk4", + "glib", + "graphene-rs", + "gsk4-sys", + "libc", + "pango", +] + +[[package]] +name = "gsk4-sys" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "755059de55fa6f85a46bde8caf03e2184c96bfda1f6206163c72fb0ea12436dc" +dependencies = [ + "cairo-sys-rs", + "gdk4-sys", + "glib-sys", + "gobject-sys", + "graphene-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "gtk4" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1c491051f030994fd0cde6f3c44f3f5640210308cff1298c7673c47408091d" +dependencies = [ + "cairo-rs", + "field-offset", + "futures-channel", + "gdk-pixbuf", + "gdk4", + "gio", + "glib", + "graphene-rs", + "gsk4", + "gtk4-macros", + "gtk4-sys", + "libc", + "pango", +] + +[[package]] +name = "gtk4-layer-shell" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aec4fd3226bb6aa8dda5370142e14a4d15f00bba99bfb355b6ef7bb49d100758" +dependencies = [ + "bitflags 2.9.0", + "gdk4", + "glib", + "glib-sys", + "gtk4", + "gtk4-layer-shell-sys", + "libc", +] + +[[package]] +name = "gtk4-layer-shell-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3057dc117db2d664a9b45f1956568701914e80cf9f2c8cef0a755af4c1c8105" +dependencies = [ + "gdk4-sys", + "glib-sys", + "gtk4-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gtk4-macros" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed1786c4703dd196baf7e103525ce0cf579b3a63a0570fe653b7ee6bac33999" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "gtk4-sys" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41e03b01e54d77c310e1d98647d73f996d04b2f29b9121fe493ea525a7ec03d6" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk4-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "graphene-sys", + "gsk4-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown 0.15.2", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jiff" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c102670231191d07d37a35af3eb77f1f0dbf7a71be51a962dcd57ea607be7260" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", +] + +[[package]] +name = "jiff-static" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cdde31a9d349f1b1f51a0b3714a5940ac022976f4b49485fc04be052b183b4c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.171" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.9.0", + "libc", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "meval" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f79496a5651c8d57cd033c5add8ca7ee4e3d5f7587a4777484640d9cb60392d9" +dependencies = [ + "fnv", + "nom 1.2.4", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nix" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537bc3c4a347b87fd52ac6c03a02ab1302962cfd93373c5d7a112cdc337854cc" +dependencies = [ + "bitflags 2.9.0", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "os_pipe" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + +[[package]] +name = "pango" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1f5dc1b8cf9bc08bfc0843a04ee0fa2e78f1e1fa4b126844a383af4f25f0ec" +dependencies = [ + "gio", + "glib", + "libc", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dbb9b751673bd8fe49eb78620547973a1e719ed431372122b20abd12445bab5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.9.0", +] + +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_macros", + "phf_shared", + "proc-macro-hack", +] + +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "portable-atomic" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-crate" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-xml" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0452695941410a58c8ce4391707ba9bad26a247173bd9886a05a5e8a8babec75" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "quick-xml" +version = "0.37.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", + "rand_pcg", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_users" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.9.0", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys", +] + +[[package]] +name = "rustix" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +dependencies = [ + "bitflags 2.9.0", + "errno", + "libc", + "linux-raw-sys 0.9.4", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-deps" +version = "7.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tempfile" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" +dependencies = [ + "fastrand", + "getrandom 0.3.2", + "once_cell", + "rustix 1.0.5", + "windows-sys", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tini" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e004df4c5f0805eb5f55883204a514cfa43a6d924741be29e871753a53d5565a" + +[[package]] +name = "toml" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +dependencies = [ + "indexmap 2.9.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tree_magic_mini" +version = "3.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac5e8971f245c3389a5a76e648bfc80803ae066a1243a75db0064d7c1129d63" +dependencies = [ + "fnv", + "memchr", + "nom 7.1.3", + "once_cell", + "petgraph", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wayland-backend" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe770181423e5fc79d3e2a7f4410b7799d5aab1de4372853de3c6aa13ca24121" +dependencies = [ + "cc", + "downcast-rs", + "rustix 0.38.44", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978fa7c67b0847dbd6a9f350ca2569174974cd4082737054dbb7fbb79d7d9a61" +dependencies = [ + "bitflags 2.9.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "779075454e1e9a521794fed15886323ea0feda3f8b0fc1390f5398141310422a" +dependencies = [ + "bitflags 2.9.0", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cb6cdc73399c0e06504c437fe3cf886f25568dd5454473d565085b36d6a8bbf" +dependencies = [ + "bitflags 2.9.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484" +dependencies = [ + "proc-macro2", + "quick-xml 0.37.5", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "which" +version = "7.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" +dependencies = [ + "either", + "env_home", + "rustix 1.0.5", + "winsafe", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" +dependencies = [ + "memchr", +] + +[[package]] +name = "winsafe" +version = "0.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags 2.9.0", +] + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5ff8d0e60065f549fafd9d6cb626203ea64a798186c80d8e7df4f8af56baeb" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 0.38.44", + "tempfile", + "thiserror", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "worf" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap 4.5.35", + "crossbeam", + "dirs", + "emoji", + "env_logger", + "freedesktop-file-parser", + "gdk4", + "gtk4", + "gtk4-layer-shell", + "libc", + "log", + "meval", + "nix", + "rayon", + "regex", + "serde", + "serde_json", + "strsim 0.11.1", + "thiserror", + "toml", + "tree_magic_mini", + "which", + "wl-clipboard-rs", +] + +[[package]] +name = "xdgkit" +version = "3.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aeac9c0125f3c131c6a2898d2a9f25c11b7954c3ff644a018cb9e06fa92919b" +dependencies = [ + "clap 3.2.25", + "quick-xml 0.21.0", + "serde", + "tini", +] + +[[package]] +name = "xml-rs" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5b940ebc25896e71dd073bad2dbaa2abfe97b0a391415e22ad1326d9c54e3c4" + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "zerocopy" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] diff --git a/worf/Cargo.toml b/worf/Cargo.toml new file mode 100644 index 0000000..bd1681a --- /dev/null +++ b/worf/Cargo.toml @@ -0,0 +1,54 @@ +[package] +name = "worf" +version = "0.1.0" +edition = "2024" + +[lints.clippy] +# enable pedantic +pedantic = { level = "warn", priority = -1 } +## exclude some too pedantic lints for now +similar_names = "allow" + +# additional lints +clone_on_ref_ptr = "warn" + +[lib] +name = "worf_lib" +path = "src/lib/mod.rs" + +[[bin]] +name = "worf" +path = "src/main.rs" + +[features] +default = [] + +[package.metadata.docs.rs] +no-deps = true + +[dependencies] +gtk4 = { version = "0.9.5", default-features = true, features = ["v4_6"] } +gtk4-layer-shell = "0.5.0" +gdk4 = "0.9.6" +anyhow = "1.0.97" +env_logger = "0.11.8" +log = "0.4.27" +regex = "1.11.1" +clap = { version = "4.5.35", features = ["derive"] } +thiserror = "2.0.12" +serde = { version = "1.0.219", features = ["derive"] } +toml = "0.8.20" +serde_json = "1.0.140" +crossbeam = "0.8.4" +libc = "0.2.171" +freedesktop-file-parser = "0.1.3" +strsim = "0.11.1" +dirs = "6.0.0" +which = "7.0.3" +meval = "0.2.0" +tree_magic_mini = "3.1.6" +rayon = "1.10.0" +nix = { version = "0.30.0", features = ["process"] } +emoji = "0.2.1" +wl-clipboard-rs = "0.9.2" +notify-rust="4.11.7" diff --git a/src/lib/config.rs b/worf/src/lib/config.rs similarity index 99% rename from src/lib/config.rs rename to worf/src/lib/config.rs index 901b3bb..294a97e 100644 --- a/src/lib/config.rs +++ b/worf/src/lib/config.rs @@ -43,7 +43,7 @@ pub enum WrapMode { Inherit, } -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] pub enum SortOrder { Default, Alphabetical, diff --git a/src/lib/desktop.rs b/worf/src/lib/desktop.rs similarity index 93% rename from src/lib/desktop.rs rename to worf/src/lib/desktop.rs index eebc34e..6746b8f 100644 --- a/src/lib/desktop.rs +++ b/worf/src/lib/desktop.rs @@ -8,6 +8,7 @@ use std::time::Instant; use std::{env, fs, io}; use freedesktop_file_parser::DesktopFile; +use notify_rust::Notification; use rayon::prelude::*; use regex::Regex; 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. /// # Errors /// 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(); opts.clipboard(ClipboardType::Regular); opts.serve_requests(ServeRequests::Only(1)); let result = opts.copy(Source::Bytes(text.into_bytes().into()), MimeType::Text); match result { - Ok(()) => Ok(()), - Err(e) => Err(Error::Clipboard(e.to_string())), + Ok(()) => { + 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())) + } } } diff --git a/src/lib/gui.rs b/worf/src/lib/gui.rs similarity index 71% rename from src/lib/gui.rs rename to worf/src/lib/gui.rs index 40d9a3b..342ab94 100644 --- a/src/lib/gui.rs +++ b/worf/src/lib/gui.rs @@ -2,14 +2,14 @@ use std::collections::HashMap; use std::rc::Rc; use std::sync::{Arc, Mutex}; use std::thread; -use std::time::{Duration, Instant}; +use std::time::Instant; use crossbeam::channel; use crossbeam::channel::Sender; +use gdk4::Display; use gdk4::gio::File; -use gdk4::glib::{Propagation, timeout_add_local}; +use gdk4::glib::{MainContext, Propagation}; use gdk4::prelude::{Cast, DisplayExt, MonitorExt, SurfaceExt}; -use gdk4::{Display, Key}; use gtk4::glib::ControlFlow; use gtk4::prelude::{ ApplicationExt, ApplicationExtManual, BoxExt, EditableExt, FlowBoxChildExt, GestureSingleExt, @@ -31,7 +31,12 @@ use crate::{Error, config, desktop}; type ArcMenuMap = Arc>>>; type ArcProvider = Arc + Send>>; -type MenuItemSender = Sender, Error>>; + +pub struct Selection { + pub menu: MenuItem, + pub custom_key: Option, +} +type SelectionSender = Sender, Error>>; pub trait ItemProvider { fn get_elements(&mut self, search: Option<&str>) -> (bool, Vec>); @@ -104,6 +109,256 @@ pub struct MenuItem { visible: bool, } +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Key { + None, + + // Letters + A, + B, + C, + D, + E, + F, + G, + H, + I, + J, + K, + L, + M, + N, + O, + P, + Q, + R, + S, + T, + U, + V, + W, + X, + Y, + Z, + + // Numbers + Num0, + Num1, + Num2, + Num3, + Num4, + Num5, + Num6, + Num7, + Num8, + Num9, + + // Function Keys + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + + // Navigation / Editing + Escape, + Enter, + Space, + Tab, + Backspace, + Insert, + Delete, + Home, + End, + PageUp, + PageDown, + Left, + Right, + Up, + Down, + + // Special characters + Exclamation, // ! + At, // @ + Hash, // # + Dollar, // $ + Percent, // % + Caret, // ^ + Ampersand, // & + Asterisk, // * + LeftParen, // ( + RightParen, // ) + Minus, // - + Underscore, // _ + Equal, // = + Plus, // + + LeftBracket, // [ + RightBracket, // ] + LeftBrace, // { + RightBrace, // } + Backslash, // \ + Pipe, // | + Semicolon, // ; + Colon, // : + Apostrophe, // ' + Quote, // " + Comma, // , + Period, // . + Slash, // / + Question, // ? + Grave, // ` + Tilde, // ~ +} + +impl From for Key { + fn from(value: gdk4::Key) -> Self { + match value { + // Letters + gdk4::Key::A => Key::A, + gdk4::Key::B => Key::B, + gdk4::Key::C => Key::C, + gdk4::Key::D => Key::D, + gdk4::Key::E => Key::E, + gdk4::Key::F => Key::F, + gdk4::Key::G => Key::G, + gdk4::Key::H => Key::H, + gdk4::Key::I => Key::I, + gdk4::Key::J => Key::J, + gdk4::Key::K => Key::K, + gdk4::Key::L => Key::L, + gdk4::Key::M => Key::M, + gdk4::Key::N => Key::N, + gdk4::Key::O => Key::O, + gdk4::Key::P => Key::P, + gdk4::Key::Q => Key::Q, + gdk4::Key::R => Key::R, + gdk4::Key::S => Key::S, + gdk4::Key::T => Key::T, + gdk4::Key::U => Key::U, + gdk4::Key::V => Key::V, + gdk4::Key::W => Key::W, + gdk4::Key::X => Key::X, + gdk4::Key::Y => Key::Y, + gdk4::Key::Z => Key::Z, + + // Numbers + gdk4::Key::_0 => Key::Num0, + gdk4::Key::_1 => Key::Num1, + gdk4::Key::_2 => Key::Num2, + gdk4::Key::_3 => Key::Num3, + gdk4::Key::_4 => Key::Num4, + gdk4::Key::_5 => Key::Num5, + gdk4::Key::_6 => Key::Num6, + gdk4::Key::_7 => Key::Num7, + gdk4::Key::_8 => Key::Num8, + gdk4::Key::_9 => Key::Num9, + + // Function Keys + gdk4::Key::F1 => Key::F1, + gdk4::Key::F2 => Key::F2, + gdk4::Key::F3 => Key::F3, + gdk4::Key::F4 => Key::F4, + gdk4::Key::F5 => Key::F5, + gdk4::Key::F6 => Key::F6, + gdk4::Key::F7 => Key::F7, + gdk4::Key::F8 => Key::F8, + gdk4::Key::F9 => Key::F9, + gdk4::Key::F10 => Key::F10, + gdk4::Key::F11 => Key::F11, + gdk4::Key::F12 => Key::F12, + + // Navigation / Editing + gdk4::Key::Escape => Key::Escape, + gdk4::Key::Return => Key::Enter, + gdk4::Key::space => Key::Space, + gdk4::Key::Tab => Key::Tab, + gdk4::Key::BackSpace => Key::Backspace, + gdk4::Key::Insert => Key::Insert, + gdk4::Key::Delete => Key::Delete, + gdk4::Key::Home => Key::Home, + gdk4::Key::End => Key::End, + gdk4::Key::Page_Up => Key::PageUp, + gdk4::Key::Page_Down => Key::PageDown, + gdk4::Key::Left => Key::Left, + gdk4::Key::Right => Key::Right, + gdk4::Key::Up => Key::Up, + gdk4::Key::Down => Key::Down, + + // Special characters + gdk4::Key::exclam => Key::Exclamation, + gdk4::Key::at => Key::At, + gdk4::Key::numbersign => Key::Hash, + gdk4::Key::dollar => Key::Dollar, + gdk4::Key::percent => Key::Percent, + gdk4::Key::asciicircum => Key::Caret, + gdk4::Key::ampersand => Key::Ampersand, + gdk4::Key::asterisk => Key::Asterisk, + gdk4::Key::parenleft => Key::LeftParen, + gdk4::Key::parenright => Key::RightParen, + gdk4::Key::minus => Key::Minus, + gdk4::Key::underscore => Key::Underscore, + gdk4::Key::equal => Key::Equal, + gdk4::Key::plus => Key::Plus, + gdk4::Key::bracketleft => Key::LeftBracket, + gdk4::Key::bracketright => Key::RightBracket, + gdk4::Key::braceleft => Key::LeftBrace, + gdk4::Key::braceright => Key::RightBrace, + gdk4::Key::backslash => Key::Backslash, + gdk4::Key::bar => Key::Pipe, + gdk4::Key::semicolon => Key::Semicolon, + gdk4::Key::colon => Key::Colon, + gdk4::Key::apostrophe => Key::Apostrophe, + gdk4::Key::quotedbl => Key::Quote, + gdk4::Key::comma => Key::Comma, + gdk4::Key::period => Key::Period, + gdk4::Key::slash => Key::Slash, + gdk4::Key::question => Key::Question, + gdk4::Key::grave => Key::Grave, + gdk4::Key::asciitilde => Key::Tilde, + _ => Key::None, + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum Modifier { + Shift, + Control, + Alt, + Super, + Meta, + CapsLock, + None, +} + +impl From for Modifier { + fn from(value: gdk4::ModifierType) -> Self { + match value { + gdk4::ModifierType::SHIFT_MASK => Modifier::Shift, + gdk4::ModifierType::CONTROL_MASK => Modifier::Control, + gdk4::ModifierType::ALT_MASK => Modifier::Alt, + gdk4::ModifierType::SUPER_MASK => Modifier::Super, + gdk4::ModifierType::META_MASK => Modifier::Meta, + gdk4::ModifierType::LOCK_MASK => Modifier::CapsLock, + _ => Modifier::None, + } + } +} + +#[derive(Clone, PartialEq)] +pub struct KeyBinding { + pub key: Key, + pub modifiers: Modifier, // todo support masks + pub label: String, +} + impl MenuItem { #[must_use] pub fn new( @@ -135,9 +390,9 @@ impl AsRef> for MenuItem { } } -struct MetaData { +struct MetaData { item_provider: ArcProvider, - selected_sender: MenuItemSender, + selected_sender: SelectionSender, config: Rc, new_on_empty: bool, search_ignored_words: Option>, @@ -161,7 +416,8 @@ pub fn show( item_provider: P, new_on_empty: bool, search_ignored_words: Option>, -) -> Result, Error> + custom_keys: Option>, +) -> Result, Error> where T: Clone + 'static + Send, P: ItemProvider + 'static + Clone + Send, @@ -192,21 +448,32 @@ where app.clone(), new_on_empty, search_ignored_words.clone(), + custom_keys.as_ref(), ); }); let gtk_args: [&str; 0] = []; app.run_with_args(>k_args); - receiver.recv().map_err(|e| Error::Io(e.to_string()))? + // Use glib's MainContext to handle the receiver asynchronously + let main_context = MainContext::default(); + let receiver_result = main_context.block_on(async { + MainContext::default() + .spawn_local(async move { receiver.recv().map_err(|e| Error::Io(e.to_string())) }) + .await + .unwrap_or_else(|e| Err(Error::Io(e.to_string()))) + }); + + receiver_result? } fn build_ui( config: &Config, item_provider: P, - sender: Sender, Error>>, + sender: Sender, Error>>, app: Application, new_on_empty: bool, search_ignored_words: Option>, + custom_keys: Option<&Vec>, ) where T: Clone + 'static + Send, P: ItemProvider + 'static + Send, @@ -245,7 +512,7 @@ fn build_ui( }); // handle keys as soon as possible - setup_key_event_handler(&ui_elements, &meta); + setup_key_event_handler(&ui_elements, &meta, custom_keys); log::debug!("keyboard ready after {:?}", start.elapsed()); @@ -272,6 +539,8 @@ fn build_ui( let outer_box = gtk4::Box::new(config.orientation().into(), 0); outer_box.set_widget_name("outer-box"); outer_box.append(&ui_elements.search); + build_custom_key_view(custom_keys, &outer_box); + ui_elements.window.set_child(Some(&outer_box)); let scroll = ScrolledWindow::new(); @@ -298,13 +567,10 @@ fn build_ui( let animate_cfg = config.clone(); let animate_window = ui_elements.window.clone(); - timeout_add_local(Duration::from_millis(5), move || { - if !animate_window.is_active() { - return ControlFlow::Continue; - } - animate_window.set_opacity(1.0); - window_show_resize(&animate_cfg.clone(), &animate_window); - ControlFlow::Break + + animate_window.connect_is_active_notify(move |w| { + w.set_opacity(1.0); + window_show_resize(&animate_cfg.clone(), w); }); // hide the fact that we are starting with a small window @@ -315,7 +581,6 @@ fn build_ui( log::debug!("Building UI took {:?}", start.elapsed(),); } - fn build_main_box(config: &Config, ui_elements: &Rc>) { ui_elements.main_box.set_widget_name("inner-box"); ui_elements.main_box.set_css_classes(&["inner-box"]); @@ -348,7 +613,11 @@ fn build_main_box(config: &Config, ui_elements: &Rc(config: &Config, ui_elements: &UiElements, meta: &MetaData) { +fn build_search_entry( + config: &Config, + ui_elements: &UiElements, + meta: &MetaData, +) { ui_elements.search.set_widget_name("input"); ui_elements.search.set_css_classes(&["input"]); ui_elements @@ -363,7 +632,35 @@ fn build_search_entry(config: &Config, ui_elements: &UiElements, me } } -fn set_search_text(text: &str, ui: &UiElements, meta: &MetaData) { +fn build_custom_key_view(custom_keys: Option<&Vec>, outer_box: >k4::Box) { + let inner_box = FlowBox::new(); + inner_box.set_halign(Align::Fill); + inner_box.set_widget_name("custom-key-box"); + if let Some(custom_keys) = custom_keys { + for key in custom_keys { + let label_box = FlowBoxChild::new(); + label_box.set_halign(Align::Fill); + inner_box.set_valign(Align::Start); + label_box.set_widget_name("custom-key-label-box"); + inner_box.append(&label_box); + inner_box.set_vexpand(false); + inner_box.set_hexpand(false); + let label = Label::new(Some(&key.label)); + label.set_halign(Align::Fill); + label.set_valign(Align::Start); + label.set_use_markup(true); + label.set_hexpand(true); + label.set_vexpand(false); + label.set_widget_name("custom-key-label-text"); + label.set_wrap(false); + label.set_xalign(0.0); + label_box.set_child(Some(&label)); + } + } + outer_box.append(&inner_box); +} + +fn set_search_text(text: &str, ui: &UiElements, meta: &MetaData) { let mut lock = ui.search_text.lock().unwrap(); text.clone_into(&mut lock); if let Some(pw) = meta.config.password() { @@ -377,7 +674,7 @@ fn set_search_text(text: &str, ui: &UiElements, meta: &MetaData) } } -fn build_ui_from_menu_items( +fn build_ui_from_menu_items( ui: &Rc>, meta: &Rc>, mut items: Vec>, @@ -443,21 +740,33 @@ fn build_ui_from_menu_items( fn setup_key_event_handler( ui: &Rc>, meta: &Rc>, + custom_keys: Option<&Vec>, ) { let key_controller = EventControllerKey::new(); let ui_clone = Rc::clone(ui); let meta_clone = Rc::clone(meta); - key_controller.connect_key_pressed(move |_, key_value, _, _| { - handle_key_press(&ui_clone, &meta_clone, key_value) + let keys_clone = custom_keys.cloned(); + key_controller.connect_key_pressed(move |_, key_value, _, modifier| { + handle_key_press( + &ui_clone, + &meta_clone, + key_value, + modifier, + keys_clone.as_ref(), + ) }); ui.window.add_controller(key_controller); } -fn handle_key_press( + +#[allow(clippy::too_many_lines)] // todo fix this. +fn handle_key_press( ui: &Rc>, meta: &Rc>, - keyboard_key: Key, + keyboard_key: gdk4::Key, + modifier_type: gdk4::ModifierType, + custom_keys: Option<&Vec>, ) -> Propagation { let update_view = |query: &String| { let mut lock = ui.menu_rows.lock().unwrap(); @@ -476,26 +785,49 @@ fn handle_key_press( if changed { build_ui_from_menu_items(ui, meta, filtered_list); } - update_view(query); }; + if let Some(custom_keys) = custom_keys { + for custom_key in custom_keys { + if custom_key.key == keyboard_key.into() && custom_key.modifiers == modifier_type.into() + { + let search_lock = ui.search_text.lock().unwrap(); + if let Err(e) = handle_selected_item( + ui, + Rc::>::clone(meta), + Some(&search_lock), + None, + meta.new_on_empty, + Some(custom_key), + ) { + log::error!("{e}"); + } + } + } + } + match keyboard_key { - Key::Escape => { + gdk4::Key::Escape => { if let Err(e) = meta.selected_sender.send(Err(Error::NoSelection)) { log::error!("failed to send message {e}"); } close_gui(&ui.app); } - Key::Return => { + gdk4::Key::Return => { let search_lock = ui.search_text.lock().unwrap(); - if let Err(e) = - handle_selected_item(ui, meta, Some(&search_lock), None, meta.new_on_empty) - { + if let Err(e) = handle_selected_item( + ui, + Rc::>::clone(meta), + Some(&search_lock), + None, + meta.new_on_empty, + None, + ) { log::error!("{e}"); } } - Key::BackSpace => { + gdk4::Key::BackSpace => { let mut query = ui.search_text.lock().unwrap().to_string(); if !query.is_empty() { query.pop(); @@ -504,7 +836,7 @@ fn handle_key_press( update_view_from_provider(&query); } } - Key::Tab => { + gdk4::Key::Tab => { if let Some(fb) = ui.main_box.selected_children().first() { if let Some(child) = fb.child() { let expander = child.downcast::().ok(); @@ -548,7 +880,6 @@ fn handle_key_press( } } } - Propagation::Proceed } @@ -622,31 +953,27 @@ fn close_gui(app: &Application) { } fn handle_selected_item( - ui: &UiElements, - meta: &MetaData, + ui: &Rc>, + meta: Rc>, query: Option<&str>, item: Option>, new_on_empty: bool, + custom_key: Option<&KeyBinding>, ) -> Result<(), String> where - T: Clone, + T: Clone + Send + 'static, { if let Some(selected_item) = item { - if let Err(e) = meta.selected_sender.send(Ok(selected_item.clone())) { - log::error!("failed to send message {e}"); - } - - close_gui(&ui.app); + send_selected_item(ui, meta, custom_key.cloned(), selected_item); return Ok(()); } else if let Some(s) = ui.main_box.selected_children().into_iter().next() { let list_items = ui.menu_rows.lock().unwrap(); let item = list_items.get(&s); - if let Some(item) = item { - if let Err(e) = meta.selected_sender.send(Ok(item.clone())) { - log::error!("failed to send message {e}"); + if let Some(selected_item) = item { + if selected_item.visible { + send_selected_item(ui, meta, custom_key.cloned(), selected_item.clone()); + return Ok(()); } - close_gui(&ui.app); - return Ok(()); } } @@ -663,17 +990,35 @@ where visible: true, }; - if let Err(e) = meta.selected_sender.send(Ok(item.clone())) { - log::error!("failed to send message {e}"); - } - close_gui(&ui.app); + send_selected_item(ui, meta, custom_key.cloned(), item); Ok(()) } else { Err("selected item cannot be resolved".to_owned()) } } -fn add_menu_item( +fn send_selected_item( + ui: &Rc>, + meta: Rc>, + custom_key: Option, + selected_item: MenuItem, +) where + T: Clone + Send + 'static, +{ + let ui_clone = Rc::clone(ui); + ui.window.connect_hide(move |_| { + if let Err(e) = meta.selected_sender.send(Ok(Selection { + menu: selected_item.clone(), + custom_key: custom_key.clone(), + })) { + log::error!("failed to send message {e}"); + } + }); + ui.window.hide(); + close_gui(&ui_clone.app); +} + +fn add_menu_item( ui: &Rc>, meta: &Rc>, element_to_add: &MenuItem, @@ -718,7 +1063,7 @@ fn add_menu_item( child } -fn create_menu_row( +fn create_menu_row( ui: &Rc>, meta: &Rc>, element_to_add: &MenuItem, @@ -777,11 +1122,12 @@ fn create_menu_row( click.connect_pressed(move |_gesture, n_press, _x, _y| { if n_press == 2 { if let Err(e) = handle_selected_item( - click_ui.as_ref(), - click_meta.as_ref(), + &click_ui, + Rc::>::clone(&click_meta), None, Some(element_clone.clone()), false, + None, ) { log::error!("{e}"); } @@ -863,6 +1209,10 @@ fn set_menu_visibility_for_search( config: &Config, search_ignored_words: Option<&Vec>, ) { + if config.sort_order() == SortOrder::Default { + return; + } + { if query.is_empty() { for (fb, menu_item) in items.iter_mut() { @@ -923,12 +1273,8 @@ fn set_menu_visibility_for_search( } } MatchMethod::MultiContains => { - let score = query - .split(' ') - .filter(|i| menu_item_search.contains(i)) - .map(|_| 1.0) - .sum(); - (score, score > 0.0) + let contains = query.split(' ').all(|x| menu_item_search.contains(x)); + (if contains { 1.0 } else { 0.0 }, contains) } }; diff --git a/src/lib/mod.rs b/worf/src/lib/mod.rs similarity index 99% rename from src/lib/mod.rs rename to worf/src/lib/mod.rs index 5455ba3..365eb4e 100644 --- a/src/lib/mod.rs +++ b/worf/src/lib/mod.rs @@ -1,5 +1,14 @@ use std::fmt; +/// Configuration and command line parsing +pub mod config; +/// Desktop action like parsing desktop files and launching programs +pub mod desktop; +/// All things related to the user interface +pub mod gui; +/// Out of the box supported modes, like drun, dmenu, etc... +pub mod modes; + /// Defines error the lib can encounter #[derive(Debug, PartialEq)] pub enum Error { @@ -64,12 +73,3 @@ impl fmt::Display for Error { } } } - -/// Configuration and command line parsing -pub mod config; -/// Desktop action like parsing desktop files and launching programs -pub mod desktop; -/// All things related to the user interface -pub mod gui; -/// Out of the box supported modes, like drun, dmenu, etc... -pub mod mode; diff --git a/worf/src/lib/modes/auto.rs b/worf/src/lib/modes/auto.rs new file mode 100644 index 0000000..3413bbd --- /dev/null +++ b/worf/src/lib/modes/auto.rs @@ -0,0 +1,179 @@ +use crate::config::Config; +use crate::desktop::{copy_to_clipboard, spawn_fork}; +use crate::gui::{ItemProvider, MenuItem}; +use crate::modes::drun::{DRunProvider, update_drun_cache_and_run}; +use crate::modes::emoji::EmojiProvider; +use crate::modes::file::FileItemProvider; +use crate::modes::math::MathProvider; +use crate::modes::ssh; +use crate::modes::ssh::SshProvider; +use crate::{Error, gui}; +use regex::Regex; + +#[derive(Debug, Clone, PartialEq)] +enum AutoRunType { + Math, + DRun, + File, + Ssh, + Emoji, + // WebSearch, +} + +#[derive(Clone)] +struct AutoItemProvider { + drun: DRunProvider, + file: FileItemProvider, + math: MathProvider, + ssh: SshProvider, + emoji: EmojiProvider, + last_mode: Option, +} + +impl AutoItemProvider { + fn new(config: &Config) -> Self { + AutoItemProvider { + drun: DRunProvider::new(AutoRunType::DRun, config.no_actions(), config.sort_order()), + file: FileItemProvider::new(AutoRunType::File, config.sort_order()), + math: MathProvider::new(AutoRunType::Math), + ssh: SshProvider::new(AutoRunType::Ssh, &config.sort_order()), + emoji: EmojiProvider::new(AutoRunType::Emoji, &config.sort_order()), + last_mode: None, + } + } + + fn default_auto_elements( + &mut self, + search_opt: Option<&str>, + ) -> (bool, Vec>) { + // return ssh and drun items + let (changed, mut items) = self.drun.get_elements(search_opt); + items.append(&mut self.ssh.get_elements(search_opt).1); + if self.last_mode == Some(AutoRunType::DRun) { + (changed, items) + } else { + self.last_mode = Some(AutoRunType::DRun); + (true, items) + } + } +} + +fn contains_math_functions_or_starts_with_number(input: &str) -> bool { + // Regex for function names (word boundaries to match whole words) + let math_functions = r"\b(sqrt|abs|exp|ln|sin|cos|tan|asin|acos|atan|atan2|sinh|cosh|tanh|asinh|acosh|atanh|floor|ceil|round|signum|min|max|pi|e)\b"; + + // Regex for strings that start with a number (including decimals) + let starts_with_number = r"^\s*[+-]?(\d+(\.\d*)?|\.\d+)"; + + let math_regex = Regex::new(math_functions).unwrap(); + let number_regex = Regex::new(starts_with_number).unwrap(); + + math_regex.is_match(input) || number_regex.is_match(input) +} + +impl ItemProvider for AutoItemProvider { + fn get_elements(&mut self, search_opt: Option<&str>) -> (bool, Vec>) { + let search = match search_opt { + Some(s) if !s.trim().is_empty() => s.trim(), + _ => return self.default_auto_elements(search_opt), + }; + + let (mode, (changed, items)) = if contains_math_functions_or_starts_with_number(search) { + (AutoRunType::Math, self.math.get_elements(search_opt)) + } 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::Ssh, self.ssh.get_elements(search_opt)) + } else if search.starts_with("emoji") { + (AutoRunType::Emoji, self.emoji.get_elements(search_opt)) + } else { + return self.default_auto_elements(search_opt); + }; + + if self.last_mode.as_ref().is_some_and(|m| m == &mode) { + (changed, items) + } else { + self.last_mode = Some(mode); + (true, items) + } + } + + fn get_sub_elements( + &mut self, + item: &MenuItem, + ) -> (bool, Option>>) { + let (changed, items) = self.get_elements(Some(item.label.as_ref())); + (changed, Some(items)) + } +} + +/// Shows the auto mode +/// # Errors +/// +/// Will return `Err` +/// * if it was not able to spawn the process +/// +/// # Panics +/// Panics if an internal static regex cannot be passed anymore, should never happen +pub fn show(config: &Config) -> Result<(), Error> { + let mut provider = AutoItemProvider::new(config); + let cache_path = provider.drun.cache_path.clone(); + let mut cache = provider.drun.cache.clone(); + + loop { + // todo ues a arc instead of cloning the config + let selection_result = gui::show( + config.clone(), + provider.clone(), + true, + Some( + vec!["ssh", "emoji", "^\\$\\w+"] + .into_iter() + .map(|s| Regex::new(s).unwrap()) + .collect(), + ), + None, + ); + + if let Ok(selection_result) = selection_result { + let mut selection_result = selection_result.menu; + if let Some(data) = &selection_result.data { + match data { + AutoRunType::Math => { + provider.math.elements.push(selection_result); + } + AutoRunType::DRun => { + update_drun_cache_and_run(cache_path, &mut cache, selection_result)?; + break; + } + AutoRunType::File => { + if let Some(action) = selection_result.action { + spawn_fork(&action, selection_result.working_dir.as_ref())?; + } + break; + } + AutoRunType::Ssh => { + ssh::launch(&selection_result, config)?; + break; + } + AutoRunType::Emoji => { + if let Some(action) = selection_result.action { + copy_to_clipboard(action, None)?; + } else { + return Err(Error::MissingAction); + } + break; + } + } + } else if selection_result.label.starts_with("ssh") { + selection_result.label = selection_result.label.chars().skip(4).collect(); + ssh::launch(&selection_result, config)?; + } + } else { + log::error!("No item selected"); + break; + } + } + + Ok(()) +} diff --git a/worf/src/lib/modes/dmenu.rs b/worf/src/lib/modes/dmenu.rs new file mode 100644 index 0000000..dda55cf --- /dev/null +++ b/worf/src/lib/modes/dmenu.rs @@ -0,0 +1,55 @@ +use crate::config::{Config, SortOrder}; +use crate::gui::{ItemProvider, MenuItem}; +use crate::{Error, gui}; +use std::io; +use std::io::Read; + +#[derive(Clone)] +struct DMenuProvider { + items: Vec>, +} + +impl DMenuProvider { + fn new(sort_order: &SortOrder) -> DMenuProvider { + log::debug!("parsing stdin"); + let mut input = String::new(); + io::stdin() + .read_to_string(&mut input) + .expect("Failed to read from stdin"); + + let mut items: Vec> = input + .lines() + .rev() + .map(|s| MenuItem::new(s.to_string(), None, None, vec![], None, 0.0, None)) + .collect(); + log::debug!("parsed stdin"); + gui::apply_sort(&mut items, sort_order); + Self { items } + } +} +impl ItemProvider for DMenuProvider { + fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { + (false, self.items.clone()) + } + + fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { + (false, None) + } +} + +/// Shows the dmenu mode +/// # Errors +/// +/// Forwards errors from the gui. See `gui::show` for details. +pub fn show(config: &Config) -> Result<(), Error> { + let provider = DMenuProvider::new(&config.sort_order()); + + let selection_result = gui::show(config.clone(), provider, true, None, None); + match selection_result { + Ok(s) => { + println!("{}", s.menu.label); + Ok(()) + } + Err(_) => Err(Error::InvalidSelection), + } +} diff --git a/worf/src/lib/modes/drun.rs b/worf/src/lib/modes/drun.rs new file mode 100644 index 0000000..f420f0a --- /dev/null +++ b/worf/src/lib/modes/drun.rs @@ -0,0 +1,205 @@ +use crate::config::{Config, SortOrder}; +use crate::desktop::{ + 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 rayon::prelude::*; +use serde::{Deserialize, Serialize}; +use std::collections::{HashMap, HashSet}; +use std::path::PathBuf; +use std::time::Instant; + +#[derive(Debug, Deserialize, Serialize, Clone)] +struct DRunCache { + desktop_entry: String, + run_count: usize, +} + +#[derive(Clone)] +pub(crate) struct DRunProvider { + items: Option>>, + pub(crate) cache_path: Option, + pub(crate) cache: HashMap, + data: T, + no_actions: bool, + sort_order: SortOrder, +} + +impl ItemProvider for DRunProvider { + fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { + if self.items.is_none() { + self.items = Some(self.load().clone()); + } + (false, self.items.clone().unwrap()) + } + + fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { + (false, None) + } +} + +impl DRunProvider { + pub(crate) fn new(menu_item_data: T, no_actions: bool, sort_order: SortOrder) -> Self { + let (cache_path, d_run_cache) = load_d_run_cache(); + DRunProvider { + items: None, + cache_path, + cache: d_run_cache, + data: menu_item_data, + no_actions, + sort_order, + } + } + + #[allow(clippy::cast_possible_truncation)] + #[allow(clippy::cast_precision_loss)] + fn load(&self) -> Vec> { + let locale_variants = get_locale_variants(); + let default_icon = "application-x-executable".to_string(); + let start = Instant::now(); + + let entries: Vec> = find_desktop_files() + .into_par_iter() + .filter(|file| { + !file.entry.no_display.unwrap_or(false) + && !file.entry.hidden.unwrap_or(false) + }) + .filter_map(|file| { + let name = lookup_name_with_locale( + &locale_variants, + &file.entry.name.variants, + &file.entry.name.default, + )?; + + let (action, working_dir) = match &file.entry.entry_type { + EntryType::Application(app) => (app.exec.clone(), app.path.clone()), + _ => return None, + }; + + let cmd_exists = action + .as_ref() + .and_then(|a| { + a.split(' ') + .next() + .map(|cmd| cmd.replace('"', "")) + .map(|cmd| PathBuf::from(&cmd).exists() || which::which(&cmd).is_ok()) + }) + .unwrap_or(false); + + if !cmd_exists { + log::warn!("Skipping desktop entry for {name:?} because action {action:?} does not exist"); + return None; + } + + let icon = file + .entry + .icon + .as_ref() + .map(|s| s.content.clone()) + .or(Some(default_icon.clone())); + + let sort_score = *self.cache.get(&name).unwrap_or(&0) as f64; + + let mut entry = MenuItem::new( + name.clone(), + icon.clone(), + action.clone(), + Vec::new(), + working_dir.clone(), + sort_score, + Some(self.data.clone()), + ); + if !self.no_actions { + for action in file.actions.values() { + if let Some(action_name) = lookup_name_with_locale( + &locale_variants, + &action.name.variants, + &action.name.default, + ) { + let action_icon = action + .icon + .as_ref() + .map(|s| s.content.clone()) + .or(icon.clone()) + .unwrap_or("application-x-executable".to_string()); + + + entry.sub_elements.push(MenuItem::new( + action_name, + Some(action_icon), + action.exec.clone(), + Vec::new(), + working_dir.clone(), + 0.0, + Some(self.data.clone()), + )); + } + } + } + Some(entry) + }) + .collect(); + + let mut seen_actions = HashSet::new(); + let mut entries: Vec> = entries + .into_iter() + .filter(|entry| seen_actions.insert(entry.action.clone())) + .collect(); + + log::info!( + "parsing desktop files took {}ms", + start.elapsed().as_millis() + ); + + gui::apply_sort(&mut entries, &self.sort_order); + entries + } +} + +fn load_d_run_cache() -> (Option, HashMap) { + let cache_path = dirs::cache_dir().map(|x| x.join("worf-drun")); + load_cache(cache_path) +} + +pub(crate) fn update_drun_cache_and_run( + cache_path: Option, + cache: &mut HashMap, + selection_result: MenuItem, +) -> Result<(), Error> { + if let Some(cache_path) = cache_path { + *cache.entry(selection_result.label).or_insert(0) += 1; + if let Err(e) = save_cache_file(&cache_path, cache) { + log::warn!("cannot save drun cache {e:?}"); + } + } + + if let Some(action) = selection_result.action { + spawn_fork(&action, selection_result.working_dir.as_ref()) + } else { + Err(Error::MissingAction) + } +} + +/// Shows the drun mode +/// # Errors +/// +/// Will return `Err` if it was not able to spawn the process +pub fn show(config: &Config) -> Result<(), Error> { + let provider = DRunProvider::new(0, config.no_actions(), config.sort_order()); + let cache_path = provider.cache_path.clone(); + let mut cache = provider.cache.clone(); + + // todo ues a arc instead of cloning the config + let selection_result = gui::show(config.clone(), provider, false, None, None); + match selection_result { + Ok(s) => update_drun_cache_and_run(cache_path, &mut cache, s.menu)?, + Err(_) => { + log::error!("No item selected"); + } + } + + Ok(()) +} diff --git a/worf/src/lib/modes/emoji.rs b/worf/src/lib/modes/emoji.rs new file mode 100644 index 0000000..16f12a0 --- /dev/null +++ b/worf/src/lib/modes/emoji.rs @@ -0,0 +1,60 @@ +use crate::config::{Config, SortOrder}; +use crate::desktop::copy_to_clipboard; +use crate::gui::{ItemProvider, MenuItem}; +use crate::{Error, gui}; + +#[derive(Clone)] +pub(crate) struct EmojiProvider { + elements: Vec>, + #[allow(dead_code)] // needed for the detection of mode in 'auto' + menu_item_data: T, +} + +impl EmojiProvider { + pub(crate) fn new(data: T, sort_order: &SortOrder) -> Self { + let emoji = emoji::search::search_annotation_all(""); + let mut menus = emoji + .into_iter() + .map(|e| { + MenuItem::new( + format!("{} — Category: {} — Name: {}", e.glyph, e.group, e.name), + None, + Some(format!("emoji {}", e.glyph)), + vec![], + None, + 0.0, + Some(data.clone()), + ) + }) + .collect::>(); + gui::apply_sort(&mut menus, sort_order); + + Self { + elements: menus, + menu_item_data: data.clone(), + } + } +} + +impl ItemProvider for EmojiProvider { + fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { + (false, self.elements.clone()) + } + + fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { + (false, None) + } +} + +/// Shows the emoji mode +/// # Errors +/// +/// Forwards errors from the gui. See `gui::show` for details. +pub fn show(config: &Config) -> Result<(), Error> { + let provider = EmojiProvider::new(0, &config.sort_order()); + let selection_result = gui::show(config.clone(), provider, true, None, None)?; + match selection_result.menu.action { + None => Err(Error::MissingAction), + Some(action) => copy_to_clipboard(action, None), + } +} diff --git a/worf/src/lib/modes/file.rs b/worf/src/lib/modes/file.rs new file mode 100644 index 0000000..072a5a7 --- /dev/null +++ b/worf/src/lib/modes/file.rs @@ -0,0 +1,212 @@ +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::os::unix::fs::FileTypeExt; +use std::path::{Path, PathBuf}; + +#[derive(Clone)] +pub(crate) struct FileItemProvider { + last_result: Option>>, + menu_item_data: T, + sort_order: SortOrder, +} + +impl FileItemProvider { + pub(crate) fn new(menu_item_data: T, sort_order: SortOrder) -> Self { + FileItemProvider { + last_result: None, + menu_item_data, + sort_order, + } + } + + fn resolve_icon_for_name(path: &Path) -> String { + let type_result = fs::symlink_metadata(path) + .map(|meta| meta.file_type()) + .map(|file_type| { + if file_type.is_symlink() { + Some("edit-redo") + } else if file_type.is_char_device() { + Some("input-keyboard") + } else if file_type.is_block_device() { + Some("drive-harddisk") + } else if file_type.is_socket() { + Some("network-transmit-receive") + } else if file_type.is_fifo() { + Some("rotation-allowed") + } else { + None + } + }) + .unwrap_or(Some("system-lock-screen")); + + if let Some(tr) = type_result { + return tr.to_owned(); + } + + let Some(mime) = tree_magic_mini::from_filepath(path) else { + return "image-not-found".to_string(); + }; + + if mime.starts_with("image") { + return "image-x-generic".to_string(); + } + + if mime.starts_with("inode") { + return mime.replace('/', "-"); + } + + if mime.starts_with("text") { + return if mime.contains("plain") { + "text-x-generic".to_string() + } else if mime.contains("python") { + "text-x-script".to_string() + } else if mime.contains("html") { + "text-html".to_string() + } else { + "text-x-generic".to_string() + }; + } + + if mime.starts_with("application") { + return if mime.contains("octet") { + "application-x-executable".to_string() + } else if mime.contains("tar") + || mime.contains("lz") + || mime.contains("zip") + || mime.contains("7z") + || mime.contains("xz") + { + "package-x-generic".to_string() + } else { + "text-html".to_string() + }; + } + + log::debug!("unsupported mime type {mime}"); + "application-x-generic".to_string() + } +} + +impl ItemProvider for FileItemProvider { + fn get_elements(&mut self, search: Option<&str>) -> (bool, Vec>) { + let default_path = if let Some(home) = dirs::home_dir() { + home.display().to_string() + } else { + "/".to_string() + }; + + let mut trimmed_search = search.unwrap_or(&default_path).to_owned(); + if !trimmed_search.starts_with('/') + && !trimmed_search.starts_with('~') + && !trimmed_search.starts_with('$') + { + trimmed_search = format!("{default_path}/{trimmed_search}"); + } + + let path = expand_path(&trimmed_search); + let mut items: Vec> = Vec::new(); + + if !path.exists() { + if let Some(last) = &self.last_result { + return (false, last.clone()); + } + + return (true, vec![]); + } + + if path.is_dir() { + items.push(MenuItem::new( + trimmed_search.clone(), + Some(FileItemProvider::::resolve_icon_for_name(&path)), + Some(format!("xdg-open {}", path.display())), + vec![], + None, + 100.0, + Some(self.menu_item_data.clone()), + )); + + if let Ok(entries) = path.read_dir() { + for entry in entries.flatten() { + if let Some(mut path_str) = + entry.path().to_str().map(std::string::ToString::to_string) + { + if trimmed_search.starts_with('~') { + if let Some(home_dir) = dirs::home_dir() { + if let Some(home_str) = home_dir.to_str() { + path_str = path_str.replace(home_str, "~"); + } + } + } + + if entry.path().is_dir() { + path_str.push('/'); + } + + items.push(MenuItem::new( + path_str.clone(), + Some(FileItemProvider::::resolve_icon_for_name(&entry.path())), + Some(format!("xdg-open {path_str}")), + vec![], + None, + 0.0, + Some(self.menu_item_data.clone()), + )); + } + } + } + } else { + items.push({ + MenuItem::new( + trimmed_search.clone(), + Some(FileItemProvider::::resolve_icon_for_name( + &PathBuf::from(&trimmed_search), + )), + Some(format!("xdg-open {trimmed_search}")), + vec![], + None, + 0.0, + Some(self.menu_item_data.clone()), + ) + }); + } + + gui::apply_sort(&mut items, &self.sort_order); + + self.last_result = Some(items.clone()); + (true, items) + } + + fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { + (false, self.last_result.clone()) + } +} + +/// Shows the file browser mode +/// # Errors +/// +/// Will return `Err` +/// * if it was not able to spawn the process +/// +/// # Panics +/// In case an internal regex does not parse anymore, this should never happen +pub fn show(config: &Config) -> Result<(), Error> { + let provider = FileItemProvider::new(0, config.sort_order()); + + // todo ues a arc instead of cloning the config + let selection_result = gui::show( + config.clone(), + provider, + false, + Some(vec![Regex::new("^\\$\\w+").unwrap()]), + None, + )?; + if let Some(action) = selection_result.menu.action { + spawn_fork(&action, selection_result.menu.working_dir.as_ref()) + } else { + Err(Error::MissingAction) + } +} diff --git a/worf/src/lib/modes/math.rs b/worf/src/lib/modes/math.rs new file mode 100644 index 0000000..aa75ce6 --- /dev/null +++ b/worf/src/lib/modes/math.rs @@ -0,0 +1,67 @@ +use crate::config::Config; +use crate::gui; +use crate::gui::{ItemProvider, MenuItem}; + +#[derive(Clone)] +pub(crate) struct MathProvider { + menu_item_data: T, + pub(crate) elements: Vec>, +} + +impl MathProvider { + pub(crate) fn new(menu_item_data: T) -> Self { + Self { + menu_item_data, + elements: vec![], + } + } + fn add_elements(&mut self, elements: &mut Vec>) { + self.elements.append(elements); + } +} + +impl ItemProvider for MathProvider { + fn get_elements(&mut self, search: Option<&str>) -> (bool, Vec>) { + if let Some(search_text) = search { + let result = match meval::eval_str(search_text) { + Ok(result) => result.to_string(), + Err(e) => format!("failed to calculate {e:?}"), + }; + + let item = MenuItem::new( + result, + None, + search.map(String::from), + vec![], + None, + 0.0, + Some(self.menu_item_data.clone()), + ); + let mut result = vec![item]; + result.append(&mut self.elements.clone()); + (true, result) + } else { + (false, self.elements.clone()) + } + } + + fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { + (false, None) + } +} + +/// Shows the math mode +pub fn show(config: &Config) { + let mut calc: Vec> = vec![]; + loop { + let mut provider = MathProvider::new(String::new()); + provider.add_elements(&mut calc.clone()); + let selection_result = gui::show(config.clone(), provider, true, None, None); + if let Ok(mi) = selection_result { + calc.push(mi.menu); + } else { + log::error!("No item selected"); + break; + } + } +} diff --git a/worf/src/lib/modes/mod.rs b/worf/src/lib/modes/mod.rs new file mode 100644 index 0000000..efc9be5 --- /dev/null +++ b/worf/src/lib/modes/mod.rs @@ -0,0 +1,25 @@ +use crate::desktop::{create_file_if_not_exists, load_cache_file}; +use std::collections::HashMap; +use std::path::PathBuf; + +pub mod auto; +pub mod dmenu; +pub mod drun; +pub mod emoji; +pub mod file; +pub mod math; +pub mod run; +pub mod ssh; + +pub(crate) fn load_cache(cache_path: Option) -> (Option, HashMap) { + let cache = { + if let Some(ref cache_path) = cache_path { + if let Err(e) = create_file_if_not_exists(cache_path) { + log::warn!("No drun cache file and cannot create: {e:?}"); + } + } + + load_cache_file(cache_path.as_ref()).unwrap_or_default() + }; + (cache_path, cache) +} diff --git a/worf/src/lib/modes/run.rs b/worf/src/lib/modes/run.rs new file mode 100644 index 0000000..6df35a3 --- /dev/null +++ b/worf/src/lib/modes/run.rs @@ -0,0 +1,142 @@ +use crate::config::{Config, SortOrder}; +use crate::desktop::{is_executable, save_cache_file}; +use crate::gui::{ItemProvider, MenuItem}; +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 for RunProvider { + fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { + if self.items.is_none() { + self.items = Some(self.load().clone()); + } + (false, self.items.clone().unwrap()) + } + + fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { + (false, None) + } +} + +#[derive(Clone)] +struct RunProvider { + items: Option>>, + cache_path: Option, + cache: HashMap, + sort_order: SortOrder, +} + +impl RunProvider { + fn new(sort_order: SortOrder) -> Self { + let (cache_path, d_run_cache) = load_run_cache(); + RunProvider { + items: None, + cache_path, + cache: d_run_cache, + sort_order, + } + } + + #[allow(clippy::cast_possible_truncation)] + #[allow(clippy::cast_precision_loss)] + fn load(&self) -> Vec> { + let path_var = env::var("PATH").unwrap_or_default(); + let paths = env::split_paths(&path_var); + + let entries: Vec<_> = paths + .filter(|dir| dir.is_dir()) + .flat_map(|dir| { + fs::read_dir(dir) + .into_iter() + .flatten() + .filter_map(Result::ok) + .filter_map(|entry| { + let path = entry.path(); + if !is_executable(&path) { + return None; + } + + let label = path.file_name()?.to_str()?.to_string(); + let sort_score = *self.cache.get(&label).unwrap_or(&0) as f64; + + Some(MenuItem::new( + label, + None, + path.to_str().map(ToString::to_string), + vec![], + None, + sort_score, + None, + )) + }) + }) + .collect(); + + let mut seen_actions = HashSet::new(); + let mut entries: Vec> = entries + .into_iter() + .filter(|entry| { + entry + .action + .as_ref() + .and_then(|action| action.split('/').next_back()) + .is_some_and(|cmd| seen_actions.insert(cmd.to_string())) + }) + .collect(); + + gui::apply_sort(&mut entries, &self.sort_order); + entries + } +} + +fn load_run_cache() -> (Option, HashMap) { + let cache_path = dirs::cache_dir().map(|x| x.join("worf-run")); + load_cache(cache_path) +} + +fn update_run_cache_and_run( + cache_path: Option, + cache: &mut HashMap, + selection_result: MenuItem, +) -> Result<(), Error> { + if let Some(cache_path) = cache_path { + *cache.entry(selection_result.label).or_insert(0) += 1; + if let Err(e) = save_cache_file(&cache_path, cache) { + log::warn!("cannot save run cache {e:?}"); + } + } + + if let Some(action) = selection_result.action { + let program = CString::new(action).unwrap(); + let args = [program.clone()]; + + // This replaces the current process image + nix::unistd::execvp(&program, &args).map_err(|e| Error::RunFailed(e.to_string()))?; + Ok(()) + } else { + Err(Error::MissingAction) + } +} + +/// Shows the run mode +/// # Errors +/// +/// Will return `Err` if it was not able to spawn the process +pub fn show(config: &Config) -> Result<(), Error> { + let provider = RunProvider::new(config.sort_order()); + let cache_path = provider.cache_path.clone(); + let mut cache = provider.cache.clone(); + + let selection_result = gui::show(config.clone(), provider, false, None, None); + match selection_result { + Ok(s) => update_run_cache_and_run(cache_path, &mut cache, s.menu)?, + Err(_) => { + log::error!("No item selected"); + } + } + + Ok(()) +} diff --git a/worf/src/lib/modes/ssh.rs b/worf/src/lib/modes/ssh.rs new file mode 100644 index 0000000..eca7848 --- /dev/null +++ b/worf/src/lib/modes/ssh.rs @@ -0,0 +1,95 @@ +use crate::config::{Config, SortOrder}; +use crate::desktop::spawn_fork; +use crate::gui::{ItemProvider, MenuItem}; +use crate::{Error, gui}; +use regex::Regex; +use std::fs; + +#[derive(Clone)] +pub(crate) struct SshProvider { + elements: Vec>, +} + +impl SshProvider { + pub(crate) fn new(menu_item_data: T, order: &SortOrder) -> Self { + let re = Regex::new(r"(?m)^\s*Host\s+(.+)$").unwrap(); + let mut items: Vec<_> = dirs::home_dir() + .map(|home| home.join(".ssh").join("config")) + .filter(|path| path.exists()) + .map(|path| fs::read_to_string(&path).unwrap_or_default()) + .into_iter() + .flat_map(|content| { + re.captures_iter(&content) + .flat_map(|cap| { + cap[1] + .split_whitespace() + .map(|host| { + log::debug!("found ssh host {host}"); + MenuItem::new( + host.to_owned(), + Some("computer".to_owned()), + Some(format!("ssh {host}")), + vec![], + None, + 0.0, + Some(menu_item_data.clone()), + ) + }) + .collect::>() + }) + .collect::>() + }) + .collect(); + + gui::apply_sort(&mut items, order); + Self { elements: items } + } +} + +impl ItemProvider for SshProvider { + fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec>) { + (false, self.elements.clone()) + } + + fn get_sub_elements(&mut self, _: &MenuItem) -> (bool, Option>>) { + (false, None) + } +} + +pub(crate) fn launch(menu_item: &MenuItem, config: &Config) -> Result<(), Error> { + let ssh_cmd = if let Some(action) = &menu_item.action { + action.clone() + } else { + let cmd = config + .term() + .map(|s| format!("{s} ssh {}", menu_item.label)); + if let Some(cmd) = cmd { + cmd + } else { + return Err(Error::MissingAction); + } + }; + + let cmd = format!( + "{} bash -c \"source ~/.bashrc; {ssh_cmd}\"", + config.term().unwrap_or_default() + ); + spawn_fork(&cmd, menu_item.working_dir.as_ref()) +} + +/// Shows the ssh mode +/// # Errors +/// +/// Will return `Err` +/// * if it was not able to spawn the process +/// * if it didn't find a terminal +pub fn show(config: &Config) -> Result<(), Error> { + let provider = SshProvider::new(0, &config.sort_order()); + let selection_result = gui::show(config.clone(), provider, true, None, None); + if let Ok(mi) = selection_result { + launch(&mi.menu, config)?; + } else { + log::error!("No item selected"); + } + Ok(()) +} diff --git a/src/main.rs b/worf/src/main.rs similarity index 62% rename from src/main.rs rename to worf/src/main.rs index a583877..7a43ae3 100644 --- a/src/main.rs +++ b/worf/src/main.rs @@ -2,7 +2,8 @@ use std::env; use anyhow::anyhow; use worf_lib::config::Mode; -use worf_lib::{Error, config, mode}; +use worf_lib::{Error, config, modes}; + fn main() -> anyhow::Result<()> { env_logger::Builder::new() .parse_filters(&env::var("RUST_LOG").unwrap_or_else(|_| "error".to_owned())) @@ -14,17 +15,17 @@ fn main() -> anyhow::Result<()> { if let Some(show) = &config.show() { let result = match show { - Mode::Run => mode::run(&config), - Mode::Drun => mode::d_run(&config), - Mode::Dmenu => mode::dmenu(&config), - Mode::File => mode::file(&config), + Mode::Run => modes::run::show(&config), + Mode::Drun => modes::drun::show(&config), + Mode::Dmenu => modes::dmenu::show(&config), + Mode::File => modes::file::show(&config), Mode::Math => { - mode::math(&config); + modes::math::show(&config); Ok(()) } - Mode::Ssh => mode::ssh(&config), - Mode::Emoji => mode::emoji(&config), - Mode::Auto => mode::auto(&config), + Mode::Ssh => modes::ssh::show(&config), + Mode::Emoji => modes::emoji::show(&config), + Mode::Auto => modes::auto::show(&config), }; if let Err(err) = result { @@ -38,6 +39,7 @@ fn main() -> anyhow::Result<()> { Ok(()) } else { - Err(anyhow!("No mode provided")) + log::error!("No mode provided"); + Ok(()) } }