diff --git a/.gitignore b/.gitignore index 4189251..8e4db9e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target +Cargo.lock .idea /aur diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index a4e03a7..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,729 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "anyhow" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" -dependencies = [ - "backtrace", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "cassowary" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "3.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" -dependencies = [ - "atty", - "bitflags", - "clap_lex", - "indexmap", - "strsim", - "termcolor", - "textwrap", -] - -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - -[[package]] -name = "crossterm" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" -dependencies = [ - "bitflags", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" -dependencies = [ - "bitflags", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" -dependencies = [ - "winapi", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "getrandom" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.10.2+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" - -[[package]] -name = "git-version" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899" -dependencies = [ - "git-version-macro", - "proc-macro-hack", -] - -[[package]] -name = "git-version-macro" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "indexmap" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "itoa" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" - -[[package]] -name = "leftwm-config" -version = "0.1.0" -dependencies = [ - "anyhow", - "clap", - "crossterm 0.26.1", - "git-version", - "glob", - "log", - "ron", - "serde", - "serde_json", - "thiserror", - "toml", - "tui", - "xdg", -] - -[[package]] -name = "libc" -version = "0.2.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" - -[[package]] -name = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "miniz_oxide" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" -dependencies = [ - "libc", - "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", -] - -[[package]] -name = "object" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" -dependencies = [ - "memchr", -] - -[[package]] -name = "os_str_bytes" -version = "6.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys", -] - -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - -[[package]] -name = "proc-macro2" -version = "1.0.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "ron" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300a51053b1cb55c80b7a9fde4120726ddf25ca241a1cbb926626f62fb136bff" -dependencies = [ - "base64", - "bitflags", - "serde", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "ryu" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" -dependencies = [ - "serde", -] - -[[package]] -name = "signal-hook" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" -dependencies = [ - "libc", - "mio", - "signal-hook", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - -[[package]] -name = "smallvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - -[[package]] -name = "thiserror" -version = "1.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tui" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1" -dependencies = [ - "bitflags", - "cassowary", - "crossterm 0.25.0", - "unicode-segmentation", - "unicode-width", -] - -[[package]] -name = "unicode-ident" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" - -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "winnow" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee7b2c67f962bf5042bfd8b6a916178df33a26eec343ae064cb8e069f638fa6f" -dependencies = [ - "memchr", -] - -[[package]] -name = "xdg" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6" -dependencies = [ - "dirs", -] diff --git a/src/config/check.rs b/src/config/check.rs index fccc800..0a0033e 100644 --- a/src/config/check.rs +++ b/src/config/check.rs @@ -2,9 +2,9 @@ use crate::config; use crate::config::Config; use crate::config::{all_ids_some, all_ids_unique, get_workspace_ids}; use anyhow::bail; -use anyhow::{Error, Result}; +use anyhow::Result; use std::collections::HashSet; -use std::process::{Command, Stdio}; + use std::{env, fs}; pub fn check_config(path: Option<&str>, verbose: bool) -> Result<()> { diff --git a/src/config/layout.rs b/src/config/layout.rs index 09d0c53..3aa887e 100644 --- a/src/config/layout.rs +++ b/src/config/layout.rs @@ -20,22 +20,22 @@ pub enum Layout { LeftWiderRightStack, } -pub const LAYOUTS: &[Layout] = &[ - Layout::MainAndVertStack, - Layout::MainAndHorizontalStack, - Layout::MainAndDeck, - Layout::GridHorizontal, - Layout::EvenHorizontal, - Layout::EvenVertical, - Layout::Fibonacci, - Layout::LeftMain, - Layout::CenterMain, - Layout::CenterMainBalanced, - Layout::CenterMainFluid, - Layout::Monocle, - Layout::RightWiderLeftStack, - Layout::LeftWiderRightStack, -]; +//pub const LAYOUTS: &[Layout] = &[ +// Layout::MainAndVertStack, +// Layout::MainAndHorizontalStack, +// Layout::MainAndDeck, +// Layout::GridHorizontal, +// Layout::EvenHorizontal, +// Layout::EvenVertical, +// Layout::Fibonacci, +// Layout::LeftMain, +// Layout::CenterMain, +// Layout::CenterMainBalanced, +// Layout::CenterMainFluid, +// Layout::Monocle, +// Layout::RightWiderLeftStack, +// Layout::LeftWiderRightStack, +//]; impl Default for Layout { fn default() -> Self { diff --git a/src/config/mod.rs b/src/config/mod.rs index 21f4d77..7c719bd 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -278,7 +278,7 @@ impl Default for Config { }); } - let tags = vec!["1", "2", "3", "4", "5", "6", "7", "8", "9"] + let tags = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] .iter() .map(|s| (*s).to_string()) .collect(); diff --git a/src/tui/key_handler.rs b/src/tui/key_handler.rs index 12e2e63..1ef06aa 100644 --- a/src/tui/key_handler.rs +++ b/src/tui/key_handler.rs @@ -30,7 +30,7 @@ pub(super) fn handle_keys(app: &mut App) -> Result { Window::Home => enter_home(app), Window::Workspaces { index, empty } => enter_workspaces(app, index, empty), Window::Tags { index, empty } => enter_tags(app, index, empty), - Window::WindowRules { index, empty } => enter_window_rules(app, index, empty), + Window::Rules { index, empty } => enter_window_rules(app, index, empty), Window::Scratchpads { index, empty } => enter_scratchpads(app, index, empty), Window::KeyBinds { index, empty } => enter_keybinds(app, index, empty), }, @@ -69,7 +69,7 @@ fn up(app: &mut App) -> Result { bail!("Invalid popup state"); } } - 2 | 3 | 4 | 5 => {} + 2..=5 => {} 6 => { if let PopupState::List(s) = &mut app.current_popup_state { previous(s, 3); @@ -246,7 +246,7 @@ fn right(app: &mut App) -> Result { } } } - Window::WindowRules { index, empty } => { + Window::Rules { index, empty } => { if let Some(2) = app.current_popup { if let PopupState::Int { current, min, max } = app.current_popup_state { if current < max { @@ -314,7 +314,7 @@ fn left(app: &mut App) -> Result { } } } - Window::WindowRules { index, empty } => { + Window::Rules { index, empty } => { if Some(2) == app.current_popup { if let PopupState::Int { current, min, max } = app.current_popup_state { if current > min { @@ -458,7 +458,7 @@ fn enter_home(app: &mut App) -> Result { } 9 => { app.current_popup = Some(9); - let mut selected: Vec = vec![]; + let selected: Vec = vec![]; // for l in &app.current_config.layouts { // match l { // WMLayout::MainAndVertStack => selected.push(0), @@ -505,7 +505,7 @@ fn enter_home(app: &mut App) -> Result { } } 12 => { - app.current_window = Window::WindowRules { + app.current_window = Window::Rules { index: 0, empty: if let Some(v) = &app.current_config.window_rules { v.is_empty() @@ -692,8 +692,8 @@ fn enter_home(app: &mut App) -> Result { app.current_popup = None; } 9 => { - if let PopupState::MultiList(l) = &app.current_popup_state { - let mut layouts: Vec = vec![]; + if let PopupState::MultiList(_l) = &app.current_popup_state { + let layouts: Vec = vec![]; // for s in &l.selected { // match s { // 0 => layouts.push(WMLayout::MainAndVertStack), @@ -1118,7 +1118,7 @@ fn enter_window_rules(app: &mut App, index: usize, empty: bool) -> Result .try_unwrap()? .is_empty() { - app.current_window = Window::WindowRules { + app.current_window = Window::Rules { index, empty: false, } @@ -1212,7 +1212,7 @@ fn enter_window_rules(app: &mut App, index: usize, empty: bool) -> Result .try_unwrap()? .is_empty() { - app.current_window = Window::WindowRules { + app.current_window = Window::Rules { index: index - 1, empty, }; @@ -1223,7 +1223,7 @@ fn enter_window_rules(app: &mut App, index: usize, empty: bool) -> Result .try_unwrap()? .is_empty() { - app.current_window = Window::WindowRules { + app.current_window = Window::Rules { index: 0, empty: true, }; @@ -2015,7 +2015,7 @@ fn char(app: &mut App, c: char) -> Result { _ => {} }, }, - Window::WindowRules { .. } => match app.current_popup { + Window::Rules { .. } => match app.current_popup { Some(0 | 1) => { if let PopupState::String(s) = &mut app.current_popup_state { s.push(c); @@ -2119,8 +2119,8 @@ fn backspace(app: &mut App) -> Result { .as_ref() .try_unwrap()? .iter() + .filter(|&w| w.eq(&Workspace::default())) .cloned() - .filter(|w| w.eq(&Workspace::default())) .collect::>(); app.current_config.workspaces = Some(workspaces); } @@ -2141,13 +2141,13 @@ fn backspace(app: &mut App) -> Result { .as_ref() .try_unwrap()? .iter() + .filter(|&w| w.eq(&Workspace::default())) .cloned() - .filter(|w| w.eq(&Workspace::default())) .collect::>(); app.current_config.workspaces = Some(workspaces); } } - Window::WindowRules { .. } => match app.current_popup { + Window::Rules { .. } => match app.current_popup { Some(0 | 1) => { if let PopupState::String(s) = &mut app.current_popup_state { s.pop(); @@ -2219,7 +2219,7 @@ fn delete(app: &mut App) -> Result { } _ => {} }, - Window::WindowRules { index, .. } => match app.config_list_state.selected().unwrap_or(0) { + Window::Rules { index, .. } => match app.config_list_state.selected().unwrap_or(0) { 2 => { app.current_config .window_rules diff --git a/src/tui/mod.rs b/src/tui/mod.rs index 63ee30b..62a3a66 100644 --- a/src/tui/mod.rs +++ b/src/tui/mod.rs @@ -50,7 +50,7 @@ pub enum Window { Home, Workspaces { index: usize, empty: bool }, Tags { index: usize, empty: bool }, - WindowRules { index: usize, empty: bool }, + Rules { index: usize, empty: bool }, Scratchpads { index: usize, empty: bool }, KeyBinds { index: usize, empty: bool }, } @@ -61,7 +61,7 @@ impl Window { Window::Home => {} Window::Workspaces { index, .. } | Window::Tags { index, .. } - | Window::WindowRules { index, .. } + | Window::Rules { index, .. } | Window::Scratchpads { index, .. } | Window::KeyBinds { index, .. } => { *index += 1; @@ -74,7 +74,7 @@ impl Window { Window::Home => {} Window::Workspaces { index, .. } | Window::Tags { index, .. } - | Window::WindowRules { index, .. } + | Window::Rules { index, .. } | Window::Scratchpads { index, .. } | Window::KeyBinds { index, .. } => { *index -= 1; @@ -87,7 +87,7 @@ impl Window { Window::Home => {} Window::Workspaces { index, .. } | Window::Tags { index, .. } - | Window::WindowRules { index, .. } + | Window::Rules { index, .. } | Window::Scratchpads { index, .. } | Window::KeyBinds { index, .. } => { *index = new_index; @@ -183,7 +183,7 @@ impl App<'_> { vec![Spans::from(spans)] } - Window::WindowRules { .. } | Window::Scratchpads { .. } => { + Window::Rules { .. } | Window::Scratchpads { .. } => { vec![Spans::from(vec![ Span::raw("Exit: q, "), Span::raw("Save: s, "), @@ -226,7 +226,7 @@ impl App<'_> { f.render_widget(frame, size); f.render_stateful_widget( list, - utils::centered_rect(50, 50, *chunks.get(0).unwrap_or(&size)), + utils::centered_rect(50, 50, *chunks.first().unwrap_or(&size)), &mut self.config_list_state, ); f.render_widget(help, *chunks.get(1).unwrap_or(&size)); @@ -322,7 +322,7 @@ impl App<'_> { Ok(()) } } - Window::WindowRules { .. } => match self.current_popup { + Window::Rules { .. } => match self.current_popup { Some(0) => popups::text_input( &mut self.current_popup_state, "Title".to_string(), @@ -575,7 +575,7 @@ impl App<'_> { ] } } - Window::WindowRules { index, empty } => { + Window::Rules { index, empty } => { if empty { vec![ ListItem::new("None out of 0"),