diff --git a/Cargo.lock b/Cargo.lock index d87a203..8319116 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,9 +43,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.21" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", "anstyle-parse", @@ -58,15 +58,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" -version = "0.2.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ "utf8parse", ] @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.101" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "async-broadcast" @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.13.3" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" dependencies = [ "async-task", "concurrent-queue", @@ -148,7 +148,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix", + "rustix 1.1.4", "slab", "windows-sys 0.61.2", ] @@ -179,7 +179,7 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix", + "rustix 1.1.4", ] [[package]] @@ -190,14 +190,14 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] name = "async-signal" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" dependencies = [ "async-io", "async-lock", @@ -205,7 +205,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix", + "rustix 1.1.4", "signal-hook-registry", "slab", "windows-sys 0.61.2", @@ -225,7 +225,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -293,9 +293,12 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.10.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" +dependencies = [ + "serde_core", +] [[package]] name = "block-buffer" @@ -321,9 +324,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.1" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "bytemuck" @@ -354,9 +357,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.56" +version = "1.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" +checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" dependencies = [ "find-msvc-tools", "shlex", @@ -376,9 +379,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.43" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ "iana-time-zone", "js-sys", @@ -389,9 +392,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.58" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63be97961acde393029492ce0be7a1af7e323e6bae9511ebfac33751be5e6806" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" dependencies = [ "clap_builder", "clap_derive", @@ -399,9 +402,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.58" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f13174bda5dfd69d7e947827e5af4b0f2f94a4a3ee92912fba07a66150f21e2" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ "anstream", "anstyle", @@ -411,21 +414,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.55" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] name = "clap_lex" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "color-eyre" @@ -456,9 +459,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "compact_str" @@ -471,6 +474,7 @@ dependencies = [ "itoa", "rustversion", "ryu", + "serde", "static_assertions", ] @@ -513,20 +517,38 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "crossterm" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" +dependencies = [ + "bitflags 2.11.1", + "crossterm_winapi", + "mio", + "parking_lot", + "rustix 0.38.44", + "serde", + "signal-hook", + "signal-hook-mio", + "winapi", +] + [[package]] name = "crossterm" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.1", "crossterm_winapi", "derive_more", "document-features", "futures-core", "mio", "parking_lot", - "rustix", + "rustix 1.1.4", + "serde", "signal-hook", "signal-hook-mio", "winapi", @@ -581,7 +603,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -592,7 +614,7 @@ checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -603,9 +625,9 @@ checksum = "5729f5117e208430e437df2f4843f5e5952997175992d1414f94c57d61e270b4" [[package]] name = "deranged" -version = "0.5.6" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc3dc5ad92c2e2d1c193bbbbdf2ea477cb81331de4f3103f267ca18368b988c4" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", ] @@ -629,7 +651,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -674,9 +696,9 @@ dependencies = [ [[package]] name = "either" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" [[package]] name = "endi" @@ -702,14 +724,14 @@ checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] name = "env_filter" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f" +checksum = "32e90c2accc4b07a8456ea0debdc2e7587bdd890680d71173a15d4ae604f6eef" dependencies = [ "log", "regex", @@ -717,9 +739,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.9" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2daee4ea451f429a58296525ddf28b45a3b64f1acf6587e2067437bb11e218d" +checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a" dependencies = [ "anstream", "anstyle", @@ -746,9 +768,9 @@ dependencies = [ [[package]] name = "euclid" -version = "0.22.13" +version = "0.22.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df61bf483e837f88d5c2291dcf55c67be7e676b3a51acc48db3a7b163b91ed63" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" dependencies = [ "num-traits", ] @@ -796,9 +818,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.3.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" [[package]] name = "filedescriptor" @@ -849,9 +871,9 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "futures" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -864,9 +886,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -874,15 +896,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" dependencies = [ "futures-core", "futures-task", @@ -891,9 +913,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-lite" @@ -910,32 +932,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -945,7 +967,6 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] @@ -978,19 +999,19 @@ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "r-efi", + "r-efi 5.3.0", "wasip2", ] [[package]] name = "getrandom" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" dependencies = [ "cfg-if", "libc", - "r-efi", + "r-efi 6.0.0", "wasip2", "wasip3", ] @@ -1021,6 +1042,12 @@ dependencies = [ "foldhash 0.2.0", ] +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + [[package]] name = "heck" version = "0.5.0" @@ -1077,9 +1104,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "image" -version = "0.25.9" +version = "0.25.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" dependencies = [ "bytemuck", "byteorder-lite", @@ -1095,7 +1122,7 @@ dependencies = [ "async-channel", "chrono", "clap", - "crossterm", + "crossterm 0.29.0", "dirs", "env_logger", "futures", @@ -1106,8 +1133,8 @@ dependencies = [ "qrcode", "ratatui", "serde", - "strum", - "strum_macros", + "strum 0.28.0", + "strum_macros 0.28.0", "tokio", "toml", "tui-input", @@ -1122,12 +1149,12 @@ checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" [[package]] name = "indexmap" -version = "2.13.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown 0.16.1", + "hashbrown 0.17.1", "serde", "serde_core", ] @@ -1143,15 +1170,15 @@ dependencies = [ [[package]] name = "instability" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357b7205c6cd18dd2c86ed312d1e70add149aea98e7ef72b9fdf0270e555c11d" +checksum = "5eb2d60ef19920a3a9193c3e371f726ec1dafc045dac788d0fb3704272458971" dependencies = [ "darling", "indoc", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -1171,18 +1198,19 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "iwdrs" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2995175b0607f73574de8fe2d2ed70a08ef93d146c74327fe33e61e2b05bbb8" +checksum = "cd997a73fba4ae7ff3c549f88e67315b2aa2806abee28b63854024cc0121cb3c" dependencies = [ + "async-lock", "futures-lite", - "strum", + "strum 0.28.0", "thiserror 2.0.18", "uuid", "zbus", @@ -1191,9 +1219,9 @@ dependencies = [ [[package]] name = "jiff" -version = "0.2.20" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c867c356cc096b33f4981825ab281ecba3db0acefe60329f044c1789d94c6543" +checksum = "f00b5dbd620d61dfdcb6007c9c1f6054ebd75319f163d886a9055cec1155073d" dependencies = [ "jiff-static", "log", @@ -1204,30 +1232,32 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.20" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7946b4325269738f270bb55b3c19ab5c5040525f83fd625259422a9d25d9be5" +checksum = "e000de030ff8022ea1da3f466fbb0f3a809f5e51ed31f6dd931c35181ad8e6d7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] name = "js-sys" -version = "0.3.85" +version = "0.3.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08" dependencies = [ + "cfg-if", + "futures-util", "once_cell", "wasm-bindgen", ] [[package]] name = "kasuari" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe90c1150662e858c7d5f945089b7517b0a80d8bf7ba4b1b5ffc984e7230a5b" +checksum = "bde5057d6143cc94e861d90f591b9303d6716c6b9602309150bd068853c10899" dependencies = [ "hashbrown 0.16.1", "portable-atomic", @@ -1254,34 +1284,39 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.182" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "libredox" -version = "0.1.12" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" dependencies = [ - "bitflags 2.10.0", "libc", ] [[package]] name = "line-clipping" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4de44e98ddbf09375cbf4d17714d18f39195f4f4894e8524501726fd9a8a4a" +checksum = "3f50e8f47623268b5407192d26876c4d7f89d686ca130fdc53bced4814cd29f8" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.1", ] [[package]] name = "linux-raw-sys" -version = "0.11.0" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litrs" @@ -1306,9 +1341,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lru" -version = "0.16.3" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593" +checksum = "7f66e8d5d03f609abc3a39e6f08e4164ebf1447a732906d39eb9b99b7919ef39" dependencies = [ "hashbrown 0.16.1", ] @@ -1361,9 +1396,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" dependencies = [ "libc", "log", @@ -1373,9 +1408,9 @@ dependencies = [ [[package]] name = "moxcms" -version = "0.7.11" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac9557c559cd6fc9867e122e20d2cbefc9ca29d80d027a8e39310920ed2f0a97" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" dependencies = [ "num-traits", "pxfm", @@ -1387,7 +1422,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.1", "cfg-if", "cfg_aliases", "libc", @@ -1406,9 +1441,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] name = "num-derive" @@ -1418,7 +1453,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -1439,6 +1474,12 @@ dependencies = [ "libc", ] +[[package]] +name = "numtoa" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aa2c4e539b869820a2b82e1aef6ff40aa85e65decdd5185e83fb4b1249cd00f" + [[package]] name = "object" version = "0.37.3" @@ -1450,9 +1491,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "once_cell_polyfill" @@ -1487,9 +1528,9 @@ dependencies = [ [[package]] name = "owo-colors" -version = "4.2.3" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d" [[package]] name = "parking" @@ -1550,7 +1591,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -1603,7 +1644,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -1617,21 +1658,15 @@ dependencies = [ [[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" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "piper" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" dependencies = [ "atomic-waker", "fastrand", @@ -1648,7 +1683,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix", + "rustix 1.1.4", "windows-sys 0.61.2", ] @@ -1660,9 +1695,9 @@ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" +checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" dependencies = [ "portable-atomic", ] @@ -1680,14 +1715,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] name = "proc-macro-crate" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ "toml_edit", ] @@ -1703,12 +1738,9 @@ dependencies = [ [[package]] name = "pxfm" -version = "0.1.27" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7186d3822593aa4393561d186d1393b3923e9d6163d3fbfd6e825e3e6cf3e6a8" -dependencies = [ - "num-traits", -] +checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f" [[package]] name = "qrcode" @@ -1721,9 +1753,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.44" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] @@ -1734,11 +1766,17 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rand" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" dependencies = [ "rand_core", ] @@ -1759,8 +1797,10 @@ dependencies = [ "ratatui-core", "ratatui-crossterm", "ratatui-macros", + "ratatui-termion", "ratatui-termwiz", "ratatui-widgets", + "serde", ] [[package]] @@ -1769,14 +1809,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ef8dea09a92caaf73bff7adb70b76162e5937524058a7e5bff37869cbbec293" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.1", "compact_str", "hashbrown 0.16.1", "indoc", "itertools", "kasuari", "lru", - "strum", + "serde", + "strum 0.27.2", "thiserror 2.0.18", "unicode-segmentation", "unicode-truncate", @@ -1790,7 +1831,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "577c9b9f652b4c121fb25c6a391dd06406d3b092ba68827e6d2f09550edc54b3" dependencies = [ "cfg-if", - "crossterm", + "crossterm 0.28.1", + "crossterm 0.29.0", "instability", "ratatui-core", ] @@ -1805,6 +1847,17 @@ dependencies = [ "ratatui-widgets", ] +[[package]] +name = "ratatui-termion" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cade85a8591fbc911e147951422f0d6fd40f4948b271b6216c7dc01838996f8" +dependencies = [ + "instability", + "ratatui-core", + "termion", +] + [[package]] name = "ratatui-termwiz" version = "0.1.0" @@ -1821,14 +1874,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7dbfa023cd4e604c2553483820c5fe8aa9d71a42eea5aa77c6e7f35756612db" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.1", "hashbrown 0.16.1", "indoc", "instability", "itertools", "line-clipping", "ratatui-core", - "strum", + "serde", + "strum 0.27.2", "time", "unicode-segmentation", "unicode-width", @@ -1840,7 +1894,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.1", ] [[package]] @@ -1879,9 +1933,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rustc-demangle" @@ -1900,14 +1954,27 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.3" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.11.1", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.1", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.12.1", "windows-sys 0.61.2", ] @@ -1931,9 +1998,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" @@ -1962,7 +2029,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -1986,14 +2053,14 @@ checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] name = "serde_spanned" -version = "1.0.4" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" dependencies = [ "serde_core", ] @@ -2057,9 +2124,9 @@ dependencies = [ [[package]] name = "siphasher" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" [[package]] name = "slab" @@ -2075,12 +2142,12 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -2101,7 +2168,16 @@ version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" dependencies = [ - "strum_macros", + "strum_macros 0.27.2", +] + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros 0.28.0", ] [[package]] @@ -2113,7 +2189,19 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.117", ] [[package]] @@ -2129,9 +2217,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.115" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e614ed320ac28113fa64972c4262d5dbc89deacdfd00c34a3e4cea073243c12" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -2140,14 +2228,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.25.0" +version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.4.1", + "getrandom 0.4.2", "once_cell", - "rustix", + "rustix 1.1.4", "windows-sys 0.61.2", ] @@ -2163,6 +2251,17 @@ dependencies = [ "phf_codegen", ] +[[package]] +name = "termion" +version = "4.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f44138a9ae08f0f502f24104d82517ef4da7330c35acd638f1f29d3cd5475ecb" +dependencies = [ + "libc", + "numtoa", + "serde", +] + [[package]] name = "termios" version = "0.3.3" @@ -2180,7 +2279,7 @@ checksum = "4676b37242ccbd1aabf56edb093a4827dc49086c0ffd764a5705899e0f35f8f7" dependencies = [ "anyhow", "base64", - "bitflags 2.10.0", + "bitflags 2.11.1", "fancy-regex", "filedescriptor", "finl_unicode", @@ -2197,6 +2296,7 @@ dependencies = [ "pest", "pest_derive", "phf", + "serde", "sha2", "signal-hook", "siphasher", @@ -2240,7 +2340,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -2251,7 +2351,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -2286,9 +2386,9 @@ checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "tokio" -version = "1.49.0" +version = "1.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" dependencies = [ "bytes", "libc", @@ -2303,25 +2403,25 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] name = "toml" -version = "1.0.1+spec-1.1.0" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe30f93627849fa362d4a602212d41bb237dc2bd0f8ba0b2ce785012e124220" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" dependencies = [ "indexmap", "serde_core", "serde_spanned", - "toml_datetime 1.0.0+spec-1.1.0", + "toml_datetime", "toml_parser", "toml_writer", "winnow", @@ -2329,48 +2429,39 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_datetime" -version = "1.0.0+spec-1.1.0" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.23.10+spec-1.0.0" +version = "0.25.11+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" +checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" dependencies = [ "indexmap", - "toml_datetime 0.7.5+spec-1.1.0", + "toml_datetime", "toml_parser", "winnow", ] [[package]] name = "toml_parser" -version = "1.0.8+spec-1.1.0" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0742ff5ff03ea7e67c8ae6c93cac239e0d9784833362da3f9a9c1da8dfefcbdc" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ "winnow", ] [[package]] name = "toml_writer" -version = "1.0.6+spec-1.1.0" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" [[package]] name = "tracing" @@ -2391,7 +2482,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -2416,9 +2507,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ "sharded-slab", "thread_local", @@ -2427,19 +2518,20 @@ dependencies = [ [[package]] name = "tui-input" -version = "0.15.0" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c1ee964298f136020f5f69e0e601f4d3a1f610a7baf1af9fcb96152e8a2c45" +checksum = "0bd014a652e31cf25ea68d11b10a7b09549863449b19387505c9933f11eb05fa" dependencies = [ - "crossterm", + "crossterm 0.29.0", + "unicode-segmentation", "unicode-width", ] [[package]] name = "tui-qrcode" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f655a1caed301ef718cf24a83373e3c4840e2d51b91c266925284f17327fbe" +checksum = "671a8f22484c5b43bfb4ab90bfa52a81d823c05ee9ae321e5c6b2fefad4bfcb9" dependencies = [ "color-eyre", "qrcode", @@ -2448,9 +2540,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" [[package]] name = "ucd-trie" @@ -2460,26 +2552,26 @@ checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "uds_windows" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" dependencies = [ "memoffset", "tempfile", - "winapi", + "windows-sys 0.61.2", ] [[package]] name = "unicode-ident" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-segmentation" -version = "1.12.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" [[package]] name = "unicode-truncate" @@ -2512,12 +2604,12 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.20.0" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" +checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76" dependencies = [ "atomic", - "getrandom 0.3.4", + "getrandom 0.4.2", "js-sys", "serde_core", "wasm-bindgen", @@ -2552,11 +2644,11 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" -version = "1.0.2+wasi-0.2.9" +version = "1.0.3+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.57.1", ] [[package]] @@ -2565,14 +2657,14 @@ version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.51.0", ] [[package]] name = "wasm-bindgen" -version = "0.2.108" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790" dependencies = [ "cfg-if", "once_cell", @@ -2583,9 +2675,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.108" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2593,22 +2685,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.108" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.108" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441" dependencies = [ "unicode-ident", ] @@ -2641,7 +2733,7 @@ version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.1", "hashbrown 0.15.5", "indexmap", "semver", @@ -2665,6 +2757,7 @@ checksum = "692daff6d93d94e29e4114544ef6d5c942a7ed998b37abdc19b17136ea428eb7" dependencies = [ "getrandom 0.3.4", "mac_address", + "serde", "sha2", "thiserror 1.0.69", "uuid", @@ -2679,6 +2772,7 @@ dependencies = [ "csscolorparser", "deltae", "lazy_static", + "serde", "wezterm-dynamic", ] @@ -2762,7 +2856,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -2773,7 +2867,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", ] [[package]] @@ -2802,9 +2896,9 @@ dependencies = [ [[package]] name = "windows-sys" -version = "0.60.2" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets", ] @@ -2820,11 +2914,10 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows-link", "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", @@ -2837,57 +2930,57 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.53.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.53.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.53.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.53.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.53.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.53.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.53.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.53.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.14" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" dependencies = [ "memchr", ] @@ -2901,6 +2994,12 @@ dependencies = [ "wit-bindgen-rust-macro", ] +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + [[package]] name = "wit-bindgen-core" version = "0.51.0" @@ -2922,7 +3021,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn 2.0.115", + "syn 2.0.117", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2938,7 +3037,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -2950,7 +3049,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", - "bitflags 2.10.0", + "bitflags 2.11.1", "indexmap", "log", "serde", @@ -2982,9 +3081,9 @@ dependencies = [ [[package]] name = "zbus" -version = "5.13.2" +version = "5.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfeff997a0aaa3eb20c4652baf788d2dfa6d2839a0ead0b3ff69ce2f9c4bdd1" +checksum = "c3bcbf15c8708d7fc1be0c993622e0a5cbd5e8b52bfa40afa4c3e0cd8d724ac1" dependencies = [ "async-broadcast", "async-executor", @@ -3002,7 +3101,7 @@ dependencies = [ "hex", "libc", "ordered-stream", - "rustix", + "rustix 1.1.4", "serde", "serde_repr", "tracing", @@ -3017,14 +3116,14 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "5.13.2" +version = "5.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bbd5a90dbe8feee5b13def448427ae314ccd26a49cac47905cafefb9ff846f1" +checksum = "51fa5406ad9175a8c825a931f8cf347116b531b3634fcb0b627c290f1f2516ff" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", "zbus_names", "zvariant", "zvariant_utils", @@ -3032,9 +3131,9 @@ dependencies = [ [[package]] name = "zbus_names" -version = "4.3.1" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffd8af6d5b78619bab301ff3c560a5bd22426150253db278f164d6cf3b72c50f" +checksum = "7074f3e50b894eac91750142016d30d0a89be8e67dbfd9704fb875825760e52d" dependencies = [ "serde", "winnow", @@ -3049,9 +3148,9 @@ checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" [[package]] name = "zvariant" -version = "5.9.2" +version = "5.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b64ef4f40c7951337ddc7023dd03528a57a3ce3408ee9da5e948bd29b232c4" +checksum = "1c1567a6ec68df868cbbfde844cfc6d81649fe5109a62b116b19fabd53e618ee" dependencies = [ "endi", "enumflags2", @@ -3063,26 +3162,26 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "5.9.2" +version = "5.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "484d5d975eb7afb52cc6b929c13d3719a20ad650fea4120e6310de3fc55e415c" +checksum = "c7d5b780599bbde114e39d9a0799577fad1ced5105d38515745f7b3099d8ceda" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.117", "zvariant_utils", ] [[package]] name = "zvariant_utils" -version = "3.3.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75c23a64ef8f40f13a6989991e643554d9bef1d682a281160cf0c1bc389c5e9" +checksum = "6d464f5733ffa07a3164d656f18533caace9d0638596721355d73256a410d691" dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.115", + "syn 2.0.117", "winnow", ] diff --git a/Cargo.toml b/Cargo.toml index 0c51ba8..c10d574 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ async-channel = "2" crossterm = { version = "0.29", default-features = false, features = [ "event-stream", ] } -ratatui = "0.30" +ratatui = { version = "0.30", features = ["serde"] } tui-input = { version = "0.15", features = [ "crossterm", ], default-features = false } @@ -29,8 +29,8 @@ iwdrs = "0.2.6" chrono = "0.4" log = "0.4" env_logger = "0.11" -strum = { version = "0.27.2", features = ["derive"] } -strum_macros = "0.27" +strum = { version = "0.28", features = ["derive"] } +strum_macros = "0.28" libc = "0.2" hex = "0.4.3" tui-qrcode = "0.2.2" diff --git a/Readme.md b/Readme.md index 6eaac5e..4b46fe3 100644 --- a/Readme.md +++ b/Readme.md @@ -68,9 +68,9 @@ This will produce an executable file at `target/release/impala` that you can cop $ impala ``` -## 🛠️Custom keybindings +## 🛠️Custom keybindings and themes -Keybindings can be customized in the config file `$HOME/.config/impala/config.toml` +Keybindings and themes can be customized in the config file `$HOME/.config/impala/config.toml` ```toml @@ -98,6 +98,15 @@ share = "p" [station.new_network] show_all = "a" connect_hidden = "" + +[theme] +background = "dark gray" +border = "green" +text_color = "white" +hidden_color = "dark gray" +info_color = "green" +warning_color = "yellow" +error_color = "red" ``` ## Contributing diff --git a/src/adapter.rs b/src/adapter.rs index f72521f..ea0684b 100644 --- a/src/adapter.rs +++ b/src/adapter.rs @@ -7,7 +7,7 @@ use iwdrs::{adapter::Adapter as iwdAdapter, session::Session}; use ratatui::{ Frame, layout::{Alignment, Constraint, Direction, Flex, Layout}, - style::{Color, Style}, + style::Style, widgets::{Block, BorderType, Borders, Cell, Clear, Padding, Row, Table}, }; @@ -54,7 +54,7 @@ impl Adapter { Ok(()) } - pub fn render(&self, frame: &mut Frame, device_addr: String) { + pub fn render(&self, frame: &mut Frame, device_addr: String, config: Arc) { let popup_layout = Layout::default() .direction(ratatui::layout::Direction::Vertical) .constraints([ @@ -113,11 +113,15 @@ impl Adapter { .title_alignment(Alignment::Center) .padding(Padding::uniform(1)) .borders(Borders::ALL) - .border_style(Style::default().fg(Color::Green)) + .border_style(Style::default().fg(config.theme.border)) .border_type(BorderType::Thick), ) .column_spacing(3) - .row_highlight_style(Style::default().bg(Color::DarkGray).fg(Color::White)); + .row_highlight_style( + Style::default() + .bg(config.theme.background) + .fg(config.theme.text_color), + ); frame.render_widget(Clear, area); frame.render_widget(device_infos_table, area); diff --git a/src/config.rs b/src/config.rs index 2748089..72a7237 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,3 +1,4 @@ +use ratatui::style::Color; use toml; use dirs; @@ -22,6 +23,9 @@ pub struct Config { #[serde(default)] pub ap: AccessPoint, + + #[serde(default)] + pub theme: Theme, } fn default_switch_mode() -> char { @@ -150,6 +154,73 @@ fn default_ap_stop() -> char { 'x' } +// Theme +#[derive(Deserialize, Debug)] +pub struct Theme { + #[serde(default = "default_background")] + pub background: Color, + + #[serde(default = "default_border")] + pub border: Color, + + #[serde(default = "default_text_color")] + pub text_color: Color, + + #[serde(default = "default_hidden_color")] + pub hidden_color: Color, + + #[serde(default = "default_info_color")] + pub info_color: Color, + + #[serde(default = "default_warning_color")] + pub warning_color: Color, + + #[serde(default = "default_error_color")] + pub error_color: Color, +} + +fn default_background() -> Color { + Color::DarkGray +} + +fn default_border() -> Color { + Color::Green +} + +fn default_text_color() -> Color { + Color::White +} + +fn default_hidden_color() -> Color { + Color::DarkGray +} + +fn default_info_color() -> Color { + Color::Green +} + +fn default_warning_color() -> Color { + Color::Yellow +} + +fn default_error_color() -> Color { + Color::Red +} + +impl Default for Theme { + fn default() -> Self { + Self { + background: default_background(), + border: default_border(), + text_color: default_text_color(), + hidden_color: default_hidden_color(), + info_color: default_info_color(), + warning_color: default_warning_color(), + error_color: default_error_color(), + } + } +} + impl Config { pub fn new() -> Self { let conf_path = dirs::config_dir() diff --git a/src/device.rs b/src/device.rs index f390174..91f2922 100644 --- a/src/device.rs +++ b/src/device.rs @@ -7,7 +7,7 @@ use iwdrs::{device::Device as iwdDevice, modes::Mode, session::Session}; use ratatui::{ Frame, layout::{Constraint, Direction, Flex, Layout}, - style::{Color, Style, Stylize}, + style::{Style, Stylize}, text::{Line, Span}, widgets::{Block, BorderType, Borders, Padding, Row, Table, TableState}, }; @@ -147,13 +147,17 @@ impl Device { .title(" Device ") .title_style(Style::default().bold()) .borders(Borders::ALL) - .border_style(Style::default().fg(Color::Green)) + .border_style(Style::default().fg(config.theme.border)) .border_type(BorderType::Thick) .padding(Padding::horizontal(1)), ) .column_spacing(1) .flex(Flex::SpaceAround) - .row_highlight_style(Style::default().bg(Color::DarkGray).fg(Color::White)); + .row_highlight_style( + Style::default() + .bg(config.theme.background) + .fg(config.theme.text_color), + ); let mut device_state = TableState::default().with_selected(0); frame.render_stateful_widget(device_table, device_block, &mut device_state); diff --git a/src/event.rs b/src/event.rs index d7bc432..df7e0b8 100644 --- a/src/event.rs +++ b/src/event.rs @@ -54,11 +54,10 @@ impl EventHandler { } Some(Ok(evt)) = crossterm_event => { match evt { - CrosstermEvent::Key(key) => { - if key.kind == crossterm::event::KeyEventKind::Press { + CrosstermEvent::Key(key) + if key.kind == crossterm::event::KeyEventKind::Press => { sender_cloned.send(Event::Key(key)).unwrap(); - } - }, + }, CrosstermEvent::Resize(x, y) => { sender_cloned.send(Event::Resize(x, y)).unwrap(); }, diff --git a/src/handler.rs b/src/handler.rs index 9be3b0f..aac1cf8 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -165,22 +165,16 @@ pub async fn handle_key_events( KeyCode::Esc if app.config.esc_quit => { app.quit(); } - KeyCode::Char('c' | 'C') => { - if key_event.modifiers == KeyModifiers::CONTROL { - app.quit(); - } + KeyCode::Char('c' | 'C') if key_event.modifiers == KeyModifiers::CONTROL => { + app.quit(); } - KeyCode::Char('j') | KeyCode::Down => { - if app.reset.selected_mode == Mode::Station { - app.reset.selected_mode = Mode::Ap; - } + KeyCode::Char('j') | KeyCode::Down if app.reset.selected_mode == Mode::Station => { + app.reset.selected_mode = Mode::Ap; } - KeyCode::Char('k') | KeyCode::Up => { - if app.reset.selected_mode == Mode::Ap { - app.reset.selected_mode = Mode::Station; - } + KeyCode::Char('k') | KeyCode::Up if app.reset.selected_mode == Mode::Ap => { + app.reset.selected_mode = Mode::Station; } KeyCode::Enter => { @@ -194,10 +188,8 @@ pub async fn handle_key_events( if !app.device.is_powered { match app.focused_block { - FocusedBlock::AdapterInfos => { - if key_event.code == KeyCode::Esc { - app.focused_block = FocusedBlock::Device; - } + FocusedBlock::AdapterInfos if key_event.code == KeyCode::Esc => { + app.focused_block = FocusedBlock::Device; } FocusedBlock::Device => match key_event.code { @@ -208,10 +200,8 @@ pub async fn handle_key_events( app.quit(); } - KeyCode::Char('c' | 'C') => { - if key_event.modifiers == KeyModifiers::CONTROL { - app.quit(); - } + KeyCode::Char('c' | 'C') if key_event.modifiers == KeyModifiers::CONTROL => { + app.quit(); } KeyCode::Char(c) if c == config.device.infos => { @@ -530,41 +520,39 @@ pub async fn handle_key_events( } // Scroll down - KeyCode::Char('j') | KeyCode::Down => { - if !station.known_networks.is_empty() { - let i = - match station.known_networks_state.selected() { - Some(i) => { - let limit = if station - .show_unavailable_known_networks - { - station.known_networks.len() - + station - .unavailable_known_networks - .len() - - 1 - } else { - station.known_networks.len() - 1 - }; - - if i < limit { i + 1 } else { i } - } - None => 0, + KeyCode::Char('j') | KeyCode::Down + if !station.known_networks.is_empty() => + { + let i = match station.known_networks_state.selected() { + Some(i) => { + let limit = if station + .show_unavailable_known_networks + { + station.known_networks.len() + + station + .unavailable_known_networks + .len() + - 1 + } else { + station.known_networks.len() - 1 }; - station.known_networks_state.select(Some(i)); - } + if i < limit { i + 1 } else { i } + } + None => 0, + }; + + station.known_networks_state.select(Some(i)); } - KeyCode::Char('k') | KeyCode::Up => { - if !station.known_networks.is_empty() { - let i = - match station.known_networks_state.selected() { - Some(i) => i.saturating_sub(1), - None => 0, - }; + KeyCode::Char('k') | KeyCode::Up + if !station.known_networks.is_empty() => + { + let i = match station.known_networks_state.selected() { + Some(i) => i.saturating_sub(1), + None => 0, + }; - station.known_networks_state.select(Some(i)); - } + station.known_networks_state.select(Some(i)); } _ => {} } @@ -587,34 +575,34 @@ pub async fn handle_key_events( KeyCode::Enter | KeyCode::Char(' ') => { toggle_connect(app, sender).await? } - KeyCode::Char('j') | KeyCode::Down => { - if !station.new_networks.is_empty() { - let i = match station.new_networks_state.selected() { - Some(i) => { - let limit = if station.show_hidden_networks { - station.new_networks.len() - + station.new_hidden_networks.len() - - 1 - } else { - station.new_networks.len() - 1 - }; - if i < limit { i + 1 } else { i } - } - None => 0, - }; + KeyCode::Char('j') | KeyCode::Down + if !station.new_networks.is_empty() => + { + let i = match station.new_networks_state.selected() { + Some(i) => { + let limit = if station.show_hidden_networks { + station.new_networks.len() + + station.new_hidden_networks.len() + - 1 + } else { + station.new_networks.len() - 1 + }; + if i < limit { i + 1 } else { i } + } + None => 0, + }; - station.new_networks_state.select(Some(i)); - } + station.new_networks_state.select(Some(i)); } - KeyCode::Char('k') | KeyCode::Up => { - if !station.new_networks.is_empty() { - let i = match station.new_networks_state.selected() { - Some(i) => i.saturating_sub(1), - None => 0, - }; + KeyCode::Char('k') | KeyCode::Up + if !station.new_networks.is_empty() => + { + let i = match station.new_networks_state.selected() { + Some(i) => i.saturating_sub(1), + None => 0, + }; - station.new_networks_state.select(Some(i)); - } + station.new_networks_state.select(Some(i)); } _ => {} }, @@ -634,7 +622,7 @@ pub async fn handle_key_events( FocusedBlock::AccessPointInput => match key_event.code { KeyCode::Enter => { ap.start(sender.clone()).await?; - app.focused_block = FocusedBlock::Device; + app.focused_block = FocusedBlock::AccessPoint; } KeyCode::Esc => { @@ -709,6 +697,20 @@ pub async fn handle_key_events( _ => {} }, + KeyCode::Char(c) if c == config.ap.start => { + if app.focused_block == FocusedBlock::AccessPoint { + ap.ap_start + .store(true, std::sync::atomic::Ordering::Relaxed); + app.focused_block = FocusedBlock::AccessPointInput; + } + } + + KeyCode::Char(c) if c == config.ap.stop => { + if app.focused_block == FocusedBlock::AccessPoint { + ap.stop(sender.clone()).await?; + } + } + _ => { if app.focused_block == FocusedBlock::Device { match key_event.code { diff --git a/src/mode/ap.rs b/src/mode/ap.rs index 8489ecf..e7e133e 100644 --- a/src/mode/ap.rs +++ b/src/mode/ap.rs @@ -7,7 +7,7 @@ use tokio::sync::mpsc::UnboundedSender; use ratatui::{ Frame, layout::{Alignment, Constraint, Direction, Flex, Layout}, - style::{Color, Style, Stylize}, + style::{Style, Stylize}, text::{Line, Span, Text}, widgets::{ Block, BorderType, Borders, Clear, List, Padding, Paragraph, Row, Table, TableState, @@ -96,7 +96,7 @@ impl AccessPoint { }) } - pub fn render_input(&self, frame: &mut Frame) { + pub fn render_input(&self, frame: &mut Frame, config: Arc) { let popup_layout = Layout::default() .direction(Direction::Vertical) .constraints( @@ -180,23 +180,23 @@ impl AccessPoint { let ssid_msg = Paragraph::new(ssid_text) .alignment(Alignment::Left) - .style(Style::default().fg(Color::White)) + .style(Style::default().fg(config.theme.text_color)) .block(Block::new().padding(Padding::left(2))); let ssid_input = Paragraph::new(self.ssid.value()) .alignment(Alignment::Center) - .style(Style::default().fg(Color::White)) - .block(Block::new().style(Style::default().bg(Color::DarkGray))); + .style(Style::default().fg(config.theme.text_color)) + .block(Block::new().style(Style::default().bg(config.theme.background))); let psk_msg = Paragraph::new(psk_text) .alignment(Alignment::Left) - .style(Style::default().fg(Color::White)) + .style(Style::default().fg(config.theme.text_color)) .block(Block::new().padding(Padding::left(2))); let psk_input = Paragraph::new(self.psk.value()) .alignment(Alignment::Center) - .style(Style::default().fg(Color::White)) - .block(Block::new().style(Style::default().bg(Color::DarkGray))); + .style(Style::default().fg(config.theme.text_color)) + .block(Block::new().style(Style::default().bg(config.theme.background))); frame.render_widget(Clear, area); @@ -204,8 +204,7 @@ impl AccessPoint { Block::new() .borders(Borders::ALL) .border_type(BorderType::Thick) - .style(Style::default().green()) - .border_style(Style::default().fg(Color::Green)), + .style(Style::default().fg(config.theme.border)), area, ); frame.render_widget(ssid_msg, ssid_msg_area); @@ -391,7 +390,7 @@ impl AccessPoint { .padding(Padding::horizontal(1)) .border_style({ if focused_block == FocusedBlock::Device { - Style::default().fg(Color::Green) + Style::default().fg(config.theme.border) } else { Style::default() } @@ -407,7 +406,9 @@ impl AccessPoint { .column_spacing(2) .flex(Flex::SpaceAround) .row_highlight_style(if focused_block == FocusedBlock::Device { - Style::default().bg(Color::DarkGray).fg(Color::White) + Style::default() + .bg(config.theme.background) + .fg(config.theme.text_color) } else { Style::default() }); @@ -495,7 +496,7 @@ impl AccessPoint { .borders(Borders::ALL) .border_style({ if focused_block == FocusedBlock::AccessPoint { - Style::default().fg(Color::Green) + Style::default().fg(config.theme.border) } else { Style::default() } @@ -512,7 +513,9 @@ impl AccessPoint { .column_spacing(2) .flex(Flex::SpaceAround) .row_highlight_style(if focused_block == FocusedBlock::AccessPoint { - Style::default().bg(Color::DarkGray).fg(Color::White) + Style::default() + .bg(config.theme.background) + .fg(config.theme.text_color) } else { Style::default() }); @@ -540,7 +543,7 @@ impl AccessPoint { .borders(Borders::ALL) .border_style({ if focused_block == FocusedBlock::AccessPointConnectedDevices { - Style::default().fg(Color::Green) + Style::default().fg(config.theme.border) } else { Style::default() } diff --git a/src/mode/station.rs b/src/mode/station.rs index d8b9c4b..59c2f81 100644 --- a/src/mode/station.rs +++ b/src/mode/station.rs @@ -17,7 +17,7 @@ use iwdrs::{ use ratatui::{ Frame, layout::{Constraint, Direction, Flex, Layout}, - style::{Color, Style, Stylize}, + style::{Style, Stylize}, text::{Line, Span}, widgets::{Block, BorderType, Borders, Padding, Paragraph, Row, Table, TableState}, }; @@ -457,7 +457,7 @@ impl Station { .borders(Borders::ALL) .border_style({ if focused_block == FocusedBlock::Device { - Style::default().fg(Color::Green) + Style::default().fg(config.theme.border) } else { Style::default() } @@ -474,7 +474,9 @@ impl Station { .column_spacing(1) .flex(Flex::SpaceAround) .row_highlight_style(if focused_block == FocusedBlock::Device { - Style::default().bg(Color::DarkGray).fg(Color::White) + Style::default() + .bg(config.theme.background) + .fg(config.theme.text_color) } else { Style::default() }); @@ -547,7 +549,7 @@ impl Station { Line::from(""), Line::from(""), ]) - .fg(Color::DarkGray); + .fg(config.theme.hidden_color); rows.push(row); }); @@ -600,7 +602,7 @@ impl Station { .borders(Borders::ALL) .border_style({ if focused_block == FocusedBlock::KnownNetworks { - Style::default().fg(Color::Green) + Style::default().fg(config.theme.border) } else { Style::default() } @@ -617,7 +619,9 @@ impl Station { .column_spacing(1) .flex(Flex::SpaceAround) .row_highlight_style(if focused_block == FocusedBlock::KnownNetworks { - Style::default().bg(Color::DarkGray).fg(Color::White) + Style::default() + .bg(config.theme.background) + .fg(config.theme.text_color) } else { Style::default() }); @@ -681,7 +685,7 @@ impl Station { }) .centered(), ]) - .dark_gray(), + .fg(config.theme.hidden_color), ) }) }; @@ -724,7 +728,7 @@ impl Station { .borders(Borders::ALL) .border_style({ if focused_block == FocusedBlock::NewNetworks { - Style::default().fg(Color::Green) + Style::default().fg(config.theme.border) } else { Style::default() } @@ -741,7 +745,9 @@ impl Station { .column_spacing(1) .flex(Flex::SpaceAround) .row_highlight_style(if focused_block == FocusedBlock::NewNetworks { - Style::default().bg(Color::DarkGray).fg(Color::White) + Style::default() + .bg(config.theme.background) + .fg(config.theme.text_color) } else { Style::default() }); @@ -766,7 +772,7 @@ impl Station { Span::from("ctrl+r").bold(), Span::from(" Switch Mode"), Span::from(" | "), - Span::from("⇄").bold(), + Span::from("tab").bold(), Span::from(" Nav"), ])], FocusedBlock::KnownNetworks => { @@ -795,7 +801,7 @@ impl Station { Span::from("j,").bold(), Span::from(" Down"), Span::from(" | "), - Span::from("⇄").bold(), + Span::from("tab").bold(), Span::from(" Nav"), Span::from(" | "), Span::from("ctrl+r").bold(), @@ -836,7 +842,7 @@ impl Station { Span::from("ctrl+r").bold(), Span::from(" Switch Mode"), Span::from(" | "), - Span::from("⇄").bold(), + Span::from("tab").bold(), Span::from(" Nav"), ])] } @@ -865,7 +871,7 @@ impl Station { Span::from("ctrl+r").bold(), Span::from(" Switch Mode"), Span::from(" | "), - Span::from("⇄").bold(), + Span::from("tab").bold(), Span::from(" Nav"), ]), ] @@ -892,7 +898,7 @@ impl Station { Span::from("ctrl+r").bold(), Span::from(" Switch Mode"), Span::from(" | "), - Span::from("⇄").bold(), + Span::from("tab").bold(), Span::from(" Nav"), ])] } @@ -907,7 +913,7 @@ impl Station { Span::from(" ↵ ").bold(), Span::from(" Apply"), Span::from(" | "), - Span::from("⇄").bold(), + Span::from("tab").bold(), Span::from(" Hide/Show password"), Span::from(" | "), Span::from("󱊷 ").bold(), @@ -923,7 +929,7 @@ impl Station { Span::from("󱊷 ").bold(), Span::from(" Discard"), Span::from(" | "), - Span::from("⇄").bold(), + Span::from("tab").bold(), Span::from(" Nav"), ])], FocusedBlock::ConnectHiddenNetwork => { @@ -947,7 +953,7 @@ impl Station { // Share if let Some(share) = &self.share { - share.render(frame); + share.render(frame, config.clone()); } } } diff --git a/src/mode/station/auth/entreprise.rs b/src/mode/station/auth/entreprise.rs index 3d6738d..e3c71ef 100644 --- a/src/mode/station/auth/entreprise.rs +++ b/src/mode/station/auth/entreprise.rs @@ -8,9 +8,10 @@ use ratatui::{ text::Text, widgets::{Block, Borders, Clear}, }; +use std::sync::Arc; use tui_input::Input; -use crate::event::Event; +use crate::{config::Config, event::Event}; pub mod eduroam; pub mod peap; @@ -448,7 +449,7 @@ impl WPAEntreprise { } } - pub fn render(&mut self, frame: &mut Frame) { + pub fn render(&mut self, frame: &mut Frame, config: Arc) { let layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -494,7 +495,7 @@ impl WPAEntreprise { Block::default() .borders(Borders::ALL) .border_type(ratatui::widgets::BorderType::Thick) - .border_style(Style::default().green()), + .border_style(Style::default().fg(config.theme.border)), block, ); @@ -512,7 +513,7 @@ impl WPAEntreprise { }; let choice = if self.focused_section == FocusedSection::EapChoice { - choice.bold().green() + choice.bold().fg(config.theme.border) } else { choice }; @@ -527,24 +528,27 @@ impl WPAEntreprise { match &mut self.eap { Eap::TLS(v) => { - v.render(frame, eap_block); + v.render(frame, eap_block, config.clone()); } Eap::PWD(v) => { - v.render(frame, eap_block); + v.render(frame, eap_block, config.clone()); } Eap::TTLS(v) => { - v.render(frame, eap_block); + v.render(frame, eap_block, config.clone()); } Eap::PEAP(v) => { - v.render(frame, eap_block); + v.render(frame, eap_block, config.clone()); } Eap::Eduroam(v) => { - v.render(frame, eap_block); + v.render(frame, eap_block, config.clone()); } } let text = if self.focused_section == FocusedSection::Apply { - Text::from("APPLY").centered().green().bold() + Text::from("APPLY") + .centered() + .fg(config.theme.border) + .bold() } else { Text::from("APPLY").centered() }; diff --git a/src/mode/station/auth/entreprise/eduroam.rs b/src/mode/station/auth/entreprise/eduroam.rs index dab09e0..082d9f8 100644 --- a/src/mode/station/auth/entreprise/eduroam.rs +++ b/src/mode/station/auth/entreprise/eduroam.rs @@ -1,18 +1,18 @@ use anyhow::{Result, anyhow}; -use std::{fs::OpenOptions, io::Write}; +use std::{fs::OpenOptions, io::Write, sync::Arc}; use crossterm::event::{KeyCode, KeyEvent}; use ratatui::{ Frame, layout::{Constraint, Direction, Layout, Rect}, - style::{Color, Stylize}, + style::Stylize, text::{Line, Span}, widgets::{HighlightSpacing, List, ListState}, }; use tui_input::{Input, backend::crossterm::EventHandler}; -use crate::mode::station::auth::entreprise::ERROR_PADDING; +use crate::{config::Config, mode::station::auth::entreprise::ERROR_PADDING}; fn pad_string(input: &str, length: usize) -> String { let current_length = input.chars().count(); @@ -166,7 +166,7 @@ AutoConnect=true", } } - pub fn render(&mut self, frame: &mut Frame, area: Rect) { + pub fn render(&mut self, frame: &mut Frame, area: Rect, config: Arc) { let layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -191,9 +191,9 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" Identity", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.identity.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.identity.field.value(), 50)).bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.identity.error { @@ -206,9 +206,10 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" Phase2 Identity", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.phase2_identity.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.phase2_identity.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.phase2_identity.error { @@ -221,9 +222,10 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" Phase2 Password", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.phase2_password.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.phase2_password.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.phase2_password.error { diff --git a/src/mode/station/auth/entreprise/peap.rs b/src/mode/station/auth/entreprise/peap.rs index 9251eed..8429dc8 100644 --- a/src/mode/station/auth/entreprise/peap.rs +++ b/src/mode/station/auth/entreprise/peap.rs @@ -1,11 +1,11 @@ use anyhow::{Result, anyhow}; -use std::{fs::OpenOptions, io::Write, path::Path}; +use std::{fs::OpenOptions, io::Write, path::Path, sync::Arc}; use crossterm::event::{KeyCode, KeyEvent}; use ratatui::{ Frame, layout::{Margin, Rect}, - style::{Color, Stylize}, + style::Stylize, text::{Line, Span}, widgets::{HighlightSpacing, List, ListState}, }; @@ -13,6 +13,7 @@ use ratatui::{ use tui_input::backend::crossterm::EventHandler; use crate::{ + config::Config, iwd_network_name, mode::station::auth::entreprise::{ERROR_PADDING, UserInputField}, }; @@ -318,7 +319,12 @@ EAP-PEAP-Phase2-Password={} Phase2Method::SIM => self.phase2_method = Phase2Method::GTC, Phase2Method::GTC => self.phase2_method = Phase2Method::MSCHAPV2, }, - KeyCode::Char('h') | KeyCode::Left => {} + + KeyCode::Char('h') | KeyCode::Left => match self.phase2_method { + Phase2Method::MSCHAPV2 => self.phase2_method = Phase2Method::GTC, + Phase2Method::SIM => self.phase2_method = Phase2Method::MSCHAPV2, + Phase2Method::GTC => self.phase2_method = Phase2Method::SIM, + }, _ => {} }, FocusedInput::Phase2Identity => { @@ -335,14 +341,14 @@ EAP-PEAP-Phase2-Password={} } } - pub fn render(&mut self, frame: &mut Frame, area: Rect) { + pub fn render(&mut self, frame: &mut Frame, area: Rect, config: Arc) { let items = [ Line::from(vec![ Span::from(pad_string(" Identity", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.identity.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.identity.field.value(), 50)).bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.identity.error { @@ -355,10 +361,10 @@ EAP-PEAP-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Server Domain Mask", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), Span::from(pad_string(self.server_domain_mask.field.value(), 50)) - .bg(Color::DarkGray), + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.server_domain_mask.error { @@ -371,9 +377,9 @@ EAP-PEAP-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" CA Cert", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.ca_cert.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.ca_cert.field.value(), 50)).bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.ca_cert.error { @@ -386,9 +392,10 @@ EAP-PEAP-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Client Cert", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.client_cert.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.client_cert.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.client_cert.error { @@ -401,9 +408,10 @@ EAP-PEAP-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Client Key", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.client_key.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.client_key.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.client_key.error { @@ -416,9 +424,10 @@ EAP-PEAP-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Key Passphrase", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.key_passphrase.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.key_passphrase.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.key_passphrase.error { @@ -431,7 +440,7 @@ EAP-PEAP-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Phase2 Method", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), Span::from(format!("< {} >", self.phase2_method)), ]), @@ -439,9 +448,10 @@ EAP-PEAP-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Phase2 Identity", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.phase2_identity.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.phase2_identity.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.phase2_identity.error { @@ -454,9 +464,10 @@ EAP-PEAP-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Phase2 Password", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.phase2_password.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.phase2_password.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.phase2_password.error { diff --git a/src/mode/station/auth/entreprise/pwd.rs b/src/mode/station/auth/entreprise/pwd.rs index dc0f1a9..327b964 100644 --- a/src/mode/station/auth/entreprise/pwd.rs +++ b/src/mode/station/auth/entreprise/pwd.rs @@ -1,18 +1,18 @@ use anyhow::{Result, anyhow}; -use std::{fs::OpenOptions, io::Write}; +use std::{fs::OpenOptions, io::Write, sync::Arc}; use crossterm::event::{KeyCode, KeyEvent}; use ratatui::{ Frame, layout::{Constraint, Direction, Layout, Rect}, - style::{Color, Stylize}, + style::Stylize, text::{Line, Span}, widgets::{HighlightSpacing, List, ListState}, }; use tui_input::{Input, backend::crossterm::EventHandler}; -use crate::{iwd_network_name, mode::station::auth::entreprise::ERROR_PADDING}; +use crate::{config::Config, iwd_network_name, mode::station::auth::entreprise::ERROR_PADDING}; fn pad_string(input: &str, length: usize) -> String { let current_length = input.chars().count(); @@ -147,7 +147,7 @@ AutoConnect=true", } } - pub fn render(&mut self, frame: &mut Frame, area: Rect) { + pub fn render(&mut self, frame: &mut Frame, area: Rect, config: Arc) { let layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -172,9 +172,9 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" Identity", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.identity.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.identity.field.value(), 50)).bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.identity.error { @@ -187,9 +187,9 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" Password", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.password.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.password.field.value(), 50)).bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.password.error { diff --git a/src/mode/station/auth/entreprise/requests/key_passphrase.rs b/src/mode/station/auth/entreprise/requests/key_passphrase.rs index fe79968..3eb6b78 100644 --- a/src/mode/station/auth/entreprise/requests/key_passphrase.rs +++ b/src/mode/station/auth/entreprise/requests/key_passphrase.rs @@ -1,10 +1,11 @@ -use crate::agent::AuthAgent; +use crate::{agent::AuthAgent, config::Config}; use anyhow::Result; +use std::sync::Arc; use ratatui::{ Frame, layout::{Alignment, Constraint, Direction, Layout}, - style::{Color, Style, Stylize}, + style::{Style, Stylize}, text::{Line, Span, Text}, widgets::{Block, BorderType, Borders, Clear, Padding, Paragraph}, }; @@ -43,7 +44,7 @@ impl RequestKeyPassphrase { self.passphrase.reset(); Ok(()) } - pub fn render(&self, frame: &mut Frame) { + pub fn render(&self, frame: &mut Frame, config: Arc) { let popup_layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -106,7 +107,7 @@ impl RequestKeyPassphrase { let text = Paragraph::new(text.centered()) .alignment(Alignment::Center) - .style(Style::default().fg(Color::White)) + .style(Style::default().fg(config.theme.text_color)) .block(Block::new().padding(Padding::uniform(1))); let passkey = Paragraph::new({ @@ -117,8 +118,8 @@ impl RequestKeyPassphrase { } }) .alignment(Alignment::Center) - .style(Style::default().fg(Color::White)) - .block(Block::new().style(Style::default().bg(Color::DarkGray))); + .style(Style::default().fg(config.theme.text_color)) + .block(Block::new().style(Style::default().bg(config.theme.background))); let show_password_icon = if self.show_password { Text::from(" ").centered() @@ -132,8 +133,7 @@ impl RequestKeyPassphrase { Block::new() .borders(Borders::ALL) .border_type(BorderType::Thick) - .style(Style::default().green()) - .border_style(Style::default().fg(Color::Green)), + .style(Style::default().fg(config.theme.border)), area, ); frame.render_widget(text, text_area); diff --git a/src/mode/station/auth/entreprise/requests/password.rs b/src/mode/station/auth/entreprise/requests/password.rs index 8a77347..84952cf 100644 --- a/src/mode/station/auth/entreprise/requests/password.rs +++ b/src/mode/station/auth/entreprise/requests/password.rs @@ -1,13 +1,14 @@ -use crate::agent::AuthAgent; +use crate::{agent::AuthAgent, config::Config}; use anyhow::Result; use ratatui::{ Frame, layout::{Constraint, Direction, Layout, Margin}, - style::{Color, Style, Stylize}, + style::{Style, Stylize}, text::{Line, Span, Text}, widgets::{Block, BorderType, Borders, Clear, List}, }; +use std::sync::Arc; use tui_input::Input; #[derive(Debug)] @@ -45,7 +46,7 @@ impl RequestPassword { self.password.reset(); Ok(()) } - pub fn render(&self, frame: &mut Frame) { + pub fn render(&self, frame: &mut Frame, config: Arc) { let popup_layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -96,7 +97,7 @@ impl RequestPassword { { if let Some(user_name) = &self.user_name { Line::from(vec![ - Span::raw(" Username ").bold().bg(Color::DarkGray), + Span::raw(" Username ").bold().bg(config.theme.background), Span::from(" "), Span::from(user_name), ]) @@ -106,7 +107,7 @@ impl RequestPassword { }, Line::from(""), Line::from(vec![ - Span::raw(" Password ").bold().bg(Color::DarkGray), + Span::raw(" Password ").bold().bg(config.theme.background), Span::from(" "), Span::from({ if self.show_password { @@ -132,7 +133,7 @@ impl RequestPassword { Block::new() .borders(Borders::ALL) .border_type(BorderType::Thick) - .border_style(Style::default().fg(Color::Green)), + .border_style(Style::default().fg(config.theme.border)), area, ); frame.render_widget( diff --git a/src/mode/station/auth/entreprise/requests/username_and_password.rs b/src/mode/station/auth/entreprise/requests/username_and_password.rs index 93769fa..b7a8e2b 100644 --- a/src/mode/station/auth/entreprise/requests/username_and_password.rs +++ b/src/mode/station/auth/entreprise/requests/username_and_password.rs @@ -1,6 +1,6 @@ -use crate::agent::AuthAgent; -use crate::event::Event; +use crate::{agent::AuthAgent, config::Config, event::Event}; use anyhow::Result; +use std::sync::Arc; use tokio::sync::mpsc::UnboundedSender; use crossterm::event::{KeyCode, KeyEvent}; @@ -8,7 +8,7 @@ use crossterm::event::{KeyCode, KeyEvent}; use ratatui::{ Frame, layout::{Constraint, Direction, Layout, Margin}, - style::{Color, Style, Stylize}, + style::{Style, Stylize}, text::{Line, Span, Text}, widgets::{Block, BorderType, Borders, Clear, List}, }; @@ -108,7 +108,7 @@ impl RequestUsernameAndPassword { self.password.reset(); Ok(()) } - pub fn render(&self, frame: &mut Frame) { + pub fn render(&self, frame: &mut Frame, config: Arc) { let popup_layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -157,13 +157,13 @@ impl RequestUsernameAndPassword { let items = vec![ Line::from(vec![ - Span::raw(" Username ").bold().bg(Color::DarkGray), + Span::raw(" Username ").bold().bg(config.theme.background), Span::from(" "), Span::from(self.username.value()), ]), Line::from(""), Line::from(vec![ - Span::raw(" Password ").bold().bg(Color::DarkGray), + Span::raw(" Password ").bold().bg(config.theme.background), Span::from(" "), Span::from({ if self.show_password { @@ -189,7 +189,7 @@ impl RequestUsernameAndPassword { Block::new() .borders(Borders::ALL) .border_type(BorderType::Thick) - .border_style(Style::default().fg(Color::Green)), + .border_style(Style::default().fg(config.theme.border)), area, ); frame.render_widget( diff --git a/src/mode/station/auth/entreprise/tls.rs b/src/mode/station/auth/entreprise/tls.rs index 0c658f0..3f345ae 100644 --- a/src/mode/station/auth/entreprise/tls.rs +++ b/src/mode/station/auth/entreprise/tls.rs @@ -1,18 +1,18 @@ use anyhow::{Result, anyhow}; -use std::{fs::OpenOptions, io::Write, path::Path}; +use std::{fs::OpenOptions, io::Write, path::Path, sync::Arc}; use crossterm::event::{KeyCode, KeyEvent}; use ratatui::{ Frame, layout::{Constraint, Direction, Layout, Rect}, - style::{Color, Stylize}, + style::Stylize, text::{Line, Span}, widgets::{HighlightSpacing, List, ListState}, }; use tui_input::{Input, backend::crossterm::EventHandler}; -use crate::{iwd_network_name, mode::station::auth::entreprise::ERROR_PADDING}; +use crate::{config::Config, iwd_network_name, mode::station::auth::entreprise::ERROR_PADDING}; fn pad_string(input: &str, length: usize) -> String { let current_length = input.chars().count(); @@ -242,7 +242,7 @@ AutoConnect=true", } } - pub fn render(&mut self, frame: &mut Frame, area: Rect) { + pub fn render(&mut self, frame: &mut Frame, area: Rect, config: Arc) { let layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -267,9 +267,9 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" CA Cert", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.ca_cert.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.ca_cert.field.value(), 50)).bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.ca_cert.error { @@ -282,9 +282,9 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" Identity", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.identity.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.identity.field.value(), 50)).bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.identity.error { @@ -297,9 +297,10 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" Client Cert", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.client_cert.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.client_cert.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.client_cert.error { @@ -312,9 +313,10 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" Client Key", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.client_key.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.client_key.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.client_key.error { @@ -327,9 +329,10 @@ AutoConnect=true", Line::from(vec![ Span::from(pad_string(" Key Passphrase", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.key_passphrase.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.key_passphrase.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.key_passphrase.error { diff --git a/src/mode/station/auth/entreprise/ttls.rs b/src/mode/station/auth/entreprise/ttls.rs index b14ce00..0681736 100644 --- a/src/mode/station/auth/entreprise/ttls.rs +++ b/src/mode/station/auth/entreprise/ttls.rs @@ -1,11 +1,11 @@ use anyhow::{Result, anyhow}; -use std::{fs::OpenOptions, io::Write, path::Path}; +use std::{fs::OpenOptions, io::Write, path::Path, sync::Arc}; use crossterm::event::{KeyCode, KeyEvent}; use ratatui::{ Frame, layout::{Margin, Rect}, - style::{Color, Stylize}, + style::Stylize, text::{Line, Span}, widgets::{HighlightSpacing, List, ListState}, }; @@ -13,6 +13,7 @@ use ratatui::{ use tui_input::backend::crossterm::EventHandler; use crate::{ + config::Config, iwd_network_name, mode::station::auth::entreprise::{ERROR_PADDING, UserInputField, pad_string}, }; @@ -323,7 +324,19 @@ EAP-TTLS-Phase2-Password={} } Phase2Method::TunneledPAP => self.phase2_method = Phase2Method::MSCHAPV2, }, - KeyCode::Char('h') | KeyCode::Left => {} + KeyCode::Char('h') | KeyCode::Left => match self.phase2_method { + Phase2Method::MSCHAPV2 => self.phase2_method = Phase2Method::TunneledPAP, + Phase2Method::TunneledCHAP => self.phase2_method = Phase2Method::MSCHAPV2, + Phase2Method::TunneledMSCHAP => { + self.phase2_method = Phase2Method::TunneledCHAP + } + Phase2Method::TunneledMSCHAPv2 => { + self.phase2_method = Phase2Method::TunneledMSCHAP + } + Phase2Method::TunneledPAP => { + self.phase2_method = Phase2Method::TunneledMSCHAPv2 + } + }, _ => {} }, FocusedInput::Phase2Identity => { @@ -340,14 +353,14 @@ EAP-TTLS-Phase2-Password={} } } - pub fn render(&mut self, frame: &mut Frame, area: Rect) { + pub fn render(&mut self, frame: &mut Frame, area: Rect, config: Arc) { let items = [ Line::from(vec![ Span::from(pad_string(" Identity", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.identity.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.identity.field.value(), 50)).bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.identity.error { @@ -360,10 +373,10 @@ EAP-TTLS-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Server Domain Mask", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), Span::from(pad_string(self.server_domain_mask.field.value(), 50)) - .bg(Color::DarkGray), + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.server_domain_mask.error { @@ -376,9 +389,9 @@ EAP-TTLS-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" CA Cert", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.ca_cert.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.ca_cert.field.value(), 50)).bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.ca_cert.error { @@ -391,9 +404,10 @@ EAP-TTLS-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Client Cert", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.client_cert.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.client_cert.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.client_cert.error { @@ -406,9 +420,10 @@ EAP-TTLS-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Client Key", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.client_key.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.client_key.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.client_key.error { @@ -421,9 +436,10 @@ EAP-TTLS-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Key Passphrase", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.key_passphrase.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.key_passphrase.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.key_passphrase.error { @@ -436,7 +452,7 @@ EAP-TTLS-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Phase2 Method", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), Span::from(format!("< {} >", self.phase2_method)), ]), @@ -444,9 +460,10 @@ EAP-TTLS-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Phase2 Identity", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.phase2_identity.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.phase2_identity.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.phase2_identity.error { @@ -459,9 +476,10 @@ EAP-TTLS-Phase2-Password={} Line::from(vec![ Span::from(pad_string(" Phase2 Password", 20)) .bold() - .bg(Color::DarkGray), + .bg(config.theme.background), Span::from(" "), - Span::from(pad_string(self.phase2_password.field.value(), 50)).bg(Color::DarkGray), + Span::from(pad_string(self.phase2_password.field.value(), 50)) + .bg(config.theme.background), ]), Line::from(vec![Span::from(ERROR_PADDING), { if let Some(error) = &self.phase2_password.error { diff --git a/src/mode/station/auth/psk.rs b/src/mode/station/auth/psk.rs index 20cfad8..f8a8e07 100644 --- a/src/mode/station/auth/psk.rs +++ b/src/mode/station/auth/psk.rs @@ -1,10 +1,12 @@ use crate::agent::AuthAgent; +use crate::config::Config; use anyhow::Result; +use std::sync::Arc; use ratatui::{ Frame, layout::{Alignment, Constraint, Direction, Layout}, - style::{Color, Style, Stylize}, + style::{Style, Stylize}, text::{Line, Span, Text}, widgets::{Block, BorderType, Borders, Clear, Padding, Paragraph}, }; @@ -44,7 +46,7 @@ impl Psk { self.passphrase.reset(); Ok(()) } - pub fn render(&self, frame: &mut Frame, network_name: Option) { + pub fn render(&self, frame: &mut Frame, network_name: Option, config: Arc) { let popup_layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -111,7 +113,7 @@ impl Psk { let text = Paragraph::new(text.centered()) .alignment(Alignment::Center) - .style(Style::default().fg(Color::White)) + .style(Style::default().fg(config.theme.text_color)) .block(Block::new().padding(Padding::uniform(1))); let passphrase_str = if self.show_password { @@ -124,8 +126,8 @@ impl Psk { let passkey = Paragraph::new(passphrase_str) .alignment(Alignment::Center) - .style(Style::default().fg(Color::White)) - .block(Block::new().style(Style::default().bg(Color::DarkGray))); + .style(Style::default().fg(config.theme.text_color)) + .block(Block::new().style(Style::default().bg(config.theme.background))); let show_password_icon = if self.show_password { Text::from("󰈈 ").centered() @@ -139,8 +141,7 @@ impl Psk { Block::new() .borders(Borders::ALL) .border_type(BorderType::Thick) - .style(Style::default().green()) - .border_style(Style::default().fg(Color::Green)), + .style(Style::default().fg(config.theme.border)), area, ); frame.render_widget(text, text_area); diff --git a/src/mode/station/hidden_network.rs b/src/mode/station/hidden_network.rs index a9a9716..7c6fe7b 100644 --- a/src/mode/station/hidden_network.rs +++ b/src/mode/station/hidden_network.rs @@ -1,4 +1,6 @@ +use crate::config::Config; use crate::event::Event; +use std::sync::Arc; use crossterm::event::{KeyCode, KeyEvent}; use tokio::sync::mpsc::UnboundedSender; @@ -6,7 +8,7 @@ use tokio::sync::mpsc::UnboundedSender; use ratatui::{ Frame, layout::{Constraint, Direction, Layout, Margin}, - style::{Color, Style, Stylize}, + style::{Style, Stylize}, text::Text, widgets::{Block, BorderType, Borders, Clear}, }; @@ -66,7 +68,7 @@ impl ConnectHiddenNetwork { } } - pub fn render(&self, frame: &mut Frame) { + pub fn render(&self, frame: &mut Frame, config: Arc) { let popup_layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -106,7 +108,9 @@ impl ConnectHiddenNetwork { let message = Text::from("Enter the SSID of the hidden network").centered(); - let ssid = Text::from(self.ssid.value()).bg(Color::DarkGray).centered(); + let ssid = Text::from(self.ssid.value()) + .bg(config.theme.background) + .centered(); let error = Text::from(self.ssid.error.clone().unwrap_or_default()) .red() .centered(); @@ -117,7 +121,7 @@ impl ConnectHiddenNetwork { Block::new() .borders(Borders::ALL) .border_type(BorderType::Thick) - .border_style(Style::default().fg(Color::Green)), + .border_style(Style::default().fg(config.theme.border)), area, ); frame.render_widget( diff --git a/src/mode/station/share.rs b/src/mode/station/share.rs index 54e22a2..0a75e01 100644 --- a/src/mode/station/share.rs +++ b/src/mode/station/share.rs @@ -1,17 +1,17 @@ use anyhow::Result; use qrcode::QrCode; -use std::{cmp, fs}; +use std::{cmp, fs, sync::Arc}; use tui_qrcode::{Colors, QrCodeWidget}; use ratatui::{ Frame, layout::{Constraint, Direction, Flex, Layout, Rect}, - style::{Color, Style, Stylize}, + style::{Style, Stylize}, text::{Line, Span, Text}, widgets::{Block, BorderType, Borders, Clear}, }; -use crate::iwd_network_name; +use crate::{config::Config, iwd_network_name}; #[derive(Clone)] pub struct Share { @@ -56,7 +56,7 @@ impl Share { } } - pub fn render(&self, frame: &mut Frame) { + pub fn render(&self, frame: &mut Frame, config: Arc) { let widget = QrCodeWidget::new(self.qr_code.clone()).colors(Colors::Inverted); let sim_area = Rect::new(0, 0, 50, 50); let size = widget.size(sim_area); @@ -103,7 +103,7 @@ impl Share { Block::new() .borders(Borders::all()) .border_type(BorderType::Thick) - .border_style(Style::new().green()), + .border_style(Style::new().fg(config.theme.border)), block, ); frame.render_widget( @@ -129,7 +129,9 @@ impl Share { Line::from(""), Line::from(vec![ Span::from("Passphrase: "), - Span::from(&self.passphrase).bold().bg(Color::DarkGray), + Span::from(&self.passphrase) + .bold() + .bg(config.theme.background), ]) .centered(), ]); diff --git a/src/notification.rs b/src/notification.rs index 878efa5..c4d55f1 100644 --- a/src/notification.rs +++ b/src/notification.rs @@ -2,13 +2,14 @@ use anyhow::Result; use ratatui::{ Frame, layout::{Alignment, Constraint, Direction, Layout, Rect}, - style::{Color, Modifier, Style}, + style::{Modifier, Style}, text::{Line, Text}, widgets::{Block, BorderType, Borders, Clear, Paragraph, Wrap}, }; +use std::sync::Arc; use tokio::sync::mpsc::UnboundedSender; -use crate::event::Event; +use crate::{config::Config, event::Event}; #[derive(Debug, Clone)] pub struct Notification { @@ -25,11 +26,11 @@ pub enum NotificationLevel { } impl Notification { - pub fn render(&self, index: usize, frame: &mut Frame) { + pub fn render(&self, index: usize, frame: &mut Frame, config: Arc) { let (color, title) = match self.level { - NotificationLevel::Info => (Color::Green, "Info"), - NotificationLevel::Warning => (Color::Yellow, "Warning"), - NotificationLevel::Error => (Color::Red, "Error"), + NotificationLevel::Info => (config.theme.info_color, "Info"), + NotificationLevel::Warning => (config.theme.warning_color, "Warning"), + NotificationLevel::Error => (config.theme.error_color, "Error"), }; let mut text = Text::from(vec![ diff --git a/src/reset.rs b/src/reset.rs index 4b49530..7dbd442 100644 --- a/src/reset.rs +++ b/src/reset.rs @@ -1,11 +1,13 @@ +use crate::config::Config; use iwdrs::modes::Mode; use ratatui::{ Frame, layout::{Alignment, Constraint, Direction, Layout}, - style::{Color, Style}, + style::Style, text::Text, widgets::{Block, BorderType, Borders, Clear, Padding, Paragraph}, }; +use std::sync::Arc; #[derive(Debug)] pub struct Reset { @@ -23,7 +25,7 @@ impl Reset { } } - pub fn render(&self, frame: &mut Frame) { + pub fn render(&self, frame: &mut Frame, config: Arc) { let popup_layout = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -118,15 +120,15 @@ impl Reset { let message = Paragraph::new("Select the desired mode:") .alignment(Alignment::Center) - .style(Style::default().fg(Color::White)) + .style(Style::default().fg(config.theme.text_color)) .block(Block::new().padding(Padding::uniform(1))); let station_choice = Paragraph::new(station_text) - .style(Style::default().fg(Color::White)) + .style(Style::default().fg(config.theme.text_color)) .block(Block::new().padding(Padding::horizontal(10))); let ap_choice = Paragraph::new(ap_text) - .style(Style::default().fg(Color::White)) + .style(Style::default().fg(config.theme.text_color)) .block(Block::new().padding(Padding::horizontal(10))); let help = Paragraph::new( @@ -143,8 +145,7 @@ impl Reset { Block::new() .borders(Borders::ALL) .border_type(BorderType::Rounded) - .style(Style::default().green()) - .border_style(Style::default().fg(Color::Green)), + .style(Style::default().fg(config.theme.border)), area, ); frame.render_widget(message, message_area); diff --git a/src/ui.rs b/src/ui.rs index e78de3d..b64b26b 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -7,7 +7,7 @@ use crate::app::{App, FocusedBlock}; pub fn render(app: &mut App, frame: &mut Frame) { if app.reset.enable { - app.reset.render(frame); + app.reset.render(frame, app.config.clone()); } else { if !app.device.is_powered { app.device @@ -23,6 +23,9 @@ pub fn render(app: &mut App, frame: &mut Frame) { Mode::Ap => { if let Some(ap) = &mut app.device.ap { ap.render(frame, app.focused_block, &device, app.config.clone()); + if app.focused_block == FocusedBlock::AccessPointInput { + ap.render_input(frame, app.config.clone()); + } } } } @@ -31,19 +34,22 @@ pub fn render(app: &mut App, frame: &mut Frame) { if app.focused_block == FocusedBlock::WpaEntrepriseAuth && let Some(eap) = &mut app.auth.eap { - eap.render(frame); + eap.render(frame, app.config.clone()); } if app.focused_block == FocusedBlock::AdapterInfos { - app.adapter.render(frame, app.device.address.clone()); + app.adapter + .render(frame, app.device.address.clone(), app.config.clone()); } if app.agent.psk_required.load(Ordering::Relaxed) { app.focused_block = FocusedBlock::PskAuthKey; - app.auth - .psk - .render(frame, app.network_name_requiring_auth.clone()); + app.auth.psk.render( + frame, + app.network_name_requiring_auth.clone(), + app.config.clone(), + ); } if app @@ -52,13 +58,13 @@ pub fn render(app: &mut App, frame: &mut Frame) { .load(Ordering::Relaxed) && let Some(req) = &app.auth.request_key_passphrase { - req.render(frame); + req.render(frame, app.config.clone()); } if app.agent.password_required.load(Ordering::Relaxed) && let Some(req) = &app.auth.request_password { - req.render(frame); + req.render(frame, app.config.clone()); } if app @@ -67,18 +73,18 @@ pub fn render(app: &mut App, frame: &mut Frame) { .load(Ordering::Relaxed) && let Some(req) = &app.auth.request_username_and_password { - req.render(frame); + req.render(frame, app.config.clone()); } if let Some(station) = &app.device.station && let Some(conn) = &station.connct_hidden_network { - conn.render(frame); + conn.render(frame, app.config.clone()); } // Notifications for (index, notification) in app.notifications.iter().enumerate() { - notification.render(index, frame); + notification.render(index, frame, app.config.clone()); } } }