diff --git a/komorebi-for-kde/.cargo/config.toml b/.cargo/config.toml similarity index 100% rename from komorebi-for-kde/.cargo/config.toml rename to .cargo/config.toml diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 77e7006e..1214a751 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -68,7 +68,7 @@ jobs: args: "--locked --release" - run: | cargo install cargo-wix - cargo wix --no-build -p komorebi --nocapture -I .\wix\main.wxs --target ${{ matrix.platform.target }} + cargo wix --no-build -p komorebi-windows --nocapture -I .\wix\main.wxs --target ${{ matrix.platform.target }} - uses: actions/upload-artifact@v7 with: name: komorebi-${{ matrix.platform.target }}-${{ github.sha }} diff --git a/.gitignore b/.gitignore index 1d83df98..79eea949 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ CHANGELOG.md dummy.go komorebic/applications.yaml -komorebic/applications.json /.vs /bar-schema /komorebi-schema diff --git a/Cargo.lock b/Cargo.lock index 128977a2..bf996037 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,7 +77,7 @@ dependencies = [ "futures-lite", "futures-util", "serde", - "zbus", + "zbus 5.19.0", ] [[package]] @@ -324,9 +324,9 @@ dependencies = [ "objc2-core-foundation", "objc2-core-graphics", "objc2-foundation 0.3.2", - "parking_lot", + "parking_lot 0.12.5", "percent-encoding", - "windows-sys 0.61.2", + "windows-sys 0.52.0", "x11rb", ] @@ -534,7 +534,7 @@ dependencies = [ "enumflags2", "serde", "static_assertions", - "zbus", + "zbus 5.19.0", "zbus-lockstep", "zbus-lockstep-macros", "zbus_names", @@ -550,7 +550,7 @@ dependencies = [ "atspi-common", "atspi-proxies", "futures-lite", - "zbus", + "zbus 5.19.0", ] [[package]] @@ -561,7 +561,7 @@ checksum = "d2eebcb9e7e76f26d0bcfd6f0295e1cd1e6f33bedbc5698a971db8dc43d7751c" dependencies = [ "atspi-common", "serde", - "zbus", + "zbus 5.19.0", ] [[package]] @@ -1545,6 +1545,15 @@ dependencies = [ "dirs-sys 0.5.0", ] +[[package]] +name = "dirs" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" +dependencies = [ + "dirs-sys 0.5.0", +] + [[package]] name = "dirs-sys" version = "0.3.7" @@ -1565,7 +1574,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.3", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -1606,6 +1615,17 @@ dependencies = [ "libloading", ] +[[package]] +name = "dlopen2" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b4f5f101177ff01b8ec4ecc81eead416a8aa42819a2869311b3420fa114ffa" +dependencies = [ + "libc", + "once_cell", + "winapi", +] + [[package]] name = "dlopen2" version = "0.8.2" @@ -1706,7 +1726,7 @@ dependencies = [ "objc2 0.5.3", "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", - "parking_lot", + "parking_lot 0.12.5", "percent-encoding", "profiling", "raw-window-handle", @@ -1908,7 +1928,7 @@ dependencies = [ "epaint_default_fonts", "log", "nohash-hasher", - "parking_lot", + "parking_lot 0.12.5", "profiling", ] @@ -1951,7 +1971,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2039,6 +2059,12 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "fearless_simd" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" + [[package]] name = "fiat-crypto" version = "0.2.9" @@ -2076,6 +2102,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + [[package]] name = "flate2" version = "1.1.10" @@ -2632,6 +2664,15 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +[[package]] +name = "hayro-jpeg2000" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" +dependencies = [ + "fearless_simd", +] + [[package]] name = "heck" version = "0.5.0" @@ -2810,7 +2851,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.62.2", + "windows-core 0.57.0", ] [[package]] @@ -2822,6 +2863,17 @@ dependencies = [ "cc", ] +[[package]] +name = "icns" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "467efeb2c1e570cebb9863f9173447f8fe92303d66adc97cb89ac824b60e7a0f" +dependencies = [ + "byteorder", + "hayro-jpeg2000", + "png 0.18.1", +] + [[package]] name = "icu_collections" version = "2.4.0" @@ -3331,64 +3383,6 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" -[[package]] -name = "komorebi" -version = "0.1.42" -dependencies = [ - "base64 0.22.1", - "bitflags 2.13.2", - "chrono", - "clap", - "color-eyre", - "crossbeam-channel", - "crossbeam-utils", - "ctrlc", - "dirs 6.0.0", - "ed25519-dalek", - "hotwatch", - "komorebi-backend", - "komorebi-collections", - "komorebi-config", - "komorebi-core", - "komorebi-layouts", - "komorebi-protocol", - "komorebi-scrolling", - "komorebi-themes", - "komorebi-transport", - "lazy_static", - "miow", - "nanoid", - "net2", - "os_info", - "parking_lot", - "paste", - "powershell_script", - "regex", - "reqwest", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "serde_with", - "serde_yaml 0.9.34+deprecated", - "shadow-rs", - "strum", - "sysinfo 0.39.6", - "tracing", - "tracing-appender", - "tracing-subscriber", - "uds_windows", - "uuid", - "which", - "win32-display-data", - "windows 0.62.2", - "windows-core 0.62.2", - "windows-implement 0.60.2", - "windows-interface 0.59.3", - "windows-numerics 0.3.1", - "winput", - "winreg", -] - [[package]] name = "komorebi-backend" version = "0.1.42" @@ -3412,22 +3406,28 @@ dependencies = [ "egui_extras", "font-loader", "hotwatch", + "icns", "image 0.25.10", "komorebi-bar-core", "komorebi-client", "komorebi-themes", "lazy_static", - "netdev", + "netdev 0.40.1", + "netdev 0.46.3", "num", "num-derive", "num-traits", - "parking_lot", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "parking_lot 0.12.5", "random_word", + "raw-window-handle", "regex", "reqwest", "schemars 1.2.3", "serde", "serde_json_lenient", + "sysinfo 0.38.4", "sysinfo 0.39.6", "systray-util", "tokio", @@ -3446,25 +3446,95 @@ version = "0.1.42" dependencies = [ "chrono", "chrono-tz", + "color-eyre", "eframe", "egui-phosphor", + "image 0.25.10", + "komorebi-config", + "komorebi-layouts", + "komorebi-protocol", + "komorebi-themes", + "lazy_static", "reqwest", "schemars 1.2.3", "serde", "serde_json_lenient", "starship-battery", "sysinfo 0.39.6", + "tracing", +] + +[[package]] +name = "komorebi-bar-macos" +version = "0.1.1" +dependencies = [ + "chrono", + "chrono-tz", + "clap", + "color-eyre", + "crossbeam-channel", + "dirs 6.0.0", + "dunce", + "eframe", + "egui-phosphor", + "font-loader", + "hotwatch", + "icns", + "image 0.25.10", + "komorebi-bar-core", + "komorebi-client", + "komorebi-themes", + "lazy_static", + "netdev 0.40.1", + "num", + "num-derive", + "num-traits", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "parking_lot 0.12.5", + "random_word", + "raw-window-handle", + "reqwest", + "schemars 1.2.3", + "serde", + "serde_json_lenient", + "sysinfo 0.38.4", + "tracing", + "tracing-subscriber", ] [[package]] name = "komorebi-client" version = "0.1.42" dependencies = [ - "komorebi", + "komorebi-linux", + "komorebi-macos", + "komorebi-themes", + "komorebi-windows", + "parking_lot 0.13.0", "serde_json_lenient", "uds_windows", ] +[[package]] +name = "komorebi-client-linux" +version = "0.1.0" +dependencies = [ + "komorebi-linux", + "komorebi-themes", + "parking_lot 0.13.0", + "serde_json_lenient", +] + +[[package]] +name = "komorebi-client-macos" +version = "0.1.1" +dependencies = [ + "komorebi-macos", + "komorebi-themes", + "serde_json_lenient", +] + [[package]] name = "komorebi-collections" version = "0.1.42" @@ -3500,7 +3570,7 @@ dependencies = [ "komorebi-config", "komorebi-layouts", "komorebi-scrolling", - "nanoid", + "nanoid 0.5.0", "schemars 1.2.3", "serde", "serde_json_lenient", @@ -3529,6 +3599,13 @@ dependencies = [ "windows-core 0.62.2", ] +[[package]] +name = "komorebi-hotkeys" +version = "0.1.0" +dependencies = [ + "whkd-parser", +] + [[package]] name = "komorebi-layouts" version = "0.1.42" @@ -3546,6 +3623,101 @@ dependencies = [ "windows 0.62.2", ] +[[package]] +name = "komorebi-linux" +version = "0.1.0" +dependencies = [ + "clap", + "color-eyre", + "crossbeam-channel", + "crossbeam-utils", + "ctrlc", + "dirs 7.0.0", + "futures-util", + "hotwatch", + "komorebi-backend", + "komorebi-collections", + "komorebi-config", + "komorebi-core", + "komorebi-hotkeys", + "komorebi-layouts", + "komorebi-protocol", + "komorebi-scrolling", + "komorebi-settings", + "komorebi-themes", + "komorebi-transport", + "lazy_static", + "nanoid 0.5.0", + "parking_lot 0.13.0", + "pastey 0.2.3", + "regex", + "schemars 1.2.3", + "serde", + "serde_json_lenient", + "serde_with", + "strum", + "tokio", + "tracing", + "tracing-appender", + "tracing-subscriber", + "uuid", + "version-linux", + "zbus 6.1.0", +] + +[[package]] +name = "komorebi-macos" +version = "0.1.1" +dependencies = [ + "base64 0.22.1", + "block2 0.6.2", + "chrono", + "clap", + "color-eyre", + "crossbeam-channel", + "crossbeam-utils", + "ctrlc", + "dirs 6.0.0", + "dispatch2", + "ed25519-dalek", + "hotwatch", + "komorebi-backend", + "komorebi-collections", + "komorebi-config", + "komorebi-layouts", + "komorebi-protocol", + "komorebi-settings", + "komorebi-themes", + "komorebi-transport", + "lazy_static", + "nanoid 0.4.0", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-application-services", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", + "parking_lot 0.12.5", + "pastey 0.2.3", + "quickxml_to_serde", + "regex", + "reqwest", + "schemars 1.2.3", + "serde", + "serde_json_lenient", + "serde_with", + "shadow-rs 1.7.1", + "strum", + "sysinfo 0.38.4", + "thiserror 2.0.21", + "tracing", + "tracing-appender", + "tracing-subscriber", + "uuid", + "version-macos", +] + [[package]] name = "komorebi-protocol" version = "0.1.42" @@ -3565,6 +3737,17 @@ dependencies = [ name = "komorebi-scrolling" version = "0.1.42" +[[package]] +name = "komorebi-settings" +version = "0.1.42" +dependencies = [ + "komorebi-config", + "komorebi-layouts", + "komorebi-protocol", + "komorebi-themes", + "parking_lot 0.12.5", +] + [[package]] name = "komorebi-shortcuts" version = "0.1.0" @@ -3605,23 +3788,84 @@ dependencies = [ "color-eyre", "crossbeam-channel", "komorebi-protocol", - "parking_lot", + "parking_lot 0.12.5", "tracing", "uds_windows", ] +[[package]] +name = "komorebi-windows" +version = "0.1.42" +dependencies = [ + "base64 0.22.1", + "bitflags 2.13.2", + "chrono", + "clap", + "color-eyre", + "crossbeam-channel", + "crossbeam-utils", + "ctrlc", + "dirs 6.0.0", + "ed25519-dalek", + "hotwatch", + "komorebi-backend", + "komorebi-collections", + "komorebi-config", + "komorebi-core", + "komorebi-layouts", + "komorebi-protocol", + "komorebi-scrolling", + "komorebi-themes", + "komorebi-transport", + "lazy_static", + "miow", + "nanoid 0.5.0", + "net2", + "os_info", + "parking_lot 0.12.5", + "paste", + "powershell_script", + "regex", + "reqwest", + "schemars 1.2.3", + "serde", + "serde_json_lenient", + "serde_with", + "serde_yaml 0.9.34+deprecated", + "shadow-rs 2.0.0", + "strum", + "sysinfo 0.39.6", + "tracing", + "tracing-appender", + "tracing-subscriber", + "uds_windows", + "uuid", + "which", + "win32-display-data", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-numerics 0.3.1", + "winput", + "winreg", +] + [[package]] name = "komorebic" version = "0.1.42" dependencies = [ "chrono", "clap", + "clap_complete", "color-eyre", "dirs 6.0.0", "dunce", "fs-tail", "komorebi-client", "komorebi-config", + "komorebi-hotkeys", + "komorebi-linux", "komorebic-core", "lazy_static", "miette", @@ -3631,9 +3875,13 @@ dependencies = [ "schemars 1.2.3", "serde", "serde_json_lenient", - "shadow-rs", + "shadow-rs 2.0.0", + "sysinfo 0.38.4", "sysinfo 0.39.6", + "sysinfo 0.40.0", "thiserror 2.0.21", + "version-linux", + "version-macos", "which", "win-msgbox", "windows 0.62.2", @@ -3650,6 +3898,50 @@ dependencies = [ "komorebi-protocol", ] +[[package]] +name = "komorebic-linux" +version = "0.1.0" +dependencies = [ + "chrono", + "clap", + "clap_complete", + "color-eyre", + "dirs 7.0.0", + "fs-tail", + "komorebi-client-linux", + "komorebi-config", + "komorebi-hotkeys", + "komorebi-linux", + "komorebic-core", + "lazy_static", + "schemars 1.2.3", + "serde_json_lenient", + "sysinfo 0.40.0", + "version-linux", +] + +[[package]] +name = "komorebic-macos" +version = "0.1.1" +dependencies = [ + "chrono", + "clap", + "clap_complete", + "color-eyre", + "dirs 6.0.0", + "fs-tail", + "komorebi-client-macos", + "komorebi-config", + "komorebic-core", + "lazy_static", + "reqwest", + "schemars 1.2.3", + "serde_json_lenient", + "shadow-rs 1.7.1", + "sysinfo 0.38.4", + "version-macos", +] + [[package]] name = "komorebic-no-console" version = "0.1.42" @@ -3814,6 +4106,15 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "lock_api" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65d91b22da179613dcf4d6ec8349563f52a363f6849e03b00dd0a185ec4a59af" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.34" @@ -3989,6 +4290,15 @@ dependencies = [ "unicase", ] +[[package]] +name = "minidom" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe549115a674f5ec64c754d85e37d6f42664bd0ef4ffb62b619489ad99c6cb1a" +dependencies = [ + "quick-xml 0.17.2", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -4108,6 +4418,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "nanoid" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8" +dependencies = [ + "rand 0.8.8", +] + [[package]] name = "nanoid" version = "0.5.0" @@ -4175,6 +4494,28 @@ dependencies = [ "winapi", ] +[[package]] +name = "netdev" +version = "0.40.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b0a0096d9613ee878dba89bbe595f079d373e3f1960d882e4f2f78ff9c30a0a" +dependencies = [ + "block2 0.6.2", + "dispatch2", + "dlopen2 0.5.0", + "ipnet", + "libc", + "mac-addr", + "netlink-packet-core 0.8.2", + "netlink-packet-route 0.29.0", + "netlink-sys 0.8.8", + "objc2-core-foundation", + "objc2-system-configuration", + "once_cell", + "plist", + "windows-sys 0.59.0", +] + [[package]] name = "netdev" version = "0.46.3" @@ -4183,15 +4524,15 @@ checksum = "c3c52c2584961c68f5a6e3356797344061f818c93b8acc9cd6d7e284795e563e" dependencies = [ "block2 0.6.2", "dispatch2", - "dlopen2", + "dlopen2 0.8.2", "ipnet", "jni 0.21.1", "libc", "mac-addr", "ndk-context", - "netlink-packet-core", - "netlink-packet-route", - "netlink-sys", + "netlink-packet-core 0.9.0", + "netlink-packet-route 0.33.0", + "netlink-sys 0.9.0", "objc2-core-foundation", "objc2-system-configuration", "once_cell", @@ -4199,12 +4540,33 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "netlink-packet-core" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b897d7bd4f0af82e68d40d0344cf37e97f9c97ddf74a098de3e4da05e96ca395" +dependencies = [ + "paste", +] + [[package]] name = "netlink-packet-core" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d6e2daf9a8c2e21302714706860a0e6be02e03d17294ecc66b354ea7d4059dd" +[[package]] +name = "netlink-packet-route" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9854ea6ad14e3f4698a7f03b65bce0833dd2d81d594a0e4a984170537146b6" +dependencies = [ + "bitflags 2.13.2", + "libc", + "log", + "netlink-packet-core 0.8.2", +] + [[package]] name = "netlink-packet-route" version = "0.33.0" @@ -4214,10 +4576,21 @@ dependencies = [ "bitflags 2.13.2", "libc", "log", - "netlink-packet-core", + "netlink-packet-core 0.9.0", "zerocopy", ] +[[package]] +name = "netlink-sys" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd6c30ed10fa69cc491d491b85cc971f6bdeb8e7367b7cde2ee6cc878d583fae" +dependencies = [ + "bytes", + "libc", + "log", +] + [[package]] name = "netlink-sys" version = "0.9.0" @@ -4315,7 +4688,7 @@ dependencies = [ "crossbeam-channel", "file-id", "notify", - "parking_lot", + "parking_lot 0.12.5", "walkdir", ] @@ -4334,7 +4707,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4461,6 +4834,15 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "num_threads" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cabcc654086861f9e1bc5115258de62ef92c79b20f4615a1b0cc57c4e82027d4" +dependencies = [ + "libc", +] + [[package]] name = "objc" version = "0.2.7" @@ -4518,10 +4900,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ "bitflags 2.13.2", + "libc", "objc2 0.6.5", "objc2-core-foundation", "objc2-core-graphics", "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "objc2-application-services" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69282c2b5bc58fba07cb9de2113619532eb551e98efe3d8d695509ef45fbd53b" +dependencies = [ + "bitflags 2.13.2", + "libc", + "objc2-core-foundation", ] [[package]] @@ -4780,6 +5175,17 @@ dependencies = [ "objc2-foundation 0.3.2", ] +[[package]] +name = "objc2-security" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe137109bd1e8b5a99390f77a7d8b2961dafc1a1c5db8f2e60329ad6d895a" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + [[package]] name = "objc2-symbols" version = "0.2.2" @@ -4797,7 +5203,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7216bd11cbda54ccabcab84d523dc93b858ec75ecfb3a7d89513fa22464da396" dependencies = [ "bitflags 2.13.2", + "dispatch2", + "libc", + "objc2 0.6.5", "objc2-core-foundation", + "objc2-security", ] [[package]] @@ -5067,8 +5477,18 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ - "lock_api", - "parking_lot_core", + "lock_api 0.4.14", + "parking_lot_core 0.9.12", +] + +[[package]] +name = "parking_lot" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9cf937ca4e1d0b7578784559063422fc39ae7c5a00f02471f2614d5486fd226" +dependencies = [ + "lock_api 0.5.0", + "parking_lot_core 0.10.0", ] [[package]] @@ -5080,12 +5500,26 @@ dependencies = [ "backtrace", "cfg-if 1.0.5", "libc", - "petgraph", + "petgraph 0.6.5", "redox_syscall 0.5.18", "smallvec", "windows-link 0.2.1", ] +[[package]] +name = "parking_lot_core" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cfff060068cc18aa7815010fcaf80c68c7fb9e85fc7f5c0f9bf142c21d19826" +dependencies = [ + "backtrace", + "libc", + "petgraph 0.8.3", + "redox_syscall 0.9.5", + "smallvec", + "windows-link 0.2.1", +] + [[package]] name = "paste" version = "1.0.15" @@ -5116,10 +5550,22 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ - "fixedbitset", + "fixedbitset 0.4.2", "indexmap 2.14.2", ] +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset 0.5.7", + "hashbrown 0.15.5", + "indexmap 2.14.2", + "serde", +] + [[package]] name = "phf" version = "0.11.3" @@ -5455,6 +5901,15 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" +[[package]] +name = "quick-xml" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe1e430bdcf30c9fdc25053b9c459bb1a4672af4617b6c783d7d91dc17c6bbb0" +dependencies = [ + "memchr", +] + [[package]] name = "quick-xml" version = "0.41.0" @@ -5473,6 +5928,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "quickxml_to_serde" +version = "0.6.1" +source = "git+https://github.com/LGUG2Z/quickxml_to_serde.git#312fabc913738c544dfcf299f5e73de4f6932236" +dependencies = [ + "minidom", + "regex", + "serde", + "serde_derive", + "serde_json_lenient", +] + [[package]] name = "quote" version = "1.0.47" @@ -5915,7 +6382,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -6267,6 +6734,19 @@ dependencies = [ "digest", ] +[[package]] +name = "shadow-rs" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c798acfc78a69c7b038adde44084d8df875555b091da42c90ae46257cdcc41a" +dependencies = [ + "const_format", + "git2", + "is_debug", + "time", + "tzdb", +] + [[package]] name = "shadow-rs" version = "2.0.0" @@ -6664,6 +7144,20 @@ dependencies = [ "windows 0.57.0", ] +[[package]] +name = "sysinfo" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ab6a2f8bfe508deb3c6406578252e491d299cbbf3bc0529ecc3313aee4a52f" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "windows 0.62.2", +] + [[package]] name = "sysinfo" version = "0.39.6" @@ -6679,6 +7173,21 @@ dependencies = [ "windows 0.62.2", ] +[[package]] +name = "sysinfo" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "110e37d98880fd804cd47509b90a8444f7aaaab655ae625e83cd442a8bc2ebf2" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "objc2-open-directory", + "windows 0.62.2", +] + [[package]] name = "system-configuration" version = "0.7.0" @@ -6724,10 +7233,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.4.3", + "getrandom 0.3.4", "once_cell", "rustix 1.1.6", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -6746,7 +7255,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" dependencies = [ "rustix 1.1.6", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -6840,7 +7349,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" dependencies = [ "deranged", + "libc", "num-conv", + "num_threads", "powerfmt", "serde_core", "time-core", @@ -6914,7 +7425,7 @@ dependencies = [ "bytes", "libc", "mio 1.2.4", - "parking_lot", + "parking_lot 0.12.5", "pin-project-lite", "signal-hook-registry", "socket2", @@ -7163,6 +7674,32 @@ version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" +[[package]] +name = "tz-rs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fc6c929ffa10fb34f4a3c7e9a73620a83ef2e85e47f9ec3381b8289e6762f42" + +[[package]] +name = "tzdb" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d4e985b6dda743ae7fd4140c28105316ffd75bc58258ee6cc12934e3eb7a0c" +dependencies = [ + "iana-time-zone", + "tz-rs", + "tzdb_data", +] + +[[package]] +name = "tzdb_data" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "febaa995f6852367564e16c3369988b99d471d43ed12b1255b8d294661797f1c" +dependencies = [ + "tz-rs", +] + [[package]] name = "uds_windows" version = "1.2.1" @@ -7291,6 +7828,20 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version-linux" +version = "0.1.0" +dependencies = [ + "shadow-rs 2.0.0", +] + +[[package]] +name = "version-macos" +version = "0.1.0" +dependencies = [ + "shadow-rs 1.7.1", +] + [[package]] name = "version_check" version = "0.9.5" @@ -7579,7 +8130,7 @@ dependencies = [ "js-sys", "log", "naga", - "parking_lot", + "parking_lot 0.12.5", "portable-atomic", "profiling", "raw-window-handle", @@ -7611,7 +8162,7 @@ dependencies = [ "log", "naga", "once_cell", - "parking_lot", + "parking_lot 0.12.5", "portable-atomic", "profiling", "raw-window-handle", @@ -7685,7 +8236,7 @@ dependencies = [ "objc", "once_cell", "ordered-float", - "parking_lot", + "parking_lot 0.12.5", "portable-atomic", "portable-atomic-util", "profiling", @@ -7783,7 +8334,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] @@ -8519,7 +9070,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" dependencies = [ "cfg-if 1.0.5", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -8680,11 +9231,39 @@ dependencies = [ "uuid", "windows-sys 0.61.2", "winnow", - "zbus_macros", + "zbus_macros 5.19.0", "zbus_names", "zvariant", ] +[[package]] +name = "zbus" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcff5faa63a63d5b81051740f7382017f10b3440b3f401d97f0cf0b3b39c62d9" +dependencies = [ + "async-trait", + "bitflags 2.13.2", + "endi", + "futures-core", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.6", + "serde", + "serde_repr", + "socket2", + "tokio", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow", + "zbus_macros 6.1.0", + "zbus_utils", + "zcheapstr", + "zruntime", +] + [[package]] name = "zbus-lockstep" version = "0.5.2" @@ -8724,6 +9303,18 @@ dependencies = [ "zvariant_utils", ] +[[package]] +name = "zbus_macros" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bba6e2bfe19571dc81b3e0be9f8daec6e5422db3e2eea2e766a859553e7bd37" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "zbus_utils", +] + [[package]] name = "zbus_names" version = "4.3.5" @@ -8735,6 +9326,19 @@ dependencies = [ "zvariant", ] +[[package]] +name = "zbus_utils" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c27a055b114bd9fc3686e90f62bd1fe612d523fc5f620bac3b1d2f42d3f6cab8" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.9", + "winnow", +] + [[package]] name = "zbus_xml" version = "5.2.1" @@ -8850,6 +9454,16 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" +[[package]] +name = "zruntime" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc035df602243402949ddf3dcc5bcfad7edeb732dd49ec6e605431c4eca54ce" +dependencies = [ + "futures-core", + "futures-io", +] + [[package]] name = "zune-core" version = "0.5.3" diff --git a/Cargo.toml b/Cargo.toml index 9bd2fe84..f48d405d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,42 @@ members = [ "crates/komorebi-collections", "crates/komorebi-core", "crates/komorebi-config", + "crates/komorebi-settings", + "komorebi-layouts", + "komorebi-scrolling", + "komorebic", + "komorebic-no-console", + "crates/komorebic-core", + "komorebi-bar", + "komorebi-themes", + "crates/komorebi-protocol", + "crates/komorebi-transport", + "crates/komorebi-bar-core", + "komorebi-shortcuts", + "e2e/guest/agent", + "e2e/guest/testwin", + # komorebi for KDE Plasma (Linux) and komorebi for macOS: built only on their own platform, selected + # with -p; `default-members` below is the Windows set that a bare cargo command builds + "komorebi-for-kde/komorebi", + "komorebi-for-kde/komorebic", + "komorebi-for-kde/komorebi-client", + "komorebi-for-kde/komorebi-hotkeys", + "komorebi-for-kde/version", + "komorebi-for-mac/komorebi", + "komorebi-for-mac/komorebic", + "komorebi-for-mac/komorebi-client", + "komorebi-for-mac/komorebi-bar", + "komorebi-for-mac/version", +] + +default-members = [ + "komorebi", + "komorebi-client", + "komorebi-gui", + "crates/komorebi-backend", + "crates/komorebi-collections", + "crates/komorebi-config", + "crates/komorebi-settings", "komorebi-layouts", "komorebi-scrolling", "komorebic", diff --git a/crates/komorebi-backend/src/lib.rs b/crates/komorebi-backend/src/lib.rs index 8fbde7df..20ce1958 100644 --- a/crates/komorebi-backend/src/lib.rs +++ b/crates/komorebi-backend/src/lib.rs @@ -31,6 +31,7 @@ mod error; pub mod fake; mod id; mod info; +mod registry; pub use backend::Backend; pub use backend::Batch; @@ -41,4 +42,5 @@ pub use id::MonitorId; pub use id::WindowId; pub use info::MonitorInfo; pub use info::WindowInfo; +pub use registry::Registry; pub use komorebi_layouts::Rect; diff --git a/crates/komorebi-backend/src/registry.rs b/crates/komorebi-backend/src/registry.rs new file mode 100644 index 00000000..aae9940c --- /dev/null +++ b/crates/komorebi-backend/src/registry.rs @@ -0,0 +1,312 @@ +//! A thread-safe table from a [`WindowId`] to whatever a platform needs in order to act on that +//! window from nothing but the id. +//! +//! macOS is the platform that needs it: a window there is an Accessibility element with the pid +//! of its application and the observer that reports its events, and nothing can be done to a +//! window without them. The table is generic over the handle (`H`) so that its rules can be +//! tested on any host with a stand-in handle; macOS instantiates it with its Accessibility types. +//! +//! # Rules +//! +//! 1. **Thread-safe.** Any thread may call any method. +//! 2. **Nothing of the platform runs under the lock.** [`Registry::get`] clones the handle (the +//! handle must be cheap to clone: a retained reference) and returns; the caller acts on the +//! clone with the lock released. A method that removes an entry hands the removed handle back +//! to the caller instead of dropping it inside, because dropping a macOS handle can make an +//! Accessibility round trip. This is what keeps a registry call from ever waiting on the main +//! queue, or on an application, while holding the lock (`docs/dev/seam.md` section 3.3). +//! 3. **A stale id is an error, not a panic.** Looking up an id that was never registered, was +//! removed, or was removed with its application answers [`Error::WindowGone`]. +//! 4. **Entries end** when the window is destroyed ([`Registry::remove`]), when its application +//! quits ([`Registry::remove_pid`]), and when a call on the window shows that it is gone. An +//! entry that nobody removes is a leak of a retained element; the platform removes at every +//! place it learns of a death. +//! 5. **Re-registering an id replaces the entry** and returns the old handle (a tab that is +//! now shown by another element keeps the window id). +//! +//! ``` +//! use komorebi_backend::Registry; +//! use komorebi_backend::WindowId; +//! +//! let registry: Registry<&'static str> = Registry::new(); +//! let id = WindowId::from_u32(7); +//! registry.insert(id, 100, "element"); +//! assert_eq!(registry.get(id).unwrap(), "element"); +//! +//! registry.remove(id); +//! assert!(registry.get(id).unwrap_err().is_window_gone()); +//! ``` + +use crate::Error; +use crate::Result; +use crate::WindowId; +use std::collections::HashMap; +use std::sync::Mutex; +use std::sync::MutexGuard; + +struct Entry { + pid: i32, + handle: H, +} + +/// The table. See the [module documentation](self) for its rules. +pub struct Registry { + entries: Mutex>>, +} + +impl Default for Registry { + fn default() -> Self { + Self::new() + } +} + +impl Registry { + /// Returns an empty registry. + pub fn new() -> Self { + Self { + entries: Mutex::new(HashMap::new()), + } + } + + // a thread that panicked while holding the lock cannot have left an entry half written (every + // method is a single map operation), so a poisoned lock is still good + fn lock(&self) -> MutexGuard<'_, HashMap>> { + self.entries.lock().unwrap_or_else(|e| e.into_inner()) + } + + /// Registers the window, owned by the process `pid`. Returns the handle that this replaces, + /// if the id was registered: the caller drops it, with no lock held. + #[must_use = "drop the replaced handle yourself: it is not dropped under the lock"] + pub fn insert(&self, id: WindowId, pid: i32, handle: H) -> Option { + self.lock().insert(id, Entry { pid, handle }).map(|e| e.handle) + } + + /// Replaces the handle of a window that is registered, keeping its pid. Returns the old + /// handle, or [`Error::WindowGone`] (and registers nothing) if the id is not registered. + pub fn replace(&self, id: WindowId, handle: H) -> Result { + match self.lock().get_mut(&id) { + Some(entry) => Ok(std::mem::replace(&mut entry.handle, handle)), + None => Err(Error::WindowGone(id)), + } + } + + /// Forgets the window. Returns its handle (for the caller to drop with no lock held), or + /// `None` if it was not registered, which is not an error: a death is usually seen twice. + #[must_use = "drop the removed handle yourself: it is not dropped under the lock"] + pub fn remove(&self, id: WindowId) -> Option { + self.lock().remove(&id).map(|e| e.handle) + } + + /// Forgets every window of the process, as when its application quits. Returns the ids and + /// handles removed, sorted by id. + #[must_use = "drop the removed handles yourself: they are not dropped under the lock"] + pub fn remove_pid(&self, pid: i32) -> Vec<(WindowId, H)> { + let mut entries = self.lock(); + let ids: Vec = entries + .iter() + .filter(|(_, e)| e.pid == pid) + .map(|(id, _)| *id) + .collect(); + let mut removed: Vec<(WindowId, H)> = ids + .into_iter() + .filter_map(|id| entries.remove(&id).map(|e| (id, e.handle))) + .collect(); + drop(entries); + removed.sort_by_key(|(id, _)| *id); + removed + } + + /// Whether the id is registered. + pub fn contains(&self, id: WindowId) -> bool { + self.lock().contains_key(&id) + } + + /// The pid of the registered window, or [`Error::WindowGone`]. + pub fn pid(&self, id: WindowId) -> Result { + self.lock() + .get(&id) + .map(|e| e.pid) + .ok_or(Error::WindowGone(id)) + } + + /// How many windows are registered. + pub fn len(&self) -> usize { + self.lock().len() + } + + /// Whether nothing is registered. + pub fn is_empty(&self) -> bool { + self.lock().is_empty() + } + + /// The registered ids, sorted. + pub fn ids(&self) -> Vec { + let mut ids: Vec<_> = self.lock().keys().copied().collect(); + ids.sort(); + ids + } +} + +impl Registry { + /// A clone of the handle of the window, or [`Error::WindowGone`] for an id that is not + /// registered. The lock is released before this returns. + pub fn get(&self, id: WindowId) -> Result { + self.lock() + .get(&id) + .map(|e| e.handle.clone()) + .ok_or(Error::WindowGone(id)) + } + + /// Clones of every handle with their ids, sorted by id. + pub fn snapshot(&self) -> Vec<(WindowId, H)> { + let mut all: Vec<_> = self + .lock() + .iter() + .map(|(id, e)| (*id, e.handle.clone())) + .collect(); + all.sort_by_key(|(id, _)| *id); + all + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::sync::Arc; + use std::sync::atomic::AtomicUsize; + use std::sync::atomic::Ordering; + + fn id(n: u32) -> WindowId { + WindowId::from_u32(n) + } + + #[test] + fn a_registered_window_is_found_by_its_id() { + let r = Registry::new(); + assert!(r.insert(id(1), 10, "a").is_none()); + assert!(matches!(r.get(id(1)), Ok("a"))); + assert!(matches!(r.pid(id(1)), Ok(10))); + assert!(r.contains(id(1))); + } + + #[test] + fn an_unknown_id_is_window_gone_and_not_a_panic() { + let r: Registry<&str> = Registry::new(); + assert!(matches!(r.get(id(9)), Err(Error::WindowGone(w)) if w == id(9))); + assert!(matches!(r.pid(id(9)), Err(Error::WindowGone(_)))); + assert!(r.get(id(9)).unwrap_err().is_window_gone()); + } + + #[test] + fn a_removed_window_is_stale() { + let r = Registry::new(); + let _ = r.insert(id(1), 10, "a"); + assert_eq!(r.remove(id(1)), Some("a")); + assert!(r.get(id(1)).unwrap_err().is_window_gone()); + // a death seen twice is not an error + assert_eq!(r.remove(id(1)), None); + } + + #[test] + fn reinserting_replaces_and_hands_back_the_old_handle() { + let r = Registry::new(); + let _ = r.insert(id(1), 10, "tab one"); + assert_eq!(r.insert(id(1), 10, "tab two"), Some("tab one")); + assert!(matches!(r.get(id(1)), Ok("tab two"))); + assert_eq!(r.len(), 1); + } + + #[test] + fn replace_keeps_the_pid_and_refuses_a_stale_id() { + let r = Registry::new(); + let _ = r.insert(id(1), 10, "a"); + assert!(matches!(r.replace(id(1), "b"), Ok("a"))); + assert!(matches!(r.pid(id(1)), Ok(10))); + assert!(r.replace(id(2), "c").unwrap_err().is_window_gone()); + assert!(!r.contains(id(2))); + } + + #[test] + fn an_application_quitting_takes_all_its_windows_and_only_them() { + let r = Registry::new(); + let _ = r.insert(id(3), 10, "c"); + let _ = r.insert(id(1), 10, "a"); + let _ = r.insert(id(2), 20, "b"); + + assert_eq!(r.remove_pid(10), vec![(id(1), "a"), (id(3), "c")]); + assert_eq!(r.ids(), vec![id(2)]); + assert!(r.get(id(1)).unwrap_err().is_window_gone()); + assert_eq!(r.remove_pid(10), vec![]); + } + + #[test] + fn snapshot_is_sorted_and_independent_of_later_changes() { + let r = Registry::new(); + let _ = r.insert(id(2), 1, "b"); + let _ = r.insert(id(1), 1, "a"); + let snap = r.snapshot(); + let _ = r.remove(id(1)); + assert_eq!(snap, vec![(id(1), "a"), (id(2), "b")]); + } + + /// A handle whose drop would, on macOS, make a round trip: it must not run under the lock. + struct Probe { + registry: Arc>>, + drops: Arc, + } + + impl Drop for Probe { + fn drop(&mut self) { + // would deadlock if the registry dropped the handle while holding its lock + let _ = self.registry.len(); + self.drops.fetch_add(1, Ordering::SeqCst); + } + } + + #[test] + fn handles_are_never_dropped_under_the_lock() { + let registry = Arc::new(Registry::new()); + let drops = Arc::new(AtomicUsize::new(0)); + let probe = |_: u32| { + Arc::new(Probe { + registry: registry.clone(), + drops: drops.clone(), + }) + }; + + let _ = registry.insert(id(1), 10, probe(1)); + // the replaced and the removed handles come back to us, so their drop runs here + drop(registry.insert(id(1), 10, probe(2))); + drop(registry.remove(id(1))); + let _ = registry.insert(id(2), 10, probe(3)); + drop(registry.remove_pid(10)); + + assert_eq!(drops.load(Ordering::SeqCst), 3); + assert!(registry.is_empty()); + } + + #[test] + fn many_threads_can_register_look_up_and_remove() { + let r = Arc::new(Registry::new()); + let threads: Vec<_> = (0..8u32) + .map(|t| { + let r = r.clone(); + std::thread::spawn(move || { + for n in 0..200u32 { + let wid = id(t * 1000 + n); + let _ = r.insert(wid, t as i32, n); + assert!(matches!(r.get(wid), Ok(v) if v == n)); + assert_eq!(r.remove(wid), Some(n)); + assert!(r.get(wid).unwrap_err().is_window_gone()); + } + }) + }) + .collect(); + + for t in threads { + t.join().unwrap(); + } + + assert!(r.is_empty()); + } +} diff --git a/crates/komorebi-bar-core/Cargo.toml b/crates/komorebi-bar-core/Cargo.toml index c339bcbe..c788591e 100644 --- a/crates/komorebi-bar-core/Cargo.toml +++ b/crates/komorebi-bar-core/Cargo.toml @@ -9,15 +9,23 @@ chrono = { workspace = true } chrono-tz = { workspace = true } eframe = { workspace = true } egui-phosphor = { git = "https://github.com/amPerl/egui-phosphor", rev = "d13688738478ecd12b426e3e74c59d6577a85b59" } +lazy_static = { workspace = true } +image = "0.25" +komorebi-config = { path = "../komorebi-config", default-features = false } reqwest = { version = "0.12", features = ["blocking"] } +komorebi-layouts = { path = "../../komorebi-layouts" } +komorebi-themes = { path = "../../komorebi-themes", default-features = false } +komorebi-protocol = { path = "../komorebi-protocol", default-features = false } serde = { workspace = true } -serde_json = { workspace = true } +color-eyre = { workspace = true } +serde_json = { workspace = true, features = ["preserve_order"] } starship-battery = "0.11" sysinfo = { workspace = true } +tracing = { workspace = true } # Optional dependencies schemars = { workspace = true, optional = true } [features] default = ["schemars"] -schemars = ["dep:schemars"] +schemars = ["dep:schemars", "komorebi-config/schemars", "komorebi-layouts/schemars", "komorebi-themes/schemars", "komorebi-protocol/schemars"] diff --git a/komorebi-bar/src/config.rs b/crates/komorebi-bar-core/src/config/komobar.rs similarity index 95% rename from komorebi-bar/src/config.rs rename to crates/komorebi-bar-core/src/config/komobar.rs index 637f6292..1298c775 100644 --- a/komorebi-bar/src/config.rs +++ b/crates/komorebi-bar-core/src/config/komobar.rs @@ -1,7 +1,8 @@ -use crate::AUTO_SELECT_FILL_COLOUR; -use crate::AUTO_SELECT_TEXT_COLOUR; -use crate::DEFAULT_PADDING; -use crate::bar::exec_powershell; +use crate::config::types::*; +use crate::statics::AUTO_SELECT_FILL_COLOUR; +use crate::statics::AUTO_SELECT_TEXT_COLOUR; +use crate::statics::DEFAULT_PADDING; +use crate::platform::platform; use crate::render::Grouping; use crate::render::RenderConfig; use crate::render::RenderExt; @@ -11,9 +12,9 @@ use eframe::egui::Context; use eframe::egui::FontId; use eframe::egui::TextBuffer; use eframe::egui::TextStyle; -use komorebi_client::PathExt; -use komorebi_client::Rect; -use komorebi_client::SocketMessage; +use komorebi_protocol::pathext::PathExt; +use komorebi_layouts::Rect; +use komorebi_protocol::message::SocketMessage; use komorebi_themes::colour::Colour; use komorebi_themes::colour::Rgb; use serde::Deserialize; @@ -424,7 +425,7 @@ pub struct KomorebiMouseMessage { #[cfg_attr(feature = "schemars", schemars(extend("default" = true)))] pub ignore_mouse_follows_focus: Option, /// The message to send to the komorebi client - pub message: komorebi_client::SocketMessage, + pub message: komorebi_protocol::message::SocketMessage, } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -497,7 +498,7 @@ impl MouseMessage { tracing::debug!("Sending messages: {messages:?}"); - if komorebi_client::send_batch(messages).is_err() { + if platform().send_komorebi_batch(messages).is_err() { tracing::error!("could not send commands"); } } @@ -506,7 +507,10 @@ impl MouseMessage { let cmd_no_env = cmd.replace_env(); - if exec_powershell(cmd_no_env.to_str().expect("Invalid command")).is_err() { + if platform() + .exec_shell_command(cmd_no_env.to_str().expect("Invalid command")) + .is_err() + { tracing::error!("Failed to execute '{}'", cmd); } } @@ -522,6 +526,18 @@ impl KomobarConfig { _ => panic!("unsupported format"), }; + crate::widgets::widget::warn_unsupported( + value + .left_widgets + .iter() + .chain(value.center_widgets.iter().flatten()) + .chain(value.right_widgets.iter()), + ); + + if value.mouse.is_some() && !cfg!(target_os = "windows") { + tracing::warn!("the `mouse` options are not supported on this platform and are ignored"); + } + if value.frame.is_none() { value.frame = Some(FrameConfig { inner_margin: Position { @@ -586,5 +602,4 @@ impl RenderExt for &KomobarConfig { } } -pub use komorebi_bar_core::config::types::*; pub use komorebi_themes::KomobarTheme; diff --git a/crates/komorebi-bar-core/src/config/mod.rs b/crates/komorebi-bar-core/src/config/mod.rs index 26535e72..2f58be3a 100644 --- a/crates/komorebi-bar-core/src/config/mod.rs +++ b/crates/komorebi-bar-core/src/config/mod.rs @@ -1,3 +1,5 @@ +pub mod komobar; pub mod types; +pub use komobar::*; pub use types::*; diff --git a/crates/komorebi-bar-core/src/lib.rs b/crates/komorebi-bar-core/src/lib.rs index 9088d849..fcf4bf3a 100644 --- a/crates/komorebi-bar-core/src/lib.rs +++ b/crates/komorebi-bar-core/src/lib.rs @@ -18,3 +18,5 @@ pub mod render; pub mod widgets; pub mod platform; + +pub mod schema; diff --git a/crates/komorebi-bar-core/src/platform.rs b/crates/komorebi-bar-core/src/platform.rs index 635e5dc3..c7c2316e 100644 --- a/crates/komorebi-bar-core/src/platform.rs +++ b/crates/komorebi-bar-core/src/platform.rs @@ -3,6 +3,8 @@ //! A shell implements [`BarPlatform`] and calls [`install`] first thing in `main`; the widgets //! reach it through [`platform`] when they are built or clicked. +use crate::widgets::icons::ImageIcon; +use komorebi_protocol::message::SocketMessage; use std::io; use std::sync::OnceLock; @@ -17,6 +19,9 @@ pub enum SystemTool { NetworkSettings, /// A URL, in the default browser Url(String), + /// The location a storage widget label names (the label text, as shown: the platform + /// knows how its labels are built), in the file manager + StorageLocation(String), } pub trait BarPlatform: Send + Sync { @@ -26,6 +31,19 @@ pub trait BarPlatform: Send + Sync { /// The GitHub API URL that says which release of this platform's komorebi is the latest. fn latest_release_api_url(&self) -> &'static str; + /// The icon of the program a command string would start (Windows: the executable's icon; + /// macOS: none). + fn command_icon(&self, command: &str) -> Option; + + /// Runs a command line in the bar's shell session (Windows: its PowerShell session). + fn exec_shell_command(&self, command: &str) -> color_eyre::Result<()>; + + /// Sends one message to the komorebi daemon. + fn send_komorebi_message(&self, message: &SocketMessage) -> io::Result<()>; + + /// Sends messages to the komorebi daemon as one batch. + fn send_komorebi_batch(&self, messages: Vec) -> io::Result<()>; + /// The glyph the date widget shows as its calendar icon. fn calendar_icon(&self) -> &'static str; } diff --git a/crates/komorebi-bar-core/src/schema/changes.rs b/crates/komorebi-bar-core/src/schema/changes.rs new file mode 100644 index 00000000..8175560b --- /dev/null +++ b/crates/komorebi-bar-core/src/schema/changes.rs @@ -0,0 +1,99 @@ +//! What the macOS bar's schema says differently from the union, as data. +//! +//! The union is written once: it is the Windows text of `schema.bar.json` (every widget, the +//! mouse options, Windows' spelling of the documentation). The macOS view removes what the macOS +//! bar does not have (the keyboard, media and systray widgets, the mouse options and their +//! definitions, which pruning of the unreachable definitions finishes) and sets the text and the +//! defaults that read differently. Each entry is a convergence candidate: dropping one changes +//! one line of `komorebi-for-mac/schema.bar.json` and of `nix/komorebi-bar-options.nix`. +//! +//! Generated from the difference between the two checked-in files; `tests/schema_oracle.rs` +//! proves that the view of the Windows file is byte-identical to the macOS file. + +/// One change of a view +#[derive(Clone, Copy, Debug)] +pub enum Change { + /// Replace the value at the JSON pointer with this JSON text + Set(&'static str), + /// Remove the key at the JSON pointer + Remove, + /// Remove the elements of the array at the JSON pointer whose `title` is this + RemoveTitled(&'static str), +} + +/// The changes of the macOS view, in order. +pub const MACOS: &[(&str, Change)] = &[ + ( + "/description", + Change::Set( + r####""The `komorebi.bar.json` static configuration file reference for komorebi for Mac `v0.1.0`\n\n`\"$schema\": \"https://komorebi-for-mac.lgug2z.com/komorebi.bar.0.1.0.schema.json\"`""####, + ), + ), + ( + "/properties/height", + Change::Set( + r####"{"description":"Bar height","type":["number","null"],"format":"float","default":50.0}"####, + ), + ), + ( + "/properties/margin", + Change::Set( + r####"{"description":"Bar margin. Use one value for all sides or use a grouped margin for horizontal and/or\nvertical definition which can each take a single value for a symmetric margin or two\nvalues for each side, i.e.:\n```json\n\"margin\": {\n \"horizontal\": 10.0\n}\n```\nor:\n```json\n\"margin\": {\n \"vertical\": [top, bottom]\n}\n```\nYou can also set individual margin on each side like this:\n```json\n\"margin\": {\n \"top\": 10.0,\n \"bottom\": 10.0,\n \"left\": 10.0,\n \"right\": 10.0\n}\n```","anyOf":[{"$ref":"#/$defs/SpacingKind"},{"type":"null"}]}"####, + ), + ), + ( + "/properties/padding", + Change::Set( + r####"{"description":"Bar padding. Use one value for all sides or use a grouped padding for horizontal and/or\nvertical definition which can each take a single value for a symmetric padding or two\nvalues for each side, i.e.:\n```json\n\"padding\": {\n \"horizontal\": 10.0\n}\n```\nor:\n```json\n\"padding\": {\n \"horizontal\": [left, right]\n}\n```\nYou can also set individual padding on each side like this:\n```json\n\"padding\": {\n \"top\": 10.0,\n \"bottom\": 10.0,\n \"left\": 10.0,\n \"right\": 10.0\n}\n```","anyOf":[{"$ref":"#/$defs/SpacingKind"},{"type":"null"}]}"####, + ), + ), + ("/properties/mouse", Change::Remove), + ( + "/$defs/KomorebiFocusedContainerConfig/properties/show_icon", + Change::Set( + r####"{"description":"DEPRECATED: use 'display' instead (Show the icon of the currently focused container)","type":["boolean","null"]}"####, + ), + ), + ( + "/$defs/KomorebiLayout", + Change::Set( + r####"{"description":"Komorebi layout kind","oneOf":[{"title":"Default","description":"Predefined layout","type":"object","properties":{"Default":{"$ref":"#/$defs/DefaultLayout"}},"additionalProperties":false,"required":["Default"]},{"description":"Monocle mode","type":"string","const":"Monocle"},{"description":"Floating layer","type":"string","const":"Floating"},{"description":"Paused","type":"string","const":"Paused"},{"description":"Custom layout","type":"string","const":"Custom"}]}"####, + ), + ), + ( + "/$defs/NetworkConfig/properties/default_interface_options", + Change::Remove, + ), + ( + "/$defs/StorageDisplayName/oneOf/0/description", + Change::Set(r####""Display label as mount point eg. /""####), + ), + ( + "/$defs/StorageDisplayName/oneOf/1/description", + Change::Set(r####""Display label as name eg. Macintosh HD""####), + ), + ( + "/$defs/StorageDisplayName/oneOf/2/description", + Change::Set(r####""Display label as mount then name eg. / Macintosh HD""####), + ), + ( + "/$defs/StorageDisplayName/oneOf/3/description", + Change::Set(r####""Display label as name then mount eg. Macintosh HD /""####), + ), + ( + "/$defs/TimeConfig/properties/changing_icon", + Change::Set( + r####"{"description":"Change the icon depending on the time. The default icon is used between 8:30 and 12:00","type":["boolean","null"],"default":false}"####, + ), + ), + ( + "/$defs/TimeFormat/oneOf/6/title", + Change::Set(r####""Default""####), + ), + ( + "/$defs/WidgetConfig/oneOf", + Change::RemoveTitled("Keyboard"), + ), + ("/$defs/WidgetConfig/oneOf", Change::RemoveTitled("Media")), + ("/$defs/WidgetConfig/oneOf", Change::RemoveTitled("Systray")), +]; diff --git a/crates/komorebi-bar-core/src/schema/mod.rs b/crates/komorebi-bar-core/src/schema/mod.rs new file mode 100644 index 00000000..ee284574 --- /dev/null +++ b/crates/komorebi-bar-core/src/schema/mod.rs @@ -0,0 +1,128 @@ +//! The JSON Schema of `komorebi.bar.json`, one per platform, as views of one union. +//! +//! The union is the Windows schema: every widget and option any bar reads, in Windows' spelling. +//! [`view_of`] turns it into the schema a platform checks in: it applies the platform's +//! [`changes`] and removes the definitions nothing refers to any more. The Windows view is the +//! union itself. +//! +//! The changes are idempotent (setting text that is already there, or removing what is not +//! there, does nothing), so a bar can print its own generated schema through its view. + +pub mod changes; + +use changes::Change; +use serde_json::Map; +use serde_json::Value; + +/// A platform that has a bar +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum SchemaPlatform { + Windows, + MacOs, +} + +/// The changes a platform's view applies, in order +#[must_use] +pub const fn changes_of(platform: SchemaPlatform) -> &'static [(&'static str, Change)] { + match platform { + SchemaPlatform::Windows => &[], + SchemaPlatform::MacOs => changes::MACOS, + } +} + +/// The text a bar prints for `--schema`: pretty JSON followed by a newline, of the view of the +/// union of the bar configuration. +#[must_use] +pub fn view_text(union: Value, platform: SchemaPlatform) -> String { + let mut text = + serde_json::to_string_pretty(&view_of(union, platform)).expect("a schema is JSON"); + text.push('\n'); + text +} + +/// The view of `schema` for `platform`. +#[must_use] +pub fn view_of(mut schema: Value, platform: SchemaPlatform) -> Value { + for (pointer, change) in changes_of(platform) { + apply(&mut schema, pointer, *change); + } + prune_unreachable(&mut schema); + schema +} + +fn apply(schema: &mut Value, pointer: &str, change: Change) { + match change { + Change::Set(json) => { + if let Some(target) = schema.pointer_mut(pointer) { + *target = serde_json::from_str(json).expect("a change is JSON"); + } + } + Change::Remove => { + if let Some((parent, key)) = pointer.rsplit_once('/') + && let Some(Value::Object(map)) = schema.pointer_mut(parent) + { + map.retain(|k, _| k != key); + } + } + Change::RemoveTitled(title) => { + if let Some(Value::Array(items)) = schema.pointer_mut(pointer) { + items.retain(|item| item.get("title").and_then(Value::as_str) != Some(title)); + } + } + } +} + +/// Keep the definitions that the schema refers to, directly or through another definition. +fn prune_unreachable(schema: &mut Value) { + let mut reachable = Vec::new(); + collect_refs(schema, &mut reachable); + let Some(defs) = schema.get("$defs").and_then(Value::as_object).cloned() else { + return; + }; + let mut next = 0; + while next < reachable.len() { + if let Some(def) = defs.get(&reachable[next]) { + let mut found = Vec::new(); + collect_refs(def, &mut found); + for name in found { + if !reachable.contains(&name) { + reachable.push(name); + } + } + } + next += 1; + } + let kept: Map = defs + .into_iter() + .filter(|(name, _)| reachable.contains(name)) + .collect(); + schema["$defs"] = Value::Object(kept); +} + +fn collect_refs(value: &Value, found: &mut Vec) { + match value { + Value::Object(map) => { + if let Some(Value::String(target)) = map.get("$ref") + && let Some(name) = target.strip_prefix("#/$defs/") + && !found.iter().any(|n| n == name) + { + found.push(name.to_string()); + } + for (key, child) in map { + if key != "$defs" { + collect_refs(child, found); + } + } + } + Value::Array(items) => items.iter().for_each(|item| collect_refs(item, found)), + _ => {} + } +} + +/// The text `--schema` prints for the bar configuration type `T`, as `platform` checks it in. +#[cfg(feature = "schemars")] +#[must_use] +pub fn generated_text(platform: SchemaPlatform) -> String { + let union = serde_json::to_value(schemars::schema_for!(T)).expect("a schema is JSON"); + view_text(union, platform) +} diff --git a/komorebi-bar/src/widgets/applications.rs b/crates/komorebi-bar-core/src/widgets/applications.rs similarity index 90% rename from komorebi-bar/src/widgets/applications.rs rename to crates/komorebi-bar-core/src/widgets/applications.rs index 20bc1fe3..2bdcd18a 100644 --- a/komorebi-bar/src/widgets/applications.rs +++ b/crates/komorebi-bar-core/src/widgets/applications.rs @@ -1,4 +1,5 @@ -use super::ImageIcon; +use super::icons::ImageIcon; +use crate::platform::platform; use crate::render::RenderConfig; use crate::selected_frame::SelectableFrame; use crate::widgets::widget::BarWidget; @@ -17,17 +18,14 @@ use eframe::egui::StrokeKind; use eframe::egui::Ui; use eframe::egui::Vec2; use eframe::egui::vec2; -use komorebi_client::PathExt; +use komorebi_protocol::pathext::PathExt; use serde::Deserialize; use serde::Serialize; -use std::borrow::Cow; -use std::path::Path; use std::process::Command; use std::sync::Arc; use std::time::Duration; use std::time::Instant; use tracing; -use which::which; /// Minimum interval between consecutive application launches to prevent accidental spamming. const MIN_LAUNCH_INTERVAL: Duration = Duration::from_millis(800); @@ -273,13 +271,7 @@ impl Icon { /// - Returns `None` if the executable path is unavailable or icon extraction fails. #[inline] pub fn try_from_command(command: &UserCommand) -> Option { - let path = command.get_executable()?; - let image_icon = ImageIcon::try_load(path.as_ref(), || { - let path_str = path.to_str()?; - windows_icons::get_icon_by_path(path_str) - .or_else(|| windows_icons_fallback::get_icon_by_path(path_str)) - })?; - Some(Icon::Image(image_icon)) + platform().command_icon(&command.command).map(Icon::Image) } /// Renders the icon in the given [`Ui`] using the provided [`IconConfig`]. @@ -364,28 +356,6 @@ impl UserCommand { } } - /// Attempts to resolve the executable path from the command string. - /// - /// Resolution logic: - /// - Splits the command by ".exe" and checks if the first part is an existing file. - /// - If not, attempts to locate the binary using [`which`] on this name. - /// - If still unresolved, takes the first word (separated by whitespace) and attempts - /// to find it in the system `PATH` using [`which`]. - /// - /// Returns `None` if no executable path can be determined. - #[inline] - pub fn get_executable(&self) -> Option> { - if let Some(binary) = self.command.split(".exe").next().map(Path::new) { - if binary.is_file() { - return Some(Cow::Borrowed(binary)); - } else if let Ok(binary) = which(binary) { - return Some(Cow::Owned(binary)); - } - } - - which(self.command.split(' ').next()?).ok().map(Cow::Owned) - } - /// Attempts to launch the specified command in a separate thread if enough time has passed /// since the last launch. This prevents repeated launches from rapid consecutive clicks. /// diff --git a/komorebi-bar/src/widgets/mod.rs b/crates/komorebi-bar-core/src/widgets/icons.rs similarity index 92% rename from komorebi-bar/src/widgets/mod.rs rename to crates/komorebi-bar-core/src/widgets/icons.rs index 02250e4f..6c6d66ff 100644 --- a/komorebi-bar/src/widgets/mod.rs +++ b/crates/komorebi-bar-core/src/widgets/icons.rs @@ -9,23 +9,6 @@ use std::sync::Arc; use std::sync::LazyLock; use std::sync::RwLock; -pub mod applications; -pub use komorebi_bar_core::widgets::battery; -pub use komorebi_bar_core::widgets::cpu; -pub use komorebi_bar_core::widgets::date; -pub mod keyboard; -pub mod komorebi; -mod komorebi_layout; -pub mod media; -pub use komorebi_bar_core::widgets::memory; -pub mod network; -pub mod storage; -#[cfg(target_os = "windows")] -pub mod systray; -pub mod time; -pub use komorebi_bar_core::widgets::update; -pub mod widget; - /// Global cache for icon images and their associated GPU textures. pub static ICONS_CACHE: IconsCache = IconsCache::new(); @@ -103,7 +86,7 @@ impl IconsCache { } #[inline] -pub(crate) fn rgba_to_color_image(rgba_image: &RgbaImage) -> ColorImage { +pub fn rgba_to_color_image(rgba_image: &RgbaImage) -> ColorImage { let size = [rgba_image.width() as usize, rgba_image.height() as usize]; let pixels = rgba_image.as_flat_samples(); ColorImage::from_rgba_unmultiplied(size, pixels.as_slice()) @@ -166,6 +149,8 @@ pub enum ImageIconId { Hwnd(isize), /// System tray icon identifier. SystrayIcon(String), + /// macOS window ID. + WindowId(u32), } impl From<&Path> for ImageIconId { @@ -181,3 +166,16 @@ impl From for ImageIconId { Self::Hwnd(value) } } + +impl From for ImageIconId { + #[inline] + fn from(value: u32) -> Self { + Self::WindowId(value) + } +} + +impl Default for IconsCache { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/komorebi-bar-core/src/widgets/komorebi_config.rs b/crates/komorebi-bar-core/src/widgets/komorebi_config.rs new file mode 100644 index 00000000..ab75ca74 --- /dev/null +++ b/crates/komorebi-bar-core/src/widgets/komorebi_config.rs @@ -0,0 +1,158 @@ +//! The configuration of the komorebi widgets (workspaces, layout, focused container, ...) and +//! the layout kind the layout widget shows: data only, shared by both bars. + +use crate::config::DisplayFormat; +use crate::config::WorkspacesDisplayFormat; +use color_eyre::eyre; +use serde::Deserialize; +use serde::Deserializer; +use serde::Serialize; +use serde::de::Error; +use serde_json::from_str; +use std::collections::BTreeMap; +use std::fmt::Display; +use std::fmt::Formatter; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Komorebi widget configuration +pub struct KomorebiConfig { + /// Configure the Workspaces widget + pub workspaces: Option, + /// Configure the Layout widget + pub layout: Option, + /// Configure the Workspace Layer widget + pub workspace_layer: Option, + /// Configure the Focused Container widget + #[serde(alias = "focused_window")] + pub focused_container: Option, + /// Configure the Locked Container widget + pub locked_container: Option, + /// Configure the Configuration Switcher widget + pub configuration_switcher: Option, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Komorebi widget workspaces configuration +pub struct KomorebiWorkspacesConfig { + /// Enable the Komorebi Workspaces widget + pub enable: bool, + /// Hide workspaces without any windows + pub hide_empty_workspaces: bool, + /// Display format of the workspace + pub display: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Komorebi widget layout configuration +pub struct KomorebiLayoutConfig { + /// Enable the Komorebi Layout widget + pub enable: bool, + /// List of layout options + pub options: Option>, + /// Display format of the current layout + pub display: Option, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Komorebi widget workspace layer configuration +pub struct KomorebiWorkspaceLayerConfig { + /// Enable the Komorebi Workspace Layer widget + pub enable: bool, + /// Display format of the current layer + pub display: Option, + /// Show the widget event if the layer is Tiling + pub show_when_tiling: Option, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Komorebi widget focused container configuration +pub struct KomorebiFocusedContainerConfig { + /// Enable the Komorebi Focused Container widget + pub enable: bool, + /// DEPRECATED: use `display` instead (Show the icon of the currently focused container) + #[deprecated(note = "Use `display` instead")] + pub show_icon: Option, + /// Display format of the currently focused container + pub display: Option, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Komorebi widget locked container configuration +pub struct KomorebiLockedContainerConfig { + /// Enable the Komorebi Locked Container widget + pub enable: bool, + /// Display format of the current locked state + pub display: Option, + /// Show the widget event if the layer is unlocked + pub show_when_unlocked: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Komorebi widget configuration switcher configuration +pub struct KomorebiConfigurationSwitcherConfig { + /// Enable the Komorebi Configurations widget + pub enable: bool, + /// A map of display friendly name => path to configuration.json + pub configurations: BTreeMap, +} + +#[derive(Copy, Clone, Debug, Serialize, PartialEq)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[serde(untagged)] +/// Komorebi layout kind +pub enum KomorebiLayout { + /// Predefined layout + #[cfg_attr(feature = "schemars", schemars(title = "Default"))] + Default(komorebi_layouts::DefaultLayout), + /// Monocle mode + Monocle, + /// Floating layer + Floating, + /// Paused + Paused, + /// Custom layout + Custom, +} + +impl<'de> Deserialize<'de> for KomorebiLayout { + fn deserialize(deserializer: D) -> eyre::Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + + // Attempt to deserialize the string as a DefaultLayout + if let Ok(default_layout) = from_str::(&format!("\"{s}\"")) + { + return Ok(KomorebiLayout::Default(default_layout)); + } + + // Handle other cases + match s.as_str() { + "Monocle" => Ok(KomorebiLayout::Monocle), + "Floating" => Ok(KomorebiLayout::Floating), + "Paused" => Ok(KomorebiLayout::Paused), + "Custom" => Ok(KomorebiLayout::Custom), + _ => Err(Error::custom(format!("Invalid layout: {s}"))), + } + } +} + +impl Display for KomorebiLayout { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + KomorebiLayout::Default(layout) => write!(f, "{layout}"), + KomorebiLayout::Monocle => write!(f, "Monocle"), + KomorebiLayout::Floating => write!(f, "Floating"), + KomorebiLayout::Paused => write!(f, "Paused"), + KomorebiLayout::Custom => write!(f, "Custom"), + } + } +} diff --git a/komorebi-bar/src/widgets/komorebi_layout.rs b/crates/komorebi-bar-core/src/widgets/komorebi_layout.rs similarity index 74% rename from komorebi-bar/src/widgets/komorebi_layout.rs rename to crates/komorebi-bar-core/src/widgets/komorebi_layout.rs index 5c35246c..8ac4218f 100644 --- a/komorebi-bar/src/widgets/komorebi_layout.rs +++ b/crates/komorebi-bar-core/src/widgets/komorebi_layout.rs @@ -1,8 +1,9 @@ use crate::config::DisplayFormat; use crate::render::RenderConfig; use crate::selected_frame::SelectableFrame; -use crate::widgets::komorebi::KomorebiLayoutConfig; -use color_eyre::eyre; +use crate::platform::platform; +use crate::widgets::komorebi_config::KomorebiLayout; +use crate::widgets::komorebi_config::KomorebiLayoutConfig; use eframe::egui::Context; use eframe::egui::CornerRadius; use eframe::egui::FontId; @@ -14,70 +15,30 @@ use eframe::egui::StrokeKind; use eframe::egui::Ui; use eframe::egui::Vec2; use eframe::egui::vec2; -use komorebi_client::SocketMessage; -use serde::Deserialize; -use serde::Deserializer; -use serde::Serialize; -use serde::de::Error; -use serde_json::from_str; -use std::fmt::Display; -use std::fmt::Formatter; +use komorebi_protocol::message::SocketMessage; -#[derive(Copy, Clone, Debug, Serialize, PartialEq)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(untagged)] -/// Komorebi layout kind -pub enum KomorebiLayout { - /// Predefined layout - #[cfg_attr(feature = "schemars", schemars(title = "Default"))] - Default(komorebi_client::DefaultLayout), - /// Monocle mode - Monocle, - /// Floating layer - Floating, - /// Paused - Paused, - /// Custom layout - Custom, +/// What the layout widget does with a layout kind (the kind itself lives in the core). +pub trait KomorebiLayoutExt { + fn is_default(&mut self) -> bool; + fn on_click( + &mut self, + show_options: &bool, + monitor_idx: usize, + workspace_idx: Option, + ) -> bool; + fn on_click_option(&mut self, monitor_idx: usize, workspace_idx: Option); + fn show_icon(&mut self, is_selected: bool, font_id: FontId, ctx: &Context, ui: &mut Ui); + fn show( + &mut self, + ctx: &Context, + ui: &mut Ui, + render_config: &mut RenderConfig, + layout_config: &KomorebiLayoutConfig, + workspace_idx: Option, + ); } -impl<'de> Deserialize<'de> for KomorebiLayout { - fn deserialize(deserializer: D) -> eyre::Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - - // Attempt to deserialize the string as a DefaultLayout - if let Ok(default_layout) = from_str::(&format!("\"{s}\"")) - { - return Ok(KomorebiLayout::Default(default_layout)); - } - - // Handle other cases - match s.as_str() { - "Monocle" => Ok(KomorebiLayout::Monocle), - "Floating" => Ok(KomorebiLayout::Floating), - "Paused" => Ok(KomorebiLayout::Paused), - "Custom" => Ok(KomorebiLayout::Custom), - _ => Err(Error::custom(format!("Invalid layout: {s}"))), - } - } -} - -impl Display for KomorebiLayout { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - match self { - KomorebiLayout::Default(layout) => write!(f, "{layout}"), - KomorebiLayout::Monocle => write!(f, "Monocle"), - KomorebiLayout::Floating => write!(f, "Floating"), - KomorebiLayout::Paused => write!(f, "Paused"), - KomorebiLayout::Custom => write!(f, "Custom"), - } - } -} - -impl KomorebiLayout { +impl KomorebiLayoutExt for KomorebiLayout { fn is_default(&mut self) -> bool { matches!(self, KomorebiLayout::Default(_)) } @@ -100,7 +61,7 @@ impl KomorebiLayout { match self { KomorebiLayout::Default(option) => { if let Some(ws_idx) = workspace_idx - && komorebi_client::send_message(&SocketMessage::WorkspaceLayout( + && platform().send_komorebi_message(&SocketMessage::WorkspaceLayout( monitor_idx, ws_idx, *option, @@ -111,7 +72,7 @@ impl KomorebiLayout { } } KomorebiLayout::Monocle => { - if komorebi_client::send_batch([ + if platform().send_komorebi_batch(vec![ SocketMessage::FocusMonitorAtCursor, SocketMessage::ToggleMonocle, ]) @@ -121,7 +82,7 @@ impl KomorebiLayout { } } KomorebiLayout::Floating => { - if komorebi_client::send_batch([ + if platform().send_komorebi_batch(vec![ SocketMessage::FocusMonitorAtCursor, SocketMessage::ToggleTiling, ]) @@ -131,7 +92,7 @@ impl KomorebiLayout { } } KomorebiLayout::Paused => { - if komorebi_client::send_message(&SocketMessage::TogglePause).is_err() { + if platform().send_komorebi_message(&SocketMessage::TogglePause).is_err() { tracing::error!("could not send message to komorebi: TogglePause"); } } @@ -158,44 +119,44 @@ impl KomorebiLayout { match self { KomorebiLayout::Default(layout) => match layout { - komorebi_client::DefaultLayout::BSP => { + komorebi_layouts::DefaultLayout::BSP => { painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); painter.line_segment([c, c + vec2(r, 0.0)], stroke); painter.line_segment([c + vec2(r / 2.0, 0.0), c + vec2(r / 2.0, r)], stroke); } - komorebi_client::DefaultLayout::Columns => { + komorebi_layouts::DefaultLayout::Columns => { painter.line_segment([c - vec2(r / 2.0, r), c + vec2(-r / 2.0, r)], stroke); painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); painter.line_segment([c - vec2(-r / 2.0, r), c + vec2(r / 2.0, r)], stroke); } - komorebi_client::DefaultLayout::Rows => { + komorebi_layouts::DefaultLayout::Rows => { painter.line_segment([c - vec2(r, r / 2.0), c + vec2(r, -r / 2.0)], stroke); painter.line_segment([c - vec2(r, 0.0), c + vec2(r, 0.0)], stroke); painter.line_segment([c - vec2(r, -r / 2.0), c + vec2(r, r / 2.0)], stroke); } - komorebi_client::DefaultLayout::VerticalStack => { + komorebi_layouts::DefaultLayout::VerticalStack => { painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); painter.line_segment([c, c + vec2(r, 0.0)], stroke); } - komorebi_client::DefaultLayout::RightMainVerticalStack => { + komorebi_layouts::DefaultLayout::RightMainVerticalStack => { painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); painter.line_segment([c - vec2(r, 0.0), c], stroke); } - komorebi_client::DefaultLayout::HorizontalStack => { + komorebi_layouts::DefaultLayout::HorizontalStack => { painter.line_segment([c - vec2(r, 0.0), c + vec2(r, 0.0)], stroke); painter.line_segment([c, c + vec2(0.0, r)], stroke); } - komorebi_client::DefaultLayout::UltrawideVerticalStack => { + komorebi_layouts::DefaultLayout::UltrawideVerticalStack => { painter.line_segment([c - vec2(r / 2.0, r), c + vec2(-r / 2.0, r)], stroke); painter.line_segment([c + vec2(r / 2.0, 0.0), c + vec2(r, 0.0)], stroke); painter.line_segment([c - vec2(-r / 2.0, r), c + vec2(r / 2.0, r)], stroke); } - komorebi_client::DefaultLayout::Grid => { + komorebi_layouts::DefaultLayout::Grid => { painter.line_segment([c - vec2(r, 0.0), c + vec2(r, 0.0)], stroke); painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); } // TODO: @CtByte can you think of a nice icon to draw here? - komorebi_client::DefaultLayout::Scrolling => { + komorebi_layouts::DefaultLayout::Scrolling => { painter.line_segment([c - vec2(r / 2.0, r), c + vec2(-r / 2.0, r)], stroke); painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); painter.line_segment([c - vec2(-r / 2.0, r), c + vec2(r / 2.0, r)], stroke); @@ -242,7 +203,7 @@ impl KomorebiLayout { } } - pub fn show( + fn show( &mut self, ctx: &Context, ui: &mut Ui, @@ -284,18 +245,18 @@ impl KomorebiLayout { ); let mut layout_options = layout_config.options.clone().unwrap_or(vec![ - KomorebiLayout::Default(komorebi_client::DefaultLayout::BSP), - KomorebiLayout::Default(komorebi_client::DefaultLayout::Columns), - KomorebiLayout::Default(komorebi_client::DefaultLayout::Rows), - KomorebiLayout::Default(komorebi_client::DefaultLayout::VerticalStack), + KomorebiLayout::Default(komorebi_layouts::DefaultLayout::BSP), + KomorebiLayout::Default(komorebi_layouts::DefaultLayout::Columns), + KomorebiLayout::Default(komorebi_layouts::DefaultLayout::Rows), + KomorebiLayout::Default(komorebi_layouts::DefaultLayout::VerticalStack), KomorebiLayout::Default( - komorebi_client::DefaultLayout::RightMainVerticalStack, + komorebi_layouts::DefaultLayout::RightMainVerticalStack, ), - KomorebiLayout::Default(komorebi_client::DefaultLayout::HorizontalStack), + KomorebiLayout::Default(komorebi_layouts::DefaultLayout::HorizontalStack), KomorebiLayout::Default( - komorebi_client::DefaultLayout::UltrawideVerticalStack, + komorebi_layouts::DefaultLayout::UltrawideVerticalStack, ), - KomorebiLayout::Default(komorebi_client::DefaultLayout::Grid), + KomorebiLayout::Default(komorebi_layouts::DefaultLayout::Grid), //KomorebiLayout::Custom, KomorebiLayout::Monocle, KomorebiLayout::Floating, diff --git a/crates/komorebi-bar-core/src/widgets/mod.rs b/crates/komorebi-bar-core/src/widgets/mod.rs index 42d16a57..a07b36fe 100644 --- a/crates/komorebi-bar-core/src/widgets/mod.rs +++ b/crates/komorebi-bar-core/src/widgets/mod.rs @@ -1,6 +1,14 @@ +pub mod applications; pub mod battery; pub mod cpu; pub mod date; +pub mod icons; +pub mod komorebi_config; +pub mod komorebi_layout; pub mod memory; +pub mod network_config; +pub mod platform_config; +pub mod storage; +pub mod time; pub mod update; pub mod widget; diff --git a/crates/komorebi-bar-core/src/widgets/network_config.rs b/crates/komorebi-bar-core/src/widgets/network_config.rs new file mode 100644 index 00000000..d958b453 --- /dev/null +++ b/crates/komorebi-bar-core/src/widgets/network_config.rs @@ -0,0 +1,66 @@ +//! The configuration of the network widget: data only, shared by both bars. The Windows bar +//! reads `default_interface_options`; the macOS bar accepts the key and ignores it. + +use crate::config::LabelPrefix; +use serde::Deserialize; +use serde::Serialize; + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Network widget configuration +pub struct NetworkConfig { + /// Enable the Network widget + pub enable: bool, + /// Show total received and transmitted activity + #[serde(alias = "show_total_data_transmitted")] + pub show_total_activity: bool, + /// Show received and transmitted activity + #[serde(alias = "show_network_activity")] + pub show_activity: bool, + /// Show default interface + pub show_default_interface: Option, + /// Default interface options: whether to show the friendly name, IPv4 or IPv6 address + pub default_interface_options: Option, + /// Characters to reserve for received and transmitted activity + #[serde(alias = "network_activity_fill_characters")] + pub activity_left_padding: Option, + /// Data refresh interval in seconds + #[cfg_attr(feature = "schemars", schemars(extend("default" = 10)))] + pub data_refresh_interval: Option, + /// Display label prefix + pub label_prefix: Option, + /// Select when the value is over a limit (1MiB is 1048576 bytes (1024*1024)) + pub auto_select: Option, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Network select configuration +pub struct NetworkSelectConfig { + /// Select the total received data when it's over this value + pub total_received_over: Option, + /// Select the total transmitted data when it's over this value + pub total_transmitted_over: Option, + /// Select the received data when it's over this value + pub received_over: Option, + /// Select the transmitted data when it's over this value + pub transmitted_over: Option, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize, Default)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Which IP address to show for the default interface +pub enum InterfaceDisplayType { + #[default] + FriendlyName, + Ipv4, + Ipv6, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Default interface configuration +pub struct DefaultInterfaceConfig { + #[serde(default)] + pub display_type: InterfaceDisplayType, +} diff --git a/crates/komorebi-bar-core/src/widgets/platform_config.rs b/crates/komorebi-bar-core/src/widgets/platform_config.rs new file mode 100644 index 00000000..746fc7db --- /dev/null +++ b/crates/komorebi-bar-core/src/widgets/platform_config.rs @@ -0,0 +1,131 @@ +//! The configuration types of the widgets only the Windows bar runs (keyboard, media, system +//! tray). They are data without any platform code, so that `WidgetConfig` can name every widget +//! and the schema is one union that each platform's view prunes (see `schema`). + +use crate::config::LabelPrefix; +use crate::config::MediaDisplayFormat; +use komorebi_config::matching::MatchingStrategy; +use serde::Deserialize; +use serde::Serialize; + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Keyboard widget configuration +pub struct KeyboardConfig { + /// Enable the Input widget + pub enable: bool, + /// Data refresh interval + #[cfg_attr(feature = "schemars", schemars(extend("default" = 10)))] + pub data_refresh_interval: Option, + /// Display label prefix + pub label_prefix: Option, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Media widget configuration +pub struct MediaConfig { + /// Enable the Media widget + pub enable: bool, + /// Display format of the media widget (defaults to IconAndText) + pub display: Option, +} + +#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Position of the overflow toggle button +pub enum OverflowTogglePosition { + /// Toggle button appears on the left side (before visible icons) + Left, + /// Toggle button appears on the right side (after visible icons) + #[default] + Right, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Where to place a systray button (refresh, info, shortcuts, etc.) +pub enum ButtonPosition { + /// Show in the main visible area + Visible, + /// Show in the overflow/hidden section + Overflow, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[serde(untagged)] +/// A field value with an optional matching strategy. +/// +/// A plain string uses exact (case-insensitive) matching. +/// An object with `value` and `matching_strategy` uses the specified strategy. +pub enum FieldMatch { + /// Exact case-insensitive match + Exact(String), + /// Match using a specific strategy + WithStrategy { + /// The value to match against + value: String, + /// How to match (Equals, StartsWith, EndsWith, Contains, Regex, etc.) + matching_strategy: MatchingStrategy, + }, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[serde(untagged)] +/// Rule for matching a systray icon to hide +/// +/// A plain string matches the exe name (backward compatible). +/// An object with optional `exe`, `tooltip`, and/or `guid` fields +/// uses AND logic: all specified fields must match. +/// Each field can be a plain string (exact match) or an object with +/// `value` and `matching_strategy` for advanced matching. +pub enum HiddenIconRule { + /// Match by exe name (case-insensitive, exact) + Exe(String), + /// Match by one or more properties (all specified fields must match) + Match { + /// Exe name to match + exe: Option, + /// Tooltip text to match + tooltip: Option, + /// Icon GUID to match (most stable identifier across restarts) + guid: Option, + }, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// System tray widget configuration +pub struct SystrayConfig { + /// Enable the System Tray widget + pub enable: bool, + /// A list of rules for icons to hide from the system tray + /// + /// Each entry can be a plain string (matches exe name, case-insensitive) + /// or an object with optional `exe`, `tooltip`, and/or `guid` fields + /// (all specified fields must match, AND logic, case-insensitive). + /// + /// Run komorebi-bar with RUST_LOG=info to see the properties of all + /// systray icons in the log output. + pub hidden_icons: Option>, + /// Position of the overflow toggle button (default: Right) + pub overflow_toggle_position: Option, + /// Show an info button that opens a floating panel listing all systray icons + /// with their exe, tooltip, and GUID. Set to "Visible" to show it in the main + /// area, or "Overflow" to show it in the hidden/overflow section. + pub info_button: Option, + /// Interval in seconds to automatically check for and remove stale icons + /// whose owning process has exited. Clamped between 30 and 600 seconds. + /// Defaults to 60. Set to 0 to disable. + pub stale_icons_check_interval: Option, + /// Show a refresh button that manually triggers stale icon cleanup. + /// Set to "Visible" to show it in the main area, or "Overflow" to + /// show it in the hidden/overflow section. + pub refresh_button: Option, + /// Show a button that toggles komorebi-shortcuts (kills the process if + /// running, starts it otherwise). Set to "Visible" to show it in the main + /// area, or "Overflow" to show it in the hidden/overflow section. + pub shortcuts_button: Option, +} diff --git a/komorebi-bar/src/widgets/storage.rs b/crates/komorebi-bar-core/src/widgets/storage.rs similarity index 94% rename from komorebi-bar/src/widgets/storage.rs rename to crates/komorebi-bar-core/src/widgets/storage.rs index 12d3c440..70bfe5ef 100644 --- a/komorebi-bar/src/widgets/storage.rs +++ b/crates/komorebi-bar-core/src/widgets/storage.rs @@ -1,4 +1,4 @@ -use crate::bar::Alignment; +use crate::alignment::Alignment; use crate::config::LabelPrefix; use crate::render::RenderConfig; use crate::selected_frame::SelectableFrame; @@ -11,7 +11,8 @@ use eframe::egui::Ui; use eframe::egui::text::LayoutJob; use serde::Deserialize; use serde::Serialize; -use std::process::Command; +use crate::platform::SystemTool; +use crate::platform::platform; use std::time::Duration; use std::time::Instant; use sysinfo::Disks; @@ -190,13 +191,8 @@ impl BarWidget for Storage { if SelectableFrame::new_auto(output.selected, auto_focus_fill) .show(ui, |ui| ui.add(Label::new(layout_job).selectable(false))) .clicked() - && let Err(error) = Command::new("cmd.exe") - .args([ - "/C", - "explorer.exe", - output.label.split(' ').collect::>()[0], - ]) - .spawn() + && let Err(error) = platform() + .open_system_tool(SystemTool::StorageLocation(output.label.clone())) { eprintln!("{error}") } diff --git a/komorebi-bar/src/widgets/time.rs b/crates/komorebi-bar-core/src/widgets/time.rs similarity index 99% rename from komorebi-bar/src/widgets/time.rs rename to crates/komorebi-bar-core/src/widgets/time.rs index 0dd75299..044de33c 100644 --- a/komorebi-bar/src/widgets/time.rs +++ b/crates/komorebi-bar-core/src/widgets/time.rs @@ -1,4 +1,4 @@ -use crate::bar::Alignment; +use crate::alignment::Alignment; use crate::config::LabelPrefix; use crate::render::RenderConfig; use crate::selected_frame::SelectableFrame; diff --git a/crates/komorebi-bar-core/src/widgets/widget.rs b/crates/komorebi-bar-core/src/widgets/widget.rs index f992a972..b8638582 100644 --- a/crates/komorebi-bar-core/src/widgets/widget.rs +++ b/crates/komorebi-bar-core/src/widgets/widget.rs @@ -1,7 +1,132 @@ use crate::render::RenderConfig; +use crate::widgets::applications::ApplicationsConfig; +use crate::widgets::battery::BatteryConfig; +use crate::widgets::cpu::CpuConfig; +use crate::widgets::date::DateConfig; +use crate::widgets::komorebi_config::KomorebiConfig; +use crate::widgets::memory::MemoryConfig; +use crate::widgets::network_config::NetworkConfig; +use crate::widgets::platform_config::KeyboardConfig; +use crate::widgets::platform_config::MediaConfig; +use crate::widgets::platform_config::SystrayConfig; +use crate::widgets::storage::StorageConfig; +use crate::widgets::time::TimeConfig; +use crate::widgets::update::UpdateConfig; use eframe::egui::Context; use eframe::egui::Ui; +use serde::Deserialize; +use serde::Serialize; pub trait BarWidget { fn render(&mut self, ctx: &Context, ui: &mut Ui, config: &mut RenderConfig); } + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +/// Widget configuration +pub enum WidgetConfig { + /// Applications widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Applications"))] + Applications(ApplicationsConfig), + /// Battery widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Battery"))] + Battery(BatteryConfig), + /// CPU widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Cpu"))] + Cpu(CpuConfig), + /// Date widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Date"))] + Date(DateConfig), + /// Keyboard widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Keyboard"))] + Keyboard(KeyboardConfig), + /// Komorebi widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Komorebi"))] + Komorebi(KomorebiConfig), + /// Media widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Media"))] + Media(MediaConfig), + /// Memory widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Memory"))] + Memory(MemoryConfig), + /// Network widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Network"))] + Network(NetworkConfig), + /// Storage widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Storage"))] + Storage(StorageConfig), + /// System Tray widget configuration (Windows only) + #[cfg_attr(feature = "schemars", schemars(title = "Systray"))] + Systray(SystrayConfig), + /// Time widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Time"))] + Time(TimeConfig), + /// Update widget configuration + #[cfg_attr(feature = "schemars", schemars(title = "Update"))] + Update(UpdateConfig), +} + +impl WidgetConfig { + /// The widget a configuration key names, if the platform this bar runs on has it. The + /// keyboard, media and system tray widgets exist on Windows only: elsewhere the key is + /// accepted and skipped (see [`WidgetConfig::unsupported`]). + #[must_use] + pub const fn supported(&self) -> bool { + !matches!( + self, + WidgetConfig::Keyboard(_) | WidgetConfig::Media(_) | WidgetConfig::Systray(_) + ) || cfg!(target_os = "windows") + } + + /// The name of this widget when the platform cannot run it. + #[must_use] + pub const fn unsupported(&self) -> Option<&'static str> { + if self.supported() { + return None; + } + + match self { + WidgetConfig::Keyboard(_) => Some("Keyboard"), + WidgetConfig::Media(_) => Some("Media"), + WidgetConfig::Systray(_) => Some("Systray"), + _ => None, + } + } + + /// Whether the widget is enabled and can run on this platform. + #[must_use] + pub fn enabled(&self) -> bool { + self.supported() + && match self { + WidgetConfig::Applications(config) => config.enable, + WidgetConfig::Battery(config) => config.enable, + WidgetConfig::Cpu(config) => config.enable, + WidgetConfig::Date(config) => config.enable, + WidgetConfig::Keyboard(config) => config.enable, + WidgetConfig::Komorebi(config) => { + config.workspaces.as_ref().is_some_and(|w| w.enable) + || config.layout.as_ref().is_some_and(|w| w.enable) + || config.focused_container.as_ref().is_some_and(|w| w.enable) + || config + .configuration_switcher + .as_ref() + .is_some_and(|w| w.enable) + } + WidgetConfig::Media(config) => config.enable, + WidgetConfig::Memory(config) => config.enable, + WidgetConfig::Network(config) => config.enable, + WidgetConfig::Storage(config) => config.enable, + WidgetConfig::Systray(config) => config.enable, + WidgetConfig::Time(config) => config.enable, + WidgetConfig::Update(config) => config.enable, + } + } +} + +/// Logs a warning for every widget in `widgets` that this platform cannot run; they are accepted +/// in the configuration and skipped. +pub fn warn_unsupported<'a>(widgets: impl IntoIterator) { + for name in widgets.into_iter().filter_map(WidgetConfig::unsupported) { + tracing::warn!("the {name} widget is not supported on this platform and is skipped"); + } +} diff --git a/crates/komorebi-bar-core/tests/schema_oracle.rs b/crates/komorebi-bar-core/tests/schema_oracle.rs index 510057e8..59054bea 100644 --- a/crates/komorebi-bar-core/tests/schema_oracle.rs +++ b/crates/komorebi-bar-core/tests/schema_oracle.rs @@ -76,3 +76,73 @@ fn the_checked_in_bar_schemas_are_json_schemas_of_komobar_config() { assert!(text.ends_with("}\n"), "{}", pin.file); } } + +mod views { + use komorebi_bar_core::schema::SchemaPlatform; + use komorebi_bar_core::schema::view_text; + + fn text(file: &str) -> String { + String::from_utf8(super::read(file)).expect("utf-8") + } + + /// The Windows file is the union; its Windows view is itself. + #[test] + fn the_windows_view_of_the_union_is_the_windows_file() { + let union = serde_json::from_str(&text("schema.bar.json")).expect("json"); + assert!(view_text(union, SchemaPlatform::Windows) == text("schema.bar.json")); + } + + /// The macOS view of the union is the macOS file, byte for byte. + #[test] + fn the_macos_view_of_the_union_is_the_macos_file() { + let union = serde_json::from_str(&text("schema.bar.json")).expect("json"); + let view = view_text(union, SchemaPlatform::MacOs); + let file = text("komorebi-for-mac/schema.bar.json"); + if view != file { + let first = view.lines().zip(file.lines()).position(|(a, b)| a != b); + panic!( + "the views differ, first at line {first:?} (view {} lines, file {})", + view.lines().count(), + file.lines().count() + ); + } + } + + /// A view applied to its own output changes nothing, so a bar can print its generated + /// schema through it. + #[test] + fn a_view_is_idempotent() { + let union = serde_json::from_str(&text("schema.bar.json")).expect("json"); + let once = view_text(union, SchemaPlatform::MacOs); + let again = view_text( + serde_json::from_str(&once).expect("json"), + SchemaPlatform::MacOs, + ); + assert!(once == again); + } +} + +mod generated { + use komorebi_bar_core::config::KomobarConfig; + use komorebi_bar_core::schema::SchemaPlatform; + use komorebi_bar_core::schema::generated_text; + + /// The schema the core generates from its own types, through the macOS view, is the macOS + /// file. (Not tested for Windows: three descriptions in komorebi-protocol and the themes + /// crate read differently when compiled for Windows, which a Linux test host cannot do; the + /// out-of-tree harness covers it.) + #[test] + fn the_generated_macos_view_is_the_macos_file() { + let file = + String::from_utf8(super::read("komorebi-for-mac/schema.bar.json")).expect("utf-8"); + let text = generated_text::(SchemaPlatform::MacOs); + if text != file { + let first = text.lines().zip(file.lines()).position(|(a, b)| a != b); + panic!( + "differs, first at line {first:?} ({} lines, file {})", + text.lines().count(), + file.lines().count() + ); + } + } +} diff --git a/crates/komorebi-config/src/static_config.rs b/crates/komorebi-config/src/static_config.rs index b08e339f..109e040f 100644 --- a/crates/komorebi-config/src/static_config.rs +++ b/crates/komorebi-config/src/static_config.rs @@ -617,7 +617,7 @@ impl StaticConfig { /// # Errors /// /// The file cannot be read, or it is not a configuration. - pub fn read(path: &PathBuf) -> color_eyre::Result { + pub fn read(path: &std::path::Path) -> color_eyre::Result { let content = std::fs::read_to_string(path)?; serde_json::from_str(&content).map_err(Into::into) } diff --git a/crates/komorebi-settings/Cargo.toml b/crates/komorebi-settings/Cargo.toml new file mode 100644 index 00000000..b807819d --- /dev/null +++ b/crates/komorebi-settings/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "komorebi-settings" +version = "0.1.42" +edition = "2024" +description = "The settings every komorebi daemon reads while it runs: one immutable snapshot, replaced as a whole, instead of process-wide statics" + +[dependencies] +komorebi-config = { path = "../komorebi-config", default-features = false } +komorebi-layouts = { path = "../../komorebi-layouts" } +komorebi-protocol = { path = "../komorebi-protocol", default-features = false } +komorebi-themes = { path = "../../komorebi-themes", default-features = false } + +parking_lot = "0.12" diff --git a/crates/komorebi-settings/src/handle.rs b/crates/komorebi-settings/src/handle.rs new file mode 100644 index 00000000..b09f2163 --- /dev/null +++ b/crates/komorebi-settings/src/handle.rs @@ -0,0 +1,263 @@ +use std::sync::Arc; + +use parking_lot::Mutex; +use parking_lot::RwLock; + +use crate::Settings; + +/// The current [`Settings`] of a daemon. +/// +/// Reading costs one uncontended read lock and an `Arc` clone; the lock is held for the clone +/// only, never while the caller uses the snapshot. The representation (an `RwLock>`) is +/// private: it can become an `ArcSwap` later without touching a caller. +pub struct Handle

{ + current: RwLock>>, + // Serialises writers. Readers never take it. + writers: Mutex<()>, +} + +impl

Handle

{ + pub fn new(settings: Settings

) -> Self { + Self { + current: RwLock::new(Arc::new(settings)), + writers: Mutex::new(()), + } + } + + /// The settings as they are now. Take it once per unit of work (one border render, one + /// layout pass, one rule check) and use it for all of it. + pub fn snapshot(&self) -> Arc> { + Arc::clone(&self.current.read()) + } + + /// Publish a whole new value. Readers that already hold a snapshot keep the old one. + pub fn replace(&self, settings: Settings

) { + let _writer = self.writers.lock(); + *self.current.write() = Arc::new(settings); + } +} + +impl Handle

{ + /// Copy the current value, let `edit` change the copy and publish it once. + /// + /// Writers are serialised for the whole call, so an `update` never overwrites a change made by + /// another `update` that ran at the same time. If `edit` panics nothing is published. + pub fn update(&self, edit: impl FnOnce(&mut Settings

) -> R) -> R { + let _writer = self.writers.lock(); + let mut copy = (**self.current.read()).clone(); + let result = edit(&mut copy); + *self.current.write() = Arc::new(copy); + result + } +} + +impl Handle

{ + /// Set one field now and put its previous value back when the guard is dropped. + /// + /// The previous value is restored only if the field still holds the value this call set. If a + /// reload or a command changed the field meanwhile, that change wins. (The statics did the + /// opposite: the saved value overwrote whatever had been written in between.) + pub fn scoped(&self, field: fn(&mut Settings

) -> &mut T, value: T) -> Scoped<'_, P, T> + where + T: Clone + PartialEq, + { + let previous = self.update(|settings| std::mem::replace(field(settings), value.clone())); + + Scoped { + handle: self, + field, + set: value, + previous: Some(previous), + } + } +} + +/// The guard returned by [`Handle::scoped`]. +#[must_use = "the previous value is put back when the guard is dropped"] +pub struct Scoped<'a, P: Clone + 'static, T: Clone + PartialEq> { + handle: &'a Handle

, + field: fn(&mut Settings

) -> &mut T, + set: T, + previous: Option, +} + +impl Drop for Scoped<'_, P, T> { + fn drop(&mut self) { + if let Some(previous) = self.previous.take() { + let field = self.field; + let set = &self.set; + self.handle.update(|settings| { + let slot = field(settings); + if slot == set { + *slot = previous; + } + }); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::shared::PlatformDefaults; + + #[derive(Clone, Debug, PartialEq, Default)] + struct Platform { + hiding: u8, + flag: bool, + } + + fn handle() -> Handle { + Handle::new(Settings::new( + crate::Shared::defaults_for(PlatformDefaults::KDE), + Platform::default(), + )) + } + + #[test] + fn a_snapshot_does_not_change_when_the_handle_does() { + let handle = handle(); + let before = handle.snapshot(); + + handle.update(|s| s.shared.border.width = 99); + + assert_eq!(before.shared.border.width, 10); + assert_eq!(handle.snapshot().shared.border.width, 99); + } + + #[test] + fn replace_publishes_the_whole_value() { + let handle = handle(); + let mut next = (*handle.snapshot()).clone(); + next.platform.hiding = 3; + next.shared.border.enabled = false; + + handle.replace(next); + + let now = handle.snapshot(); + assert_eq!(now.platform.hiding, 3); + assert!(!now.shared.border.enabled); + } + + #[test] + fn a_panicking_edit_publishes_nothing() { + let handle = handle(); + + let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + handle.update(|s| { + s.shared.border.width = 77; + panic!("edit failed"); + }); + })); + + assert!(result.is_err()); + assert_eq!(handle.snapshot().shared.border.width, 10); + // and the writer lock is free again + handle.update(|s| s.shared.border.width = 5); + assert_eq!(handle.snapshot().shared.border.width, 5); + } + + #[test] + fn concurrent_updates_lose_nothing() { + let handle = Arc::new(handle()); + let threads: Vec<_> = (0..8) + .map(|_| { + let handle = Arc::clone(&handle); + std::thread::spawn(move || { + for _ in 0..500 { + handle.update(|s| s.shared.border.width += 1); + } + }) + }) + .collect(); + for thread in threads { + thread.join().unwrap(); + } + + assert_eq!(handle.snapshot().shared.border.width, 10 + 8 * 500); + } + + #[test] + fn readers_never_see_half_an_update() { + // The writer keeps width and offset equal; a torn read would show them different. + let handle = Arc::new(handle()); + handle.update(|s| { + s.shared.border.width = 0; + s.shared.border.offset = 0; + }); + let stop = Arc::new(std::sync::atomic::AtomicBool::new(false)); + + let writer = { + let (handle, stop) = (Arc::clone(&handle), Arc::clone(&stop)); + std::thread::spawn(move || { + let mut n = 0; + while !stop.load(std::sync::atomic::Ordering::Relaxed) { + n += 1; + handle.update(|s| { + s.shared.border.width = n; + s.shared.border.offset = n; + }); + } + }) + }; + + for _ in 0..50_000 { + let seen = handle.snapshot(); + assert_eq!(seen.shared.border.width, seen.shared.border.offset); + } + stop.store(true, std::sync::atomic::Ordering::Relaxed); + writer.join().unwrap(); + } + + #[test] + fn scoped_puts_the_value_back() { + let handle = handle(); + + { + let _guard = handle.scoped(|s| &mut s.platform.hiding, 9); + assert_eq!(handle.snapshot().platform.hiding, 9); + } + + assert_eq!(handle.snapshot().platform.hiding, 0); + } + + #[test] + fn scoped_leaves_a_change_made_meanwhile() { + let handle = handle(); + + { + let _guard = handle.scoped(|s| &mut s.platform.hiding, 9); + // a reload writes the field while the override is held + handle.update(|s| s.platform.hiding = 4); + } + + assert_eq!(handle.snapshot().platform.hiding, 4); + } + + #[test] + fn scoped_touches_only_its_own_field() { + let handle = handle(); + + { + let _guard = handle.scoped(|s| &mut s.platform.flag, true); + handle.update(|s| s.shared.border.width = 31); + } + + let now = handle.snapshot(); + assert!(!now.platform.flag); + assert_eq!(now.shared.border.width, 31); + } + + #[test] + fn nested_scopes_unwind_in_order() { + let handle = handle(); + + let outer = handle.scoped(|s| &mut s.platform.hiding, 1); + let inner = handle.scoped(|s| &mut s.platform.hiding, 2); + assert_eq!(handle.snapshot().platform.hiding, 2); + drop(inner); + assert_eq!(handle.snapshot().platform.hiding, 1); + drop(outer); + assert_eq!(handle.snapshot().platform.hiding, 0); + } +} diff --git a/crates/komorebi-settings/src/lib.rs b/crates/komorebi-settings/src/lib.rs new file mode 100644 index 00000000..c7c0854e --- /dev/null +++ b/crates/komorebi-settings/src/lib.rs @@ -0,0 +1,41 @@ +//! The settings a daemon reads while it runs. +//! +//! Today each daemon keeps them in dozens of process-wide statics that `apply_globals` and the +//! `SocketMessage` handlers write one at a time while the border, animator and reaper threads +//! read them (see `docs/dev/settings.md`). This crate holds the replacement and nothing else: no +//! daemon uses it yet. +//! +//! * [`Settings`] is a value: a [`Shared`] part that is the same struct on every platform and a +//! platform part `P` that each daemon defines for its own subsystems. +//! * [`Handle`] holds the current value. A reader takes a [`Handle::snapshot`] once per unit of +//! work and sees one consistent configuration for all of it. A writer uses [`Handle::update`], +//! which serialises writers, so two writers never lose each other's change, and publishes the +//! result once. +//! * [`Handle::scoped`] replaces the "store a value, do work, store the old value back" pattern +//! without clobbering a change made in between. +#![warn(clippy::all)] +#![allow(clippy::missing_errors_doc, clippy::use_self, clippy::doc_markdown)] + +mod handle; +pub mod shared; + +pub use handle::Handle; +pub use handle::Scoped; +pub use shared::Shared; + +/// Every setting of one running daemon. +/// +/// `P` is the platform part: a plain type the daemon defines (the Windows stackbar and hiding +/// behaviour, the macOS tabbed-application list, ...). Shared code never looks inside it, so it is +/// a type parameter and not a trait; it needs to be `Clone` so that an update can copy the value. +#[derive(Clone, Debug, PartialEq)] +pub struct Settings

{ + pub shared: Shared, + pub platform: P, +} + +impl

Settings

{ + pub fn new(shared: Shared, platform: P) -> Self { + Self { shared, platform } + } +} diff --git a/crates/komorebi-settings/src/shared.rs b/crates/komorebi-settings/src/shared.rs new file mode 100644 index 00000000..aebbd069 --- /dev/null +++ b/crates/komorebi-settings/src/shared.rs @@ -0,0 +1,648 @@ +//! The part of the settings that is the same struct on every platform. +//! +//! Every field here has a counterpart static in each daemon (`docs/dev/settings.md`, section 2.1), +//! and [`SharedDelta::apply`] reproduces what `StaticConfig::apply_globals` does with it, including +//! which absent keys keep the old value and which are reset. + +use std::collections::HashMap; + +use komorebi_config::animation::PerAnimationPrefixConfig; +use komorebi_config::aspect_ratio::AspectRatio; +use komorebi_config::aspect_ratio::PredefinedAspectRatio; +use komorebi_layouts::DefaultLayout; +use komorebi_layouts::LayoutDefaultEntry; +use komorebi_protocol::animation::AnimationStyle; +use komorebi_protocol::animation::prefix::AnimationPrefix; +use komorebi_themes::colour::Colour; +use komorebi_themes::colour::Rgb; + +/// What `ANIMATION_FPS` becomes when `animation` is configured without `fps` +/// (`DEFAULT_ANIMATION_FPS` in each daemon). +pub const DEFAULT_ANIMATION_FPS: u64 = 60; +/// `DEFAULT_ANIMATION_ENABLED`, `DEFAULT_ANIMATION_STYLE` and `DEFAULT_ANIMATION_DURATION`. +pub const DEFAULT_ANIMATION_ENABLED: bool = false; +pub const DEFAULT_ANIMATION_STYLE: AnimationStyle = AnimationStyle::Linear; +pub const DEFAULT_ANIMATION_DURATION: u64 = 250; +/// `DEFAULT_RESIZE_DELTA` and `DEFAULT_MOUSE_FOLLOWS_FOCUS` (equal on all three platforms). +pub const DEFAULT_RESIZE_DELTA: i32 = 50; +pub const DEFAULT_MOUSE_FOLLOWS_FOCUS: bool = true; + +/// The defaults a daemon starts with. They differ per platform today (border width 8 / 10 / 10, +/// padding 10 / 5 / 5, ...) and this step does not change any of them. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct PlatformDefaults { + pub border_width: i32, + pub border_offset: i32, + pub border_radius: i32, + pub container_padding: i32, + pub workspace_padding: i32, +} + +impl PlatformDefaults { + /// `komorebi/src/border_manager/mod.rs` and `komorebi/src/lib.rs`. Windows has no border + /// radius setting; the unused value is the one the other platforms use. + pub const WINDOWS: Self = Self { + border_width: 8, + border_offset: -1, + border_radius: 10, + container_padding: 10, + workspace_padding: 10, + }; + /// `komorebi-for-kde/komorebi/src/border_manager/mod.rs` and `.../lib.rs` + pub const KDE: Self = Self { + border_width: 10, + border_offset: 0, + border_radius: 10, + container_padding: 5, + workspace_padding: 5, + }; + /// `komorebi-for-mac/komorebi/src/border_manager/mod.rs` and `.../lib.rs` + pub const MACOS: Self = Self { + border_width: 10, + border_offset: 0, + border_radius: 10, + container_padding: 5, + workspace_padding: 5, + }; +} + +/// Colours are `u32` exactly as the border statics hold them (`u32::from(Colour)`). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct BorderColours { + pub single: u32, + pub stack: u32, + pub monocle: u32, + pub floating: u32, + pub unfocused: u32, + pub unfocused_locked: u32, +} + +/// Whether and how the borders are drawn; the colours are the same on all three platforms. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Border { + pub enabled: bool, + pub width: i32, + pub offset: i32, + /// Used by KDE and macOS; Windows keeps it but never reads it. + pub radius: i32, + pub colours: BorderColours, +} + +/// The animation settings: a global value for each of enabled, style and duration, and a map of +/// per-prefix values that wins over the global one. +#[derive(Clone, Debug, PartialEq)] +pub struct Animation { + pub enabled: bool, + pub style: AnimationStyle, + pub duration: u64, + pub fps: u64, + pub enabled_per_animation: HashMap, + pub style_per_animation: HashMap, + pub duration_per_animation: HashMap, +} + +/// How a window is moved for one kind of animation: the three values `motion_for` reads today as +/// three separate statics. +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct Motion { + pub duration_ms: u64, + pub style: AnimationStyle, +} + +impl Animation { + /// `None` if `prefix` is not animated, else how. The same rule as `motion_for` (without the + /// suspension counter, which is runtime state and stays with the animation module), now read + /// from one snapshot. + pub fn motion_for(&self, prefix: AnimationPrefix) -> Option { + let enabled = self + .enabled_per_animation + .get(&prefix) + .copied() + .unwrap_or(self.enabled); + + enabled.then(|| Motion { + duration_ms: self + .duration_per_animation + .get(&prefix) + .copied() + .unwrap_or(self.duration), + style: self + .style_per_animation + .get(&prefix) + .copied() + .unwrap_or(self.style), + }) + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Defaults { + pub container_padding: i32, + pub workspace_padding: i32, + pub resize_delta: i32, + pub mouse_follows_focus: bool, +} + +/// `transparency` and `transparency_alpha` (Windows and KDE; macOS never reads them). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Transparency { + pub enabled: bool, + pub alpha: u8, +} + +/// Every setting that is not tied to one platform. +#[derive(Clone, Debug, PartialEq)] +pub struct Shared { + pub border: Border, + pub animation: Animation, + pub defaults: Defaults, + pub transparency: Transparency, + pub floating_window_aspect_ratio: AspectRatio, + pub layout_defaults: HashMap, + pub display_index_preferences: HashMap, +} + +impl Shared { + /// The values the statics hold before any configuration is read. + pub fn defaults_for(defaults: PlatformDefaults) -> Self { + Self { + border: Border { + enabled: true, + width: defaults.border_width, + offset: defaults.border_offset, + radius: defaults.border_radius, + colours: BorderColours { + single: rgb(66, 165, 245), + stack: rgb(0, 165, 66), + monocle: rgb(255, 51, 153), + floating: rgb(245, 245, 165), + unfocused: rgb(128, 128, 128), + unfocused_locked: rgb(158, 8, 8), + }, + }, + animation: Animation { + enabled: DEFAULT_ANIMATION_ENABLED, + style: DEFAULT_ANIMATION_STYLE, + duration: DEFAULT_ANIMATION_DURATION, + fps: DEFAULT_ANIMATION_FPS, + enabled_per_animation: HashMap::new(), + style_per_animation: HashMap::new(), + duration_per_animation: HashMap::new(), + }, + defaults: Defaults { + container_padding: defaults.container_padding, + workspace_padding: defaults.workspace_padding, + resize_delta: DEFAULT_RESIZE_DELTA, + mouse_follows_focus: DEFAULT_MOUSE_FOLLOWS_FOCUS, + }, + transparency: Transparency { + enabled: false, + alpha: 200, + }, + // The static starts at Widescreen; a load without the key writes Standard + // (`unwrap_or`), see `SharedDelta::floating_window_aspect_ratio`. + floating_window_aspect_ratio: AspectRatio::Predefined( + PredefinedAspectRatio::Widescreen, + ), + layout_defaults: HashMap::new(), + display_index_preferences: HashMap::new(), + } + } +} + +fn rgb(r: u32, g: u32, b: u32) -> u32 { + u32::from(Colour::Rgb(Rgb::new(r, g, b))) +} + +/// The colours a configuration file or theme names; a missing one keeps the current value. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct BorderColoursDelta { + pub single: Option, + pub stack: Option, + pub monocle: Option, + pub floating: Option, + pub unfocused: Option, + pub unfocused_locked: Option, +} + +/// The animation block of a configuration file (`enabled` is required in the file, the rest is +/// optional). +#[derive(Clone, Debug, PartialEq)] +pub struct AnimationDelta { + pub enabled: PerAnimationPrefixConfig, + pub style: Option>, + pub duration: Option>, + pub fps: Option, +} + +/// What one configuration load says about the [`Shared`] settings. `None` means "the key is not in +/// the file", and [`apply`](Self::apply) treats each `None` exactly as +/// `StaticConfig::apply_globals` does. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct SharedDelta { + pub border: Option, + pub border_width: Option, + pub border_offset: Option, + pub border_radius: Option, + pub border_colours: Option, + pub animation: Option, + pub default_container_padding: Option, + pub default_workspace_padding: Option, + pub transparency: Option, + pub transparency_alpha: Option, + pub floating_window_aspect_ratio: Option, + pub layout_defaults: Option>, + pub display_index_preferences: Option>, +} + +impl SharedDelta { + /// Merge this load into `shared`. + /// + /// * Keeps the old value when the key is absent: the border (enabled, width, offset, radius, + /// each colour), both paddings, transparency and its alpha, the display index preferences, + /// and the animation block as a whole. + /// * Resets when the key is absent: `floating_window_aspect_ratio` (to Standard, not to the + /// initial Widescreen), `layout_defaults` (cleared), and, inside a present animation block, + /// `fps` (to 60). + /// * A global animation value clears that setting's per-prefix map; a per-prefix map replaces + /// the whole map and leaves the global value alone. + pub fn apply(&self, shared: &mut Shared) { + shared.floating_window_aspect_ratio = self + .floating_window_aspect_ratio + .unwrap_or(AspectRatio::Predefined(PredefinedAspectRatio::Standard)); + + if let Some(preferences) = &self.display_index_preferences { + shared.display_index_preferences.clone_from(preferences); + } + + if let Some(animation) = &self.animation { + let target = &mut shared.animation; + + match &animation.enabled { + PerAnimationPrefixConfig::Prefix(enabled) => { + target.enabled_per_animation.clone_from(enabled); + } + PerAnimationPrefixConfig::Global(enabled) => { + target.enabled = *enabled; + target.enabled_per_animation.clear(); + } + } + + match &animation.style { + Some(PerAnimationPrefixConfig::Prefix(style)) => { + target.style_per_animation.clone_from(style); + } + Some(PerAnimationPrefixConfig::Global(style)) => { + target.style = *style; + target.style_per_animation.clear(); + } + None => {} + } + + match &animation.duration { + Some(PerAnimationPrefixConfig::Prefix(duration)) => { + target.duration_per_animation.clone_from(duration); + } + Some(PerAnimationPrefixConfig::Global(duration)) => { + target.duration = *duration; + target.duration_per_animation.clear(); + } + None => {} + } + + target.fps = animation.fps.unwrap_or(DEFAULT_ANIMATION_FPS); + } + + if let Some(container) = self.default_container_padding { + shared.defaults.container_padding = container; + } + + if let Some(workspace) = self.default_workspace_padding { + shared.defaults.workspace_padding = workspace; + } + + match &self.layout_defaults { + Some(defaults) => shared.layout_defaults.clone_from(defaults), + None => shared.layout_defaults.clear(), + } + + if let Some(width) = self.border_width { + shared.border.width = width; + } + + if let Some(offset) = self.border_offset { + shared.border.offset = offset; + } + + if let Some(radius) = self.border_radius { + shared.border.radius = radius; + } + + if let Some(enabled) = self.border { + shared.border.enabled = enabled; + } + + if let Some(colours) = &self.border_colours { + let target = &mut shared.border.colours; + if let Some(colour) = colours.single { + target.single = colour; + } + if let Some(colour) = colours.stack { + target.stack = colour; + } + if let Some(colour) = colours.monocle { + target.monocle = colour; + } + if let Some(colour) = colours.floating { + target.floating = colour; + } + if let Some(colour) = colours.unfocused { + target.unfocused = colour; + } + if let Some(colour) = colours.unfocused_locked { + target.unfocused_locked = colour; + } + } + + if let Some(enabled) = self.transparency { + shared.transparency.enabled = enabled; + } + + if let Some(alpha) = self.transparency_alpha { + shared.transparency.alpha = alpha; + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn shared() -> Shared { + Shared::defaults_for(PlatformDefaults::KDE) + } + + #[test] + fn the_platform_defaults_are_the_ones_the_statics_start_with() { + let windows = Shared::defaults_for(PlatformDefaults::WINDOWS); + assert_eq!( + (windows.border.width, windows.border.offset), + (8, -1), + "komorebi/src/border_manager/mod.rs" + ); + assert_eq!(windows.defaults.container_padding, 10); + assert_eq!(windows.defaults.workspace_padding, 10); + + for platform in [PlatformDefaults::KDE, PlatformDefaults::MACOS] { + let other = Shared::defaults_for(platform); + assert_eq!((other.border.width, other.border.offset), (10, 0)); + assert_eq!(other.defaults.container_padding, 5); + assert_eq!(other.defaults.workspace_padding, 5); + } + } + + #[test] + fn the_default_colours_are_the_theme_conversion_of_the_rgb_values() { + // Rgb packs as r | g << 8 | b << 16 (komorebi-themes), e.g. FOCUSED = (66, 165, 245) + let colours = shared().border.colours; + assert_eq!(colours.single, 66 | (165 << 8) | (245 << 16)); + assert_eq!(colours.unfocused_locked, 158 | (8 << 8) | (8 << 16)); + } + + #[test] + fn an_empty_load_keeps_everything_but_the_two_reset_keys() { + let mut shared = shared(); + shared.border.width = 33; + shared.defaults.container_padding = 7; + shared.transparency.alpha = 12; + shared.animation.fps = 144; + shared + .display_index_preferences + .insert(0, String::from("serial")); + shared.layout_defaults.insert( + DefaultLayout::BSP, + LayoutDefaultEntry { + layout_options: None, + layout_options_rules: None, + }, + ); + let before = shared.clone(); + + SharedDelta::default().apply(&mut shared); + + // kept + assert_eq!(shared.border, before.border); + assert_eq!(shared.defaults, before.defaults); + assert_eq!(shared.transparency, before.transparency); + assert_eq!(shared.animation, before.animation); + assert_eq!( + shared.display_index_preferences, + before.display_index_preferences + ); + // reset + assert!(shared.layout_defaults.is_empty()); + assert_eq!( + shared.floating_window_aspect_ratio, + AspectRatio::Predefined(PredefinedAspectRatio::Standard), + "absent key writes Standard, not the initial Widescreen" + ); + } + + #[test] + fn present_keys_replace_and_absent_colours_stay() { + let mut shared = shared(); + let before = shared.border.colours; + + SharedDelta { + border: Some(false), + border_width: Some(3), + border_offset: Some(-2), + border_radius: Some(0), + border_colours: Some(BorderColoursDelta { + single: Some(1), + unfocused_locked: Some(2), + ..BorderColoursDelta::default() + }), + default_workspace_padding: Some(1), + transparency: Some(true), + transparency_alpha: Some(9), + ..SharedDelta::default() + } + .apply(&mut shared); + + assert!(!shared.border.enabled); + assert_eq!( + ( + shared.border.width, + shared.border.offset, + shared.border.radius + ), + (3, -2, 0) + ); + assert_eq!(shared.border.colours.single, 1); + assert_eq!(shared.border.colours.unfocused_locked, 2); + assert_eq!(shared.border.colours.stack, before.stack); + assert_eq!(shared.defaults.workspace_padding, 1); + assert_eq!(shared.defaults.container_padding, 5, "absent: kept"); + assert_eq!( + shared.transparency, + Transparency { + enabled: true, + alpha: 9 + } + ); + } + + fn block( + enabled: PerAnimationPrefixConfig, + style: Option>, + duration: Option>, + fps: Option, + ) -> SharedDelta { + SharedDelta { + animation: Some(AnimationDelta { + enabled, + style, + duration, + fps, + }), + ..SharedDelta::default() + } + } + + #[test] + fn a_global_animation_value_clears_its_per_prefix_map_and_a_map_keeps_the_global() { + let mut shared = shared(); + shared + .animation + .enabled_per_animation + .insert(AnimationPrefix::Movement, true); + shared + .animation + .duration_per_animation + .insert(AnimationPrefix::Workspace, 50); + + // global enabled clears the enabled map; style absent keeps; duration map replaces the + // map and leaves the global duration alone + block( + PerAnimationPrefixConfig::Global(true), + None, + Some(PerAnimationPrefixConfig::Prefix(HashMap::from([( + AnimationPrefix::Movement, + 10, + )]))), + Some(30), + ) + .apply(&mut shared); + + assert!(shared.animation.enabled); + assert!(shared.animation.enabled_per_animation.is_empty()); + assert_eq!(shared.animation.style, DEFAULT_ANIMATION_STYLE); + assert_eq!(shared.animation.duration, DEFAULT_ANIMATION_DURATION); + assert_eq!( + shared.animation.duration_per_animation, + HashMap::from([(AnimationPrefix::Movement, 10)]) + ); + assert_eq!(shared.animation.fps, 30); + } + + #[test] + fn an_animation_block_without_fps_resets_fps_and_no_block_keeps_it() { + let mut shared = shared(); + shared.animation.fps = 144; + + SharedDelta::default().apply(&mut shared); + assert_eq!(shared.animation.fps, 144); + + block(PerAnimationPrefixConfig::Global(false), None, None, None).apply(&mut shared); + assert_eq!(shared.animation.fps, DEFAULT_ANIMATION_FPS); + } + + #[test] + fn motion_for_reads_one_consistent_configuration() { + let mut shared = shared(); + shared.animation.enabled = true; + shared.animation.duration = 250; + shared.animation.style = AnimationStyle::Linear; + shared + .animation + .duration_per_animation + .insert(AnimationPrefix::Workspace, 400); + shared + .animation + .style_per_animation + .insert(AnimationPrefix::Workspace, AnimationStyle::EaseInSine); + shared + .animation + .enabled_per_animation + .insert(AnimationPrefix::Transparency, false); + + assert_eq!( + shared.animation.motion_for(AnimationPrefix::Movement), + Some(Motion { + duration_ms: 250, + style: AnimationStyle::Linear + }) + ); + assert_eq!( + shared.animation.motion_for(AnimationPrefix::Workspace), + Some(Motion { + duration_ms: 400, + style: AnimationStyle::EaseInSine + }) + ); + assert_eq!( + shared.animation.motion_for(AnimationPrefix::Transparency), + None, + "a per-prefix false wins over a global true" + ); + } + + #[test] + fn layout_defaults_are_replaced_when_given() { + let mut shared = shared(); + let entry = LayoutDefaultEntry { + layout_options: None, + layout_options_rules: None, + }; + + SharedDelta { + layout_defaults: Some(HashMap::from([(DefaultLayout::BSP, entry.clone())])), + ..SharedDelta::default() + } + .apply(&mut shared); + assert_eq!( + shared.layout_defaults.get(&DefaultLayout::BSP), + Some(&entry) + ); + + SharedDelta { + layout_defaults: Some(HashMap::new()), + ..SharedDelta::default() + } + .apply(&mut shared); + assert!(shared.layout_defaults.is_empty()); + } + + #[test] + fn display_index_preferences_are_replaced_not_merged() { + let mut shared = shared(); + shared + .display_index_preferences + .insert(0, String::from("a")); + shared + .display_index_preferences + .insert(1, String::from("b")); + + SharedDelta { + display_index_preferences: Some(HashMap::from([(2, String::from("c"))])), + ..SharedDelta::default() + } + .apply(&mut shared); + + assert_eq!( + shared.display_index_preferences, + HashMap::from([(2, String::from("c"))]) + ); + } +} diff --git a/deny.toml b/deny.toml index c1b6953e..e9675ed5 100644 --- a/deny.toml +++ b/deny.toml @@ -43,7 +43,7 @@ allow = [ confidence-threshold = 0.8 [[licenses.clarify]] -crate = "komorebi" +crate = "komorebi-windows" expression = "LicenseRef-Komorebi-2.0" license-files = [] diff --git a/docs/dev/bar-unification.md b/docs/dev/bar-unification.md new file mode 100644 index 00000000..cad5b74d --- /dev/null +++ b/docs/dev/bar-unification.md @@ -0,0 +1,180 @@ +# One `komorebi-bar` for Windows and macOS + +Status at the revision that adds this file. Everything below was measured on this tree with +`diff` (counts are lines that differ, `<`/`>` lines of `diff`, hunks in parentheses). Nothing +here was rendered: the bars cannot run on Linux. Gates that did run are named; the ones that +did not are listed at the end. + +KDE has no bar: `komorebi-for-kde` has no `komorebi-bar` package and no `schema.bar.json`. +The plan below is for two platforms; a KDE bar would add a third shell and a third schema view. + + +## What exists + +- `crates/komorebi-bar-core` (4,592 lines): the code both bars share, one copy each. + `selected_frame`, `ui`, `statics`, `alignment`, `render`, `config` (the leaf types and the whole + `KomobarConfig` with the mouse options), the widgets `applications`, `battery`, `cpu`, `date`, + `memory`, `storage`, `time`, `update`, `komorebi_layout`, the icon cache (`widgets/icons.rs`), + all widget configuration types (`komorebi_config`, `network_config`, `platform_config` for + keyboard, media and systray), `WidgetConfig` with a variant for every widget, the `BarWidget` + trait, `platform` (`BarPlatform`, `SystemTool`, a once-installed global) and `schema` + (per-platform views, see below). +- `BarPlatform` hooks: `open_system_tool`, `latest_release_api_url`, `calendar_icon`, + `command_icon`, `exec_shell_command`, `send_komorebi_message`, `send_komorebi_batch`. +- Two shells, `komorebi-bar` (Windows, root workspace, version 0.1.42) and + `komorebi-for-mac/komorebi-bar` (own workspace, own `Cargo.lock`, own flake, version 0.1.1). + Each keeps `main.rs`, `bar.rs`, `os.rs`, the one-line `config.rs`, and the widgets whose + runtime differs: `komorebi.rs`, `network.rs`, and on Windows `keyboard.rs`, `media.rs`, + `systray.rs`. `widgets/widget.rs` is only `WidgetConfigExt` (config -> widget). +- The schema oracle regenerates the macOS file natively + (`tests/schema_oracle.rs`, module `generated`); the Windows file is still checked by the + out-of-tree harness because three descriptions read differently when compiled for Windows. + +## Why one package is not possible yet (the structural blocker) + +The two trees are two Cargo workspaces with two lockfiles and two flakes. A package belongs to +one workspace, so a single `komorebi-bar` that builds on both platforms needs one workspace +first: the Windows root `Cargo.toml` and `komorebi-for-mac/Cargo.toml` merged, one `Cargo.lock`, +one version (0.1.42 vs 0.1.0), one `komorebi-client` (the two `lib.rs` differ in 150 lines: +Windows re-exports the daemon crate and `State`/`Window`/`Workspace`, macOS has its own +types) and `windows`/`objc2` dependencies under `[target.'cfg(...)'.dependencies]`. That is a +repository-level cutover (the plan's "final naming of the outputs and the unified app/devShell +is a cutover decision"), not a bar change. Until then the bars share the crate and converge, +they do not merge. Everything in this stack is ordered so the merge later is a package move. + +## The schema is solved: views of one union + +`schema.bar.json` differs between the platforms in 40 hunks (5,381 lines of 9,091 / 3,774). +Analysed by definition (`jq` over `$defs`): + +- 42 definitions exist only on Windows: all reachable only through `MouseConfig` (which holds a + `SocketMessage`, hence the closure) and the `Keyboard`/`Media`/`Systray` widgets. Removing the + `mouse` property and the three widget variants and pruning unreachable definitions removes + all 42. +- 14 differences remain in the 55 shared definitions, all text or default: root description + (macOS names its own schema URL), `height` default `50` vs `50.0`, the margin and padding + examples (`10` vs `10.0`, a sentence about defaults, a trailing comma), `show_icon` + (deprecated flag and backticks), `KomorebiLayout` (untagged `anyOf` on Windows, externally + tagged `oneOf` on macOS), `NetworkConfig.default_interface_options` (Windows only), + four storage descriptions (`C:\` vs `/`), `TimeConfig.changing_icon` (`default: false` only + on macOS), `TimeFormat` title of `Custom` (macOS says `Default`, a mislabel), the + `WidgetConfig` variants above. + +`komorebi_bar_core::schema` holds this as data (`schema/changes.rs`, 16 changes) in the same +design as `komorebi-config`: the union is the Windows text, `view_of` applies a platform's +changes and prunes. `tests/schema_oracle.rs` proves that the macOS view of the checked-in Windows +file is byte-identical to `komorebi-for-mac/schema.bar.json`, that the Windows view is the +identity, and that views are idempotent. Both bars print `--schema` through their view +(`schema::generated_text`), so the files and `nix/komorebi-bar-options.nix` do not change when +code is converged onto the Windows spelling. + +The out-of-tree harness (`S/bar2/regen.sh`, real bar sources over the real +`komorebi-protocol`/`komorebi-config`) regenerates both files on Linux. Since `config.rs` moved, the +in-repo oracle regenerates the macOS file itself (`generated` tests); only Windows needs the harness. + +## What is still per platform (measured at this tip) + +| file | win / mac lines | differing | what differs and why it is not moved | +|---|---|---|---| +| `widgets/komorebi.rs` | 940 / 986 | 136 (17) | Two things. (1) Real rendering differences: macOS wraps `show_label` and the "all icons" painter in a `Frame` with a margin and a minimum height (`bar.show_label(...)`, a method, vs an associated function on Windows), `1.0` vs `1.0_f32`. Taking either spelling is a visual change on the other platform: needs a screen. (2) The conversion from the daemon state: Windows uses `komorebi_client::{State, Window, Workspace, Container}` (`hwnd`, `title()`, `process_id()`, windows-icons), macOS its own client types (`details.title`, `details.icon_path`, `icns_to_rgba`, `device`, no `Layout::Custom`). A State-to-snapshot split (`WindowInfo`/`MonitorInfo` of `komorebi-backend` as the carrier) is not clean yet: the macOS and Windows `komorebi_client` `State` are different types, the bar subscribes to the daemons with different notification shapes, and I cannot test either subscription here. Not attempted. | +| `widgets/network.rs` | 598 / 578 | 82 (19) | Windows reads `default_interface_options` (friendly name, IPv4, IPv6), macOS does not (the config type is shared and macOS logs a warning); `std::sync::Mutex` (poisoning handled) vs `parking_lot`; `netdev` 0.46 vs 0.40 and a different interface match key (friendly name vs `name`); `cmd.exe /C ncpa` vs `open x-apple...`. Functional on macOS: BEHAVIOUR, needs a Mac. Known difference, left as is. | +| `bar.rs` | 1,399 / 1,105 | 444 (35) | Windows: PowerShell session (`exec_powershell`, behind the hook), `hwnd`, virtual-desktop restore/minimize, `position_bar` through `komorebi_client::Window`, CJK font fallbacks, `scale_factor`, the Windows mouse handling. macOS: unboxed notification type, window shadow and level. Not behaviour-preserving without a screen. | +| `main.rs` | 402 / 388 | 92 (14) | `process_hwnd`/`enum_window`, DPI awareness, `set_read_timeout`; macOS activation policy and window level (AppKit), config dir `~/.config/komorebi`. Window and viewport setup belongs behind `BarPlatform` hooks (`init_process`, `viewport_builder`, `after_creation`), not written: it cannot be exercised here. | +| `os.rs` | 83 / 60 | 71 (14) | the platform implementations themselves; stays per platform (`cfg(target_os)` modules after the merge). | +| `widgets/widget.rs`, `widgets/mod.rs` | 41 / 49, 22 / 19 | 20, 5 | `WidgetConfigExt` (macOS builds a no-op `Unsupported` for the three Windows-only widgets) and the module lists. | + +Windows-only and not shared: `widgets/keyboard.rs` (167), `media.rs` (322), `systray.rs` (1,205); +their config types are in the core. The macOS copies of keyboard and media were dead and are deleted. + +### Known macOS/Windows differences that were kept (D-coord-1) + +- `network.rs`: see above. The macOS bar ignores `default_interface_options`. +- Windows-only config keys are accepted on macOS and skipped with a logged warning (BEHAVIOUR on + macOS, as for `StaticConfig`): `Keyboard`, `Media` and `Systray` widgets + (`widgets::widget::warn_unsupported`), the `mouse` options and the network + `default_interface_options`. Before, the first group failed to deserialize and rejected the whole + config, the other two were ignored silently. +- macOS commands that spawn programs that do not exist there are preserved, not fixed: + `SystemTool::PowerSettings` (battery click) spawns `cmd.exe /C start ms-settings:...`, + `SystemTool::Url` (update click) spawns `explorer.exe`, and `UserCommand::launch_if_ready` of the + applications widget spawns `cmd /C ` in both bars. `update.rs` still has a second GitHub + API URL for the Windows repository. The macOS spawns live in + `komorebi-for-mac/komorebi-bar/src/os.rs`; the storage click is `SystemTool::StorageLocation` and + each shell spawns what it spawned before. +- `KomorebiLayout` is `#[serde(untagged)]` in both bars now (the macOS source converged; the macOS + schema view restores the macOS text). Its `Deserialize` is hand-written and nothing in the bar + serializes it, so this changes only the derived schema and `Serialize`. The coordinator said to + leave it alone; it is a separate revision (`mac-bar: converge komorebi.rs config text and + komorebi_layout.rs`) and can be dropped, at the price of keeping `KomorebiLayout` and its + widget in the shells. + +## The merged package layout (for the coordinator's workspace merge) + +Not done and not prepared in the tree (no workspace or lockfile structure was changed). When the +root workspace and `komorebi-for-mac` are merged the bar should look like this: + +- Package `komorebi-bar` (one, in `komorebi-bar/`) plus `crates/komorebi-bar-core` as today. + Version: the workspace version. The macOS tree's `komorebi-bar` 0.1.1 and the `v0.1.0` text in + its schema description are a view concern (`schema/changes.rs`), not a package one. +- `src/main.rs` (shared: the argument parsing, config read, `--schema`, the event loop shell) + and `src/bar.rs` split into `src/bar/mod.rs` (shared `Komobar`) with + `#[cfg(target_os = "windows")] mod windows;` and `#[cfg(target_os = "macos")] mod macos;` + for the window handle, DPI, activation policy, window level, position and the PowerShell + session. `src/os.rs` becomes `src/os/{windows,macos}.rs` (the `BarPlatform` implementations, + selected by `cfg(target_os)` and installed first thing in `main`). Windows-only widgets + (`keyboard`, `media`, `systray`) are `#[cfg(target_os = "windows")]` modules; `komorebi.rs` and + `network.rs` stay two files (`komorebi/{windows,macos}.rs` behind one `widgets::komorebi` + facade) until the snapshot split. +- `Cargo.toml`: `windows`, `windows-core`, `windows-icons*`, `systray-util`, `font-loader` under + `[target.'cfg(windows)'.dependencies]`; `objc2`, `objc2-app-kit`, `raw-window-handle`, `icns` + under `[target.'cfg(target_os = "macos")'.dependencies]`; `netdev` has two versions (0.46, + 0.40): pick one when `network.rs` converges, until then a target-specific rename + (`netdev-win`, `netdev-mac`). `komorebi-client`: one crate (the two differ in 150 lines). + Features: `schemars` as now (it forwards to the core). No new feature per platform: the + platform is `cfg(target_os)`. +- Schema: the checked-in files stay (`schema.bar.json`, `komorebi-for-mac/schema.bar.json`, or one + directory for both after the merge). `--schema` prints the view of the running platform + (`SchemaPlatform` from `cfg(target_os)`); a `--schema-for ` flag would let one host + regenerate both, as the Windows union is the Windows text. Windows' three + platform-dependent descriptions (protocol `PathBuf`, themes) need the Windows target to + regenerate, so the Windows file is only verifiable on Windows or with the harness. +- Lock files: the macOS `Cargo.lock` folds into the root one; the lines this stack added to both + (`image`, `komorebi-config`, `komorebi-layouts`, `komorebi-protocol`, `komorebi-themes`, + `tracing`, `lazy_static`, `color-eyre` for bar-core) are the same crates in both, so the merge + adds no new versions beyond `netdev` and `starship-battery`/`sysinfo` (already unified here). +- Nix: `komorebi-for-mac/nix/komorebi-bar-options.nix` is generated from the macOS file and does + not change; the two flakes' `extractBinary "komorebi-bar"` become one derivation per system. + +## The plan, in order + +1. Done: schema views and oracle; storage, time, applications, komorebi layout widget, icon + cache, all widget config types, `WidgetConfig`, `config.rs` moved; hooks for platform + spawns, the shell session and the komorebi client. +2. Not done, needs a screen or a Mac: `bar.rs`/`main.rs` window code behind `BarPlatform` + (`init_process`, `viewport_builder`, `after_creation`, position/DPI/activation), then + `Komobar

` and the shared `app` body into the core. +3. Not done, needs the snapshot split: `komorebi.rs`. It needs `State`-to-snapshot conversion + per platform and one renderer; the frame/margin difference must be decided by looking at both. +4. Decision for `network.rs`: converge on the Windows widget (macOS gains friendly-name, + IPv4/IPv6 and the `netdev` bump) or keep two. +5. Workspace merge (above), then the two shells collapse into one package. +6. The oracle then compares generated text with the files for both platforms. + +## What to check by hand + +Windows (coordinator, screenshot e2e): the bar starts; the storage, time, applications (icons +from executables), komorebi layout (click opens the options, choosing one changes the layout, +Monocle/Floating toggles, paused) and komorebi workspaces widgets render; a click on storage +opens Explorer on the drive; a config with `mouse` options and a `Systray`/`Keyboard`/`Media` +widget still works (this is the Windows path through the moved `config.rs`, `WidgetConfig` and +the `exec_shell_command` hook: a `Command` mouse message must still reach the PowerShell session); +`komorebi-bar --schema` equals `schema.bar.json`. + +macOS (also in the section for `docs/dev/macos-handcheck.md`): the bar starts with your real +config; the time widget renders (format variants, `changing_icon`); clicking a storage widget +opens the mounted volume in Finder (`open `); the komorebi layout widget click works as +before; a config that contains a `Keyboard`, `Media` or `Systray` widget, a `mouse` block, or +`default_interface_options` under `Network` starts the bar and logs one warning per item (before: +the widget case failed to load the config); `komorebi-bar --schema` equals +`komorebi-for-mac/schema.bar.json`; the battery and update clicks still fail the way they did +(preserved, one-function fix in `os.rs`). diff --git a/docs/dev/macos-handcheck.md b/docs/dev/macos-handcheck.md new file mode 100644 index 00000000..d6f939cb --- /dev/null +++ b/docs/dev/macos-handcheck.md @@ -0,0 +1,77 @@ +# macOS hand-check list + +Status: written by the `kfm` agent for the user, 2026-10-31. Nothing here has been run: macOS cannot be built, linked or tested on the Linux host, only type-checked through a fake C compiler (`tools/fast-check`). Every revision below is `type-checks, not run`. Revision ids are jj change ids (stable) with the commit id they had when this was written (commit ids change when a revision is rewritten; use `jj log -r `). + +How to use it: build the unified (or, until they exist, the per-tree) macOS `komorebi`, `komorebic` and `komorebi-bar`, run `cargo test --workspace` on the Mac first (the 399+ unit tests have never run against these changes), then walk the sections in order. For before/after capture use `komorebi-recorder` against a build of the baseline `wip-main` ancestor `ff3711dc` and the tip. A section is done when the "look for" column is true. + +## Status of the Mini runs (2026-10-31) + +The real-Mac runs so far (Mac Mini, rustc and clippy 1.93, tip a35573d8) are **compile and unit tests only**: `cargo test --workspace` in komorebi-for-mac passed (daemon 366 passed, 1 ignored; 368 total, 0 failed) and clippy `-D warnings` was clean apart from the two items fixed afterwards. Nothing was run as a daemon: no focus, tiling, borders, animations or bar rendering has been observed on the Mini. Every walk-through item below is still open. + +## A. Revisions that change what the daemon does (BEHAVIOUR) + +| Revision | What changed | Look for on a Mac | +|---|---|---| +| `ummqkuvp` 01b9cbed `fix(mac): take the rule-list locks in one order...` | `window_is_eligible` (window.rs) and `apply_globals` (static_config.rs) now lock floating, ignore, manage, regex in that order; before they locked regex, ignore, manage and ignore, regex, manage. The order is documented at the statics in lib.rs. Same fix as the KDE `ef1d3ef0`. | Run `komorebic reload-configuration` (and `komorebic replace-configuration`) in a loop of 50 while opening and closing windows (new Finder windows, Terminal tabs) at the same time. Before the fix this could hang the daemon (the command is never answered, new windows are not tiled). Expected: no hang, every reload answered. Also check that float rules, ignore rules and manage rules from the config and from `komorebic float-rule`/`ignore-rule`/`manage-rule` still apply to new windows. | +| `nvwvptpv` 866b2840 `use the shared command listener` | The UDS command accept loop and per-client reader are the shared `komorebi-transport` code (`NoPolicy`: no read timeouts, as before); `WindowManager` is a `CommandTarget` (lock with `try_lock_for`). | Every `komorebic` command is answered; a command sent while the daemon is busy gets an answer or a clean error, not a hang; kill the daemon mid-command: the client returns. | +| `ywwwwpwm` 587defe3 `use the shared pause filter` | `allowed_while_paused` lists the commands allowed while paused. | `komorebic toggle-pause`; while paused only `toggle-pause`, `state`, `global-state`, `stop` work, everything else is ignored (and the connection ends); unpause and check windows tile again. | +| `kzynysto` b85827e6 `use the shared subscriber push` | Subscriber sockets are pushed to by the shared `notify_sockets`; the macOS override events are kept. | `komorebic subscribe-socket` (and `subscribe-socket-with-options`): events arrive for focus, move, workspace change, monitor change, theme and config reload; a subscriber that goes away is dropped without breaking the others. The bar is a subscriber, so the bar updating is the check. | +| `ovsplvmn` 5cc38da6 `use EventChannel for the window events` | The window-event channel (capacity 20, try_send, drop warning, `ResizeStep` claim flag) is `komorebi_transport::EventChannel`. | Drag a window edge continuously (live resize) and pan with the trackpad: no stalls, no repeated drop warnings in the log, the layout follows. Move many windows at once (workspace switch with 10+ windows). | +| `lrqkuuzq` a4996ac6 `use SocketMessage from komorebi-protocol` and `sowrttxs` 5c129ab5 `carry DebugWindow as i64` | One `SocketMessage` for all platforms; the wire format must be unchanged. `DebugWindow` takes an i64 (a negative id parses and matches nothing). | Every command of the `komorebic` help works against the daemon; `komorebic debug-window ` for a real id; `komorebic state` and `global-state` JSON parse. | +| `qqwoptqt` 975f007a, `yptnnkxv` eb903bcc (animation prefix, Bezier doc) | `AnimationPrefix` gains `Transparency` (ignored by the daemon); schema.json changed the shape of per-prefix animation settings. | Config with `animation.style` / `duration` per prefix (movement, workspace) still loads; animations behave as before. Run `komorebic static-config-schema` and diff with `komorebi-for-mac/schema.json` (two description-level changes and the per-prefix shape are intended). | +| `kvtvnouo` 93e4d511, `stxmqnop` dec91984 (StaticConfig from komorebi-config) | The config data types and their defaults come from `komorebi-config`; `komorebic static-config-schema` prints the macOS view. | A real `komorebi.json` of yours loads with no new warning and every key still takes effect (borders, padding, animations, scrolling, rules, workspaces); `komorebic static-config-schema` matches the checked-in `schema.json` up to the intended description lines. | +| `qukywpss` c46320ea, `zwkwptox` 1e902542, `sxptsttt` 0345fccb (komorebic shares clap definitions, launcher, pan) | `komorebic start` and `stop` use the shared Launcher skeleton (the odd `--config` arguments are kept; "Waiting for komorebi to start..." is flushed); pan commands use the shared module. | `komorebic start --bar`, `start --await-configuration`, `stop`, `stop --bar`; `komorebic pan-*` commands; `komorebic --help` and a few ` --help` texts (about 15 help texts changed to the Windows wording). | +| `oywqqkuy` f0b1a448 `register every Window in ax_registry and forget the dead` | `Window::new` registers the window in the id registry (`ax_registry`); entries are removed in `Window::drop` of a dead window, in `reap_window`, and (`forget_pid`) when an application terminates. No AX call is added; the table holds retained AX references and observers. | Open and close 50 windows (Finder, Terminal, Safari) and quit several apps, then check the daemon's memory in Activity Monitor does not climb and nothing behaves differently (focus, tiling, borders). If a quit app's windows were not forgotten the symptom is memory growth only. Run with `RUST_LOG=debug` and check no new errors at app quit. | +| `oqnvyqvw` e0687167 `keep ax_registry in step when a native tab changes a window's id` | The two places that swap a window's id and element in place for native tabs also update the registry (`sync`). | A native-tabbed app (Terminal, Finder, Safari tabs): switch tabs, close the first tab, open a new tab, focus the window with `komorebic focus ...`, move and resize it. Must behave as on the baseline (no window lost, no stuck border). | +| Bar: `nottqpms` 086833af, `zvuyspku` b8de056b, `uxzpkmnk` 7cd85bd4, `yopuwouu` 6da27dda (bar-core, platform hooks) | macOS now builds `sysinfo` 0.39 and `starship-battery` 0.11 (the Windows versions); cpu, battery, memory, date, update widgets are the shared code. | Bar renders; CPU %, memory, battery % and charging state show sane values; date and the calendar icon; clicking CPU, battery, network, update (see bug list D below: these click handlers are broken on macOS and stay broken). | + +Revisions in section B change no behaviour on purpose (rename, move, route); they still need the sections C walk-through, because a mechanical mistake would show there. + +## B. Mechanical macOS revisions of the `kfm` agent (Step 6 and 11(i)) + +| Revision | Change | +|---|---| +| `vzxkxzzy` 796c3832 | `Window::frame()` (renamed `window_rect` below) for the 28 sites that read a Window's frame through `MacosApi::window_rect(&w.element)` (window.rs, window_manager.rs, workspace.rs, process_event.rs, process_command.rs, settle.rs, macos_backend.rs) | +| `oootynxk` 7c2e1bea | `Window::is_valid` renamed `Window::alive` | +| `roxrxtru` 49a6dbda | `Window::set_position` renamed `Window::set_rect` (10 callers) | +| `vmnnuzzu` 803a1410 | `Window::set_messaging_timeout` (settle.rs: 3 raw AX sites) | +| `upylxxuw` ecaa3e15 | `Window::close` (the same close-button press as `AdhocWindow::close`) | +| `tsymmvll` d30a3eb6 | step 11(i): `MacosBackend` calls only `Window` methods (new `Window::minimized`); still unused by the daemon | +| `qsrxvsmv` 931b17d7 | `Window::frame` renamed `Window::window_rect` (the Backend and the Windows Window use that name) | +| `xrtqmxkp` 4c9094d7 | native: `komorebi_backend::Registry` (the rules of the id registry; 9 unit and 1 doc test run on Linux) | +| `tmmtuosy` 386c5a79 | `ax_registry` module; `MacosBackend` resolves ids through it (the adapter is still unused by the daemon) | +| `kvkxkqnx` ba22e8dc | `ax_registry::identify`: the 7 sites that turn a system-handed element into a window id (input_event_listener, process_command, process_event x5, window_manager) | +| `kpopuvoy` 01b3bd5c | live-resize step (window_manager.rs) reads the dragged window's frame through `Window::window_rect` | + +Hand check: C below. If something breaks and is not the lock order, bisect among these seven first: they only rename and route, so a regression means a call was routed to the wrong receiver (type-check cannot tell a Window from another window of the same type). + +## C. Walk-through (the list the plan names) + +Do each with the baseline build and the tip build and compare (or record with `komorebi-recorder`). + +1. **Focus**: `komorebic focus left|right|up|down`, `cycle-focus`, `focus-window `; mouse-follows-focus on/off (the cursor centres in the window: uses the window frame query); focus a window of a tabbed app (Terminal, Finder): the focus uses `element_to_focus`, check the right tab. +2. **Move and resize**: `move`, `resize-axis`, `resize-edge` and a manual drag of a window; after a drag the layout puts the window back (settle reads the frame with a timeout); live resize of one edge moves the neighbour. A window that refuses a width (a fixed size app) is read back and the neighbours adapt. +3. **Stack**: `stack`, `unstack`, `cycle-stack`, `stack-all`; hidden stack members are parked off-screen (`hide`) and restored (`restore`) correctly; no window left at a hidden corner after unstack or quit. +4. **Workspaces**: switch (`focus-workspace`), send a window (`send-to-workspace`), `move-to-workspace`, with 2 monitors if possible; windows of the workspace you left are hidden, those of the new one restored to where they were; workspace rules after a monitor change. +5. **Scrolling layout**: the scrolling layout, `pan` commands, `scroll-*`; windows slide in from the edge (the arrival/slide code reads the frame). +6. **Pan** (trackpad gesture) and **live resize**: `komorebic pan-*`, three-finger style gestures as you configured them. +7. **Borders**: focused/unfocused/stack colours follow focus and follow animated windows; borders vanish and come back on workspace switch; no border left behind after closing a window (the window's close and borders share the observer code). +8. **Animations**: movement and workspace animations on and off; the ghost images; cancel an animation by issuing a new command in the middle. +9. **Display change**: plug or unplug a monitor or change the resolution: work areas update, workspaces go to the right monitors, workspace rules re-apply. (This is the thread that can deadlock, see bug list A.) +10. **Sleep and wake**: close the lid or sleep, wake: windows are where they were, the daemon answers, the bar returns. +11. **Minimize, unminimize, close**: `komorebic minimize`, `close` (the foreground window), un-minimize a window from the Dock; closing a window removes it from its container (the reaper uses `Window::alive`). +12. **Reload the config** repeatedly (see section A, first row). + +## D. Bugs noticed, not fixed here + +A. **Possible deadlock, main queue against the window-manager lock** (`docs/dev/seam.md` section 3.3, by reading only, never reproduced). A thread holding the WM lock calls a blocking main-queue dispatch (`destroy_all_borders` at process_event.rs lines about 128/139, process_command.rs, `retile_all`; `hide_borders_on` in window_manager.rs; `activate_finder` in process_event.rs) while the monitor reconciliator has dispatched a closure to main that itself takes the WM lock (monitor_reconciliator.rs about 106 and 383). Then the event thread waits for main, main waits for the lock. `parking_lot`'s deadlock detector cannot see it (the dispatch is a semaphore). Window of exposure: a display change at the instant of one of those events. Structural fix: no closure that runs on main may take the WM lock (or dispatch to main only after the lock is dropped). How to provoke it: spam `komorebic retile` / workspace switches (with ghosts) while plugging or unplugging a monitor; the symptom is a daemon that answers no command (`komorebic state` hangs). +B. **cmd.exe and explorer.exe in the macOS bar** (`komorebi-for-mac/komorebi-bar/src/os.rs`, `BarPlatform::open_system_tool`): the battery click spawns `cmd.exe` (power settings), the update click spawns `explorer.exe` with the release URL; neither exists on macOS. The same file's CPU (task manager) and network settings tools should be Activity Monitor and System Settings. The fix is one function in that file; it was preserved on purpose during the bar move. +C. **Update widget refresh thread polls the Windows repo's GitHub API** on macOS too (update.rs has a second URL that does not go through the hook), and the macOS update link is `.../releases/v..` built for the Windows repo. +D. **Other raw AX sites remain outside `Window`**: window.rs (38 inside `Window`/`AdhocWindow`, expected), application.rs 11 (`Application`, not a window), process_event.rs 7 (events that hand over a bare element: `window_id` of an element, the tab check `AccessibilityApi::window_id(&window.element.0)`), animation/animator.rs 6 (lane threads hold `WindowHandle` clones of the element), border_manager 7 (observers on tracked elements), window_manager.rs 4 (timeouts list holds elements, `window_id` of an element), reaper.rs 2 (`notify_if_gone` takes an element so lanes can use it), input_event_listener.rs 1, process_command.rs 1. They need either an id to AX registry (step 11(ii), not started) or a `WindowHandle` type; they were left alone because routing them changes who owns the element. +D2. **Step 11(ii) status.** Done: the id registry (`ax_registry`, over the tested `komorebi_backend::Registry`), populated at `Window::new`, kept in step for native tabs, emptied on death, reap and application quit; `MacosBackend` resolves ids through it. NOT done, on purpose, because each needs a decision that cannot be verified without a Mac: (a) the animator lanes (`WindowHandle`) keep their own snapshot of the element: a lane must keep writing to the element of the move it was given even if a tab swap replaced the registry entry, and replacing the snapshot by a lookup per write changes what a late write hits; (b) borders keep `tracking_element` (observer sources are added and removed on that exact element, on main); (c) `reaper::notify_if_gone` and the window manager's live-resize `timeouts` list take elements, including application elements, that are not registry entries; (d) `application.rs` is the application, not a window. (e) The model (`Window`, containers, workspaces) still holds `Window` values, not bare `WindowId`s: that is step 11(iii), after steps 8-9. A stale registry id answers `Error::WindowGone` (no panic); a window that was deserialised from state (default system-wide element) is never registered. +E. `MacosBackend` (step 7c/11(i)) needs 11(ii) before it can be used: `windows()` answers only what was `register`ed, `hide` needs the corner, `raise` also focuses, `monitors()` reads a cache nobody fills yet (seam.md section 9.2). `AdhocWindow` (bare foreground element) still has its own minimize, close, hide, restore, raise. +F. In `window.rs` `AdhocWindow::hide` / `Window::hide` duplicate the restore-position bookkeeping (`WINDOW_RESTORE_POSITIONS`), one on a `Window` and one on a bare element; they must stay in step. + +## E. What is not checked at all + +Everything above. In particular: no macOS test (399+ unit tests incl. those in window.rs for drag state) has run against any of these revisions; the unified binaries do not exist yet; no real Accessibility call was made; `komorebi-recorder` captures need a Mac. diff --git a/docs/dev/settings.md b/docs/dev/settings.md new file mode 100644 index 00000000..6ca75bb5 --- /dev/null +++ b/docs/dev/settings.md @@ -0,0 +1,320 @@ +# Settings: replacing the process-wide statics + +Status: design (plan step 10, phase 1). Measured on `wip-main` 633e7453 (the Windows tree +`komorebi/src`, KDE `komorebi-for-kde/komorebi/src`, macOS `komorebi-for-mac/komorebi/src`). Nothing +here was run: counts come from `grep` and reading, and macOS cannot run on this host. The shared type +is landed as the crate `crates/komorebi-settings` (phase 2) and **no daemon uses it yet**. + +Abbreviations: `W/`, `K/`, `M/` are the three `src` trees. `apply_globals` is +`StaticConfig::apply_globals` (`W/static_config.rs:396`, `K/static_config.rs:414`, +`M/static_config.rs:392`). + +## 1. What the statics are + +Declarations of `static`, `static ref` and `lazy_static` (thread locals and per-call counters left out): +**Windows 126, KDE 53, macOS 74.** Most are not settings. Four kinds: + +| kind | examples | goes into `Settings`? | +|---|---|---| +| **config**: written by `komorebi.json` load and/or a `SocketMessage`, read by other threads | `BORDER_*`, `ANIMATION_*`, paddings, rule lists, stackbar | yes | +| **session state**: changes while running, is not configuration | `SESSION_FLOATING_APPLICATIONS`, `UNMANAGED_WINDOW_IDS`, `HIDDEN_HWNDS`, `WORKSPACE_MATCHING_RULES`, `INITIAL_CONFIGURATION_LOADED`, `CUSTOM_FFM` (command line) | no; stays where it is (core step 9) | +| **plumbing**: channels, `OnceLock`, caches of OS handles, per-window tables | `CHANNEL`, `BORDER_STATE`, `MONITOR_CACHE`, `HWNDS_CACHE`, `PARKED_WINDOWS`, `live_resize.rs` flags | no | +| **environment**: computed once | `HOME_DIR`, `DATA_DIR`, `AHK_EXE`, `WINDOWS_11` | no | + +Config-class statics by my count: **Windows 61, KDE 35, macOS 36** (these include the session-state +rule lists that sit next to them; see 2.3). What `apply_globals` itself writes (distinct statics, +counted on the function body): **Windows 51, KDE 29, macOS 28.** The plan's "19-27 written per +platform" counted scalar settings only; the 11 rule lists, the 7 per-animation/global animation +statics and the stackbar block make the totals larger. + +## 2. The inventory (config class) + +"Writers": `load` is `apply_globals` (runs on start-up through `preload`, and again on every +`ReloadConfiguration` through `reload`), `cmd` is a `SocketMessage` arm of `process_command.rs`, +`theme` is `theme_manager`, `thr` is another thread. "Readers" lists only threads that are not the +window-manager thread; "wm" means code that runs under the window-manager lock. Match is the name +on the other platforms (`=` same name and type, `~` same name, different default or type, `-` +absent). + +### 2.1 Scalars and small values + +| static | type | writers | readers | W / K / M | shared? | note | +|---|---|---|---|---|---|---| +| `BORDER_ENABLED` | AtomicBool | load, cmd `Border` | border thread (all 3), wm | = = = | shared | K reads it to decide whether borders take room in the layout (`BORDER_DRAWN` is its derived twin, K only) | +| `BORDER_WIDTH` | AtomicI32 | load, cmd | border thread, wm (offsets), stackbar (W) | ~ default 8 / 10 / 10 | shared | | +| `BORDER_OFFSET` | AtomicI32 | load, cmd | border thread, wm | ~ default -1 / 0 / 0 | shared | | +| `BORDER_RADIUS` | AtomicI32 | load | K effect, M `ns_window` | - K M | K+M | Windows draws square or via DWM (`STYLE`) | +| `BORDER_OFFSET_ADJUSTMENT` | `static i32` = 7 | nobody | M border | - - M | platform constant | stays a constant | +| `FOCUSED UNFOCUSED UNFOCUSED_LOCKED MONOCLE STACK FLOATING` | 6 x AtomicU32 | load, cmd `BorderColour`, theme | border thread | = = = | shared | `UNFOCUSED_LOCKED` is written by theme only (load never writes it); one theme change writes 6 border and (W) 3 stackbar values one by one | +| `STYLE` | AtomicCell | load, cmd | border thread, wm | W only | W platform | load resets it to default when the file has none | +| `IMPLEMENTATION` | AtomicCell | load, cmd | border thread | W only | W platform | | +| `ANIMATION_ENABLED_GLOBAL` | Arc | load, cmd, **scoped override**, shutdown | W animation engine, M animator and lane threads, wm | = = = | shared | see 4 (override) | +| `ANIMATION_STYLE_GLOBAL` | Arc> | load, cmd | same | = = = | shared | | +| `ANIMATION_DURATION_GLOBAL` | Arc | load, cmd | same | = = = | shared | | +| `ANIMATION_{ENABLED,STYLE,DURATION}_PER_ANIMATION` | Arc>> x3 | load, cmd (2 sites for style), shutdown (enabled) | same | = = = | shared | `load` clears the map when a global value is given, replaces it when a prefix map is given | +| `ANIMATION_FPS` | AtomicU64 | load, cmd | W engine, M animator (`frame_period`) | = = = | shared | load writes the default when `animation` is present but `fps` is not | +| `GHOST_MOVEMENT_ENABLED` | AtomicBool | load | W ghost dispatcher, live resize | W only | W platform | | +| `TRANSPARENCY_ALPHA` | AtomicU8 | load, cmd | W/K transparency manager | = = - | shared (W, K) | default 200 | +| `TRANSPARENCY_ENABLED` | AtomicBool | load (`transparency`), cmd (set, toggle) | transparency manager, W process_event | = = - | shared (W, K) | a command toggles what the file set; a reload overwrites it only when the key is present | +| `DEFAULT_WORKSPACE_PADDING`, `DEFAULT_CONTAINER_PADDING` | AtomicI32 | load | wm (every layout), W stackbar | ~ default 10 / 5 / 5 | shared | load keeps the old value when the key is absent | +| `DEFAULT_RESIZE_DELTA`, `DEFAULT_MOUSE_FOLLOWS_FOCUS` | `static i32 / bool` | nobody | wm | = = = | shared constants | become part of the platform defaults | +| `FLOATING_WINDOW_TOGGLE_ASPECT_RATIO` | Arc> | load (2 sites) | wm | = = = | shared | load writes a default when absent | +| `LAYOUT_DEFAULTS` | Arc>> | load (replace or clear) | wm | = = = | shared | | +| `DISPLAY_INDEX_PREFERENCES` | Arc>> | load, cmd | monitor reconciliator thread, wm | = = = | shared | | +| `MONITOR_INDEX_PREFERENCES` | Arc>> | load, cmd | W windows_api, reconciliator | W only | W platform | commented out of macOS and KDE load | +| `DUPLICATE_MONITOR_SERIAL_IDS` | Arc>> | reconciliator, windows_api | windows_api | W only | **not config** | derived from the monitor list | +| `HIDING_BEHAVIOUR` | Arc> | load, cmd, (state loader) | **reaper thread** (every 20 ms), wm | W only | W platform | reaper reads it without the wm lock | +| `WINDOW_HANDLING_BEHAVIOUR` | AtomicCell | load, **scoped override** in `border.rs:831-851` | W windows_api (every position call), ghost dispatcher, scrolling | W only | W platform | see 4 | +| `MINIMUM_WIDTH`, `MINIMUM_HEIGHT` | AtomicI32 x2 | load | wm | W only | W platform | commented out of the macOS load | +| `SLOW_APPLICATION_COMPENSATION_TIME` | AtomicU64 | nobody after init | W window | W only | W platform | effectively constant 20 | +| `REMOVE_TITLEBARS` | AtomicBool | cmd | wm, workspace | W only | W platform | runtime toggle, not in `apply_globals` | +| `STACKBAR_*` (9: font size/family, focused/unfocused text, tab background, height, width, label, mode) | AtomicI32/U32/Cell, `Mutex>` | load, cmd, theme (3 colours) | stackbar threads, wm | W only | W platform | load sets font size and family unconditionally (0 / None) when `stackbar.tabs` is present | +| `STACKBAR_TEMPORARILY_DISABLED` | AtomicBool | ghost dispatcher | stackbar manager | W only | session state | | +| `CURRENT_THEME` | AtomicCell> | theme thread | theme thread only | = = = | not config | read nowhere else | +| `TABBED_APPLICATIONS`, `TITLELESS_APPLICATIONS`, `DO_NOT_OBSERVE_APPLICATIONS` | Arc>> | load (first two) | M window, process_event | M only | M platform | | + +### 2.2 Rule lists (the lock-ordered set) + +| static | writers | readers | W / K / M | +|---|---|---|---| +| `FLOATING_APPLICATIONS`, `IGNORE_IDENTIFIERS`, `MANAGE_IDENTIFIERS` | load (all three held at once) | wm; W also `winevent` and `window_manager_event` threads through `window_is_eligible` | = = = | +| `TRANSPARENCY_BLACKLIST` | load | transparency manager | = = - (K: pub) | +| `LAYERED_WHITELIST`, `TRAY_AND_MULTI_WINDOW_IDENTIFIERS`, `OBJECT_NAME_CHANGE_ON_LAUNCH`, `OBJECT_NAME_CHANGE_TITLE_IGNORE_LIST`, `SLOW_APPLICATION_IDENTIFIERS`, `NO_TITLEBAR` | load | wm, event threads | W only | +| `REGEX_IDENTIFIERS` | load (clears), every rule check (compiles on demand) | every rule check | = = = | +| `PERMAIGNORE_CLASSES` (W also `WSL2_UI_PROCESSES`) | nobody after init | window eligibility | = = = (W: +1) | +| `SESSION_FLOATING_APPLICATIONS` | cmd (add/remove at run time) | window eligibility | = = = | +| `WORKSPACE_MATCHING_RULES` | cmd, **reload (clears, then refills after `apply_globals`)** | wm, reconciliator, M process_event | = = = | + +### 2.3 Lock-order relations + +The documented order (comment above the statics in `komorebi/src/lib.rs` on `wip-u-kfw`; it is the +only one: KDE and macOS declare no order and take the same lists in whatever order the code does): + +``` +FLOATING_APPLICATIONS, SESSION_FLOATING_APPLICATIONS, TRANSPARENCY_BLACKLIST, IGNORE_IDENTIFIERS, +MANAGE_IDENTIFIERS, LAYERED_WHITELIST, TRAY_AND_MULTI_WINDOW_IDENTIFIERS, OBJECT_NAME_CHANGE_ON_LAUNCH, +OBJECT_NAME_CHANGE_TITLE_IGNORE_LIST, SLOW_APPLICATION_IDENTIFIERS, NO_TITLEBAR, +WORKSPACE_MATCHING_RULES, REGEX_IDENTIFIERS +``` + +`REGEX_IDENTIFIERS` is last (every rule check holds a list and then the regexes); `PERMAIGNORE_CLASSES` +and `WSL2_UI_PROCESSES` are leaves. The window-manager lock is above all of them: `apply_globals` runs +with it held (the `reload` signature takes `&mut WindowManager`), but the event threads of Windows +(`winevent_listener` to `window_manager_event`) and the transparency manager also lock single lists +without it. + +Two findings: + +1. `apply_globals` on Windows takes **eleven** list locks in a fixed order and keeps them for the whole + function (`W/static_config.rs:562-572`), so the rules change atomically with respect to each other, + but not with respect to the scalars (written before and after). +2. `reload` clears `WORKSPACE_MATCHING_RULES` and refills it per monitor afterwards (`M/static_config.rs` + after `apply_globals`, same on W and K): for the duration of the loop a reader that does not hold the + wm lock sees an **empty** list. This is a live partial-update window today. + +With `Settings` the immutable lists are fields of one `Arc` snapshot: readers take no lock, there is no +order to follow, and the lock order shrinks to: wm lock, then the two session mutexes +(`SESSION_FLOATING_APPLICATIONS`, the regex cache), never nested the other way round. + +## 3. The design + +### 3.1 Crates + +New crate `crates/komorebi-settings` (std plus `parking_lot`; types from `komorebi-config`, +`komorebi-protocol` and `komorebi-layouts`; no daemon dependency, so it tests natively): + +```rust +pub struct Settings

{ + pub shared: Shared, // the same struct on all three platforms + pub platform: P, // Windows: border style, stackbar, hiding/handling behaviour, ... +} // KDE: nothing yet (the compositor owns look); macOS: tabbed/titleless apps + +pub struct Shared { + pub border: Border, // enabled, width, offset, six colours + pub animation: Animation, // global + per-prefix enabled/style/duration, fps; motion_for(prefix) + pub defaults: Defaults, // container/workspace padding, resize delta, mouse-follows-focus + pub transparency: Transparency, // enabled, alpha (Windows and KDE; macOS keeps the default) + pub floating_window_aspect_ratio: AspectRatio, + pub layout_defaults: HashMap, + pub display_index_preferences: HashMap, +} + +pub struct Handle

{ /* RwLock>> + a writer mutex */ } +impl Handle

{ + pub fn snapshot(&self) -> Arc>; // readers + pub fn replace(&self, s: Settings

); // whole new value + pub fn update(&self, f: impl FnOnce(&mut Settings

) -> R) -> R; // copy, edit, swap; writers serialised + pub fn scoped(&self, field: fn(&mut Settings

) -> &mut T, value: T) -> Scoped<'_, P, T>; +} +``` + +The **platform part** is a plain type parameter `P` (not a trait): each daemon names its struct +(`WindowsSettings`, `MacosSettings`, `KdeSettings`) and the handle is `static SETTINGS: LazyLock>` +behind a `settings()` function of the daemon crate. `P` needs only `Clone + Debug`. A trait would add +nothing, because the shared code never calls into `P`: only the platform's own subsystems read it. When +the daemons become one crate this is `#[cfg(target_os)] type Platform = ...`. + +The lists of rules and the stackbar block move into the platform parts first (they are Windows only or +differ); the rule lists join `Shared` in step G7 below once the lock order is retired. + +### 3.2 How readers get a consistent snapshot + +* A reader calls `settings().snapshot()` **once per unit of work** (one render pass of a border, one + `motion_for` call, one layout pass, one window eligibility check) and uses that `Arc` for the whole + unit. Cost: one uncontended `RwLock` read and an `Arc` clone; no atomics are needed on the hot + paths I found (border thread loops once per notification, animator once per frame, rule checks once per + event). If a measurement shows one needs it, add an `AtomicBool` *mirror* of that single field written by + the same `update`; do not read the mirror and the snapshot for the same decision. +* `ArcSwap` was the first idea. It is **not in any of the three lockfiles** (checked), so it would add a + dependency to three lockfiles and the flake hashes for no gain at this read rate. `Handle` hides the + representation: swapping `RwLock>` for `ArcSwap<_>` later changes one file. +* Writers go through `update`, which holds a mutex while it clones, edits and publishes, so two writers + (a `SocketMessage` and a config reload, a theme change and a command) never lose each other's field. The + statics lose such updates today only when both write the same field, but a theme change writes nine + separate atomics and a command can interleave. +* A config load builds the new value and publishes it **once**; a theme change is one `update`. + +### 3.3 Semantics that must survive: reload merges, it does not replace + +`apply_globals` is a field-by-field merge: `if let Some(x) = self.border_width { store }`. A key absent +from a reloaded `komorebi.json` **keeps the previous value** (and a command-set value); a few fields are +instead reset (listed in section 4, "reset on reload"). A "build a fresh Settings from the file and swap" +would reset every absent key to its default. So the migration keeps the merge: `Settings::apply(delta)` +is written as the same sequence of `if let Some` over a copy of the **current** snapshot, published once. +Replacing instead of merging is a separate, optional BEHAVIOUR change, last in the list. + +### 3.4 The scoped override + +Two places write a setting, do work and put it back: Windows `border.rs:831-851` +(`WINDOW_HANDLING_BEHAVIOUR`: load, store `handling`, ..., store `previous`) and KDE +`process_command.rs:607-609` (`ANIMATION_ENABLED_GLOBAL.swap(false)`, `add_window_to_container`, +`store(restore)`). Both clobber a concurrent change (a reload or a command in between is overwritten with the old value). macOS +already has the right pattern: `animation::suspend()` returns a guard that counts and `motion_for` returns +`None` while it is held (`M/animation/mod.rs:36-71`). `Handle::scoped` gives the same for any field: +it sets the value and, on drop, puts the previous value back **only if the field still holds the +override value**, so a change made meanwhile wins. For animations KDE and Windows should adopt +macOS's `suspend` counter instead (a field of `Shared::animation`, not a scoped value). + +## 4. Statics whose behaviour would change + +Everything here is a **BEHAVIOUR** change if it is not made to keep today's semantics. Flagged items +say what the migration does about each. + +**Partial updates visible mid-reload (today).** `apply_globals` publishes about 28 to 51 values +one at a time while the border, animator, reaper and transparency threads keep reading. A border +thread can draw once with the new width and the old colours; `motion_for` (macOS) reads enabled, +duration and style as three separate lock/atomic reads and can mix two configurations. With `Handle` all +readers see the old or the new `Settings`, never a mix: **BEHAVIOUR (intended, can only remove +tears)**, on every static of the table. The e2e that would show it is `config_reload`. + +**Reset on reload (must be kept as written):** `LAYOUT_DEFAULTS` (cleared when absent), +`FLOATING_WINDOW_TOGGLE_ASPECT_RATIO` (default when absent), `ANIMATION_FPS` (default when `animation` is present +without `fps`), `GHOST_MOVEMENT_ENABLED` (W), `STYLE` and `IMPLEMENTATION` (W: default when absent), +`STACKBAR_FONT_SIZE` / `STACKBAR_FONT_FAMILY` (W: 0 / None when `stackbar.tabs` is present), +`ANIMATION_*_PER_ANIMATION` (cleared when the global form is used) and the rule lists (`apply_globals` +clears each only when the new file gives that list; check per list in G7). + +**Keeps the old value when absent (must be kept):** borders (width, offset, radius, enabled, colours), +paddings, transparency alpha, hiding and handling behaviour, minimum size, stackbar scalars, display index +preferences. + +**Scoped override (3.4):** KDE `ANIMATION_ENABLED_GLOBAL.swap/store` pair and Windows `WINDOW_HANDLING_BEHAVIOUR` +pair become guards. A concurrent reload no longer gets clobbered: BEHAVIOUR. + +**Shutdown writes** (`main.rs:367-368`, `window_manager.rs:1445-1446` on W; the Stop handler on K and M): they +disable animation permanently before restoring windows. These are plain `update`s, not scoped. + +**`WORKSPACE_MATCHING_RULES` empty window** (2.3): stays in the core until step 9 (session state); not part +of `Settings`, so not changed here. + +**Defaults differ per platform** (border width 8/10/10, offset -1/0/0, padding 10/5/5, KDE border radius): +`Shared::defaults_for(PlatformDefaults::{WINDOWS, KDE, MACOS})`. Changing any default is user visible and is +not part of this step. + +**Threads read the statics without the wm lock:** border thread (all three), W reaper +(`HIDING_BEHAVIOUR`), W winevent and window_manager_event threads (rule lists), W transparency manager, +macOS animator thread and the per-pid lane threads, macOS border thread. These are the readers whose behaviour a snapshot +changes (from "latest value on each read" to "value of the snapshot taken at the start of the unit"); the +gap is at most one unit of work. + +## 5. Migration order (least to most risky) + +Each group is one revision per platform tree (or per platform file set), moving the writers and **all** +readers of that group together, never dual-writing a static and a field. P = pure refactor (same +observable behaviour); B = BEHAVIOUR (marked in the revision body, not landed until its gate ran). + +| step | group | kind | gate | +|---|---|---|---| +| S0 | the crate and its tests (landed, phase 2) | P | native `cargo test -p komorebi-settings` | +| S1 | `DEFAULT_RESIZE_DELTA`, `DEFAULT_MOUSE_FOLLOWS_FOCUS`, `BORDER_OFFSET_ADJUSTMENT`: constants into `PlatformDefaults` | P | KDE `cargo test -p komorebi --lib`, Windows clippy, macOS fake-CC check | +| S2 | install `settings()` in each daemon with the platform defaults (no reader yet) | P | same | +| S3 | paddings, aspect ratio, layout defaults, display index preferences (wm-lock readers and the reconciliator) | P for the readers; the load writes the new place once: B (tear) | KDE lib tests; Windows `config_reload`, `layouts`, `workspaces` e2e; macOS: reload with changed padding | +| S4 | transparency enabled and alpha (W, K) | P | Windows `config_reload` plus the transparency scenario if it exists; KDE lib tests | +| S5 | animation (global, per-prefix, fps): `motion_for`, engine, animator; KDE/Windows adopt `suspend()` guards | **B** (tear removed, override semantics) | KDE VM suites that stack windows (`stacks`); Windows animation e2e; **macOS hand-check**: animation on, switch workspace, change `animation.duration` by `komorebic` mid-animation, stack a window | +| S6 | border scalars and colours, theme colours as one `update` | **B** (the 6 colour atomics change together) | Windows border e2e (screenshot) and `config_reload`; KDE VM `borders`/look suites; **macOS hand-check**: `border-colour`, `border-width`, theme change, reload with changed border | +| S7 | Windows platform part: `HIDING_BEHAVIOUR`, `WINDOW_HANDLING_BEHAVIOUR` (with `scoped`), min size, stackbar block, border style/implementation, ghost movement | **B** (reaper reads a snapshot; override guard) | Windows: `commands`, `config_reload`, `lifecycle`, `lifecycle_hidden`, stackbars, border e2e | +| S8 | rule lists into `Shared` (immutable `Arc`), session floating and regex cache stay mutexes; retire the lock-order comment | **B** (hot path of every window event; deadlock class removed) | Windows `config_reload` (lock order), `commands`, `focus`, `lifecycle`; KDE lib tests plus VM suites; macOS: manage/ignore rules by hand | +| S9 | `apply_globals` as one `update` (single publish), and one decision on merge versus replace | **B** | Windows `config_reload`; macOS reload by hand | + +Risk grows with the number of threads that read without the wm lock and with how hot the read is: +S3 has none, S5 and S6 have the macOS threads the plan names, S7 has the reaper, S8 is every event. +Do S8 only after the Windows lock-order e2e from the `wip-u-kfw` stack has run once on the current +tree. + +## 6. What is not in `Settings` + +`SESSION_FLOATING_APPLICATIONS`, `UNMANAGED_WINDOW_IDS`, `HIDDEN_HWNDS`/`HIDDEN_WINDOWS`, +`WORKSPACE_MATCHING_RULES`, `REMOVE_TITLEBARS`, `CUSTOM_FFM`, +`INITIAL_CONFIGURATION_LOADED`, subscriptions, `*_CHANNEL`s, caches, `BORDER_STATE`: these are session or +plumbing state and belong to the model (step 9) or the subsystem. `Settings` is only what the user +configures. + +## 7. What landed (phase 2) and findings from writing it + +`crates/komorebi-settings` (native tests, 18 passed): `Settings

`, `Handle

` (`snapshot`, `replace`, +`update`, `scoped`), `Shared` (border, animation with `motion_for`, paddings and constants, transparency, +aspect ratio, layout defaults, display index preferences), `PlatformDefaults::{WINDOWS, KDE, MACOS}` and +`SharedDelta::apply`, which is `apply_globals` for the shared keys written as a function of the current +value. Not yet in the crate: rule lists, theme application as one update, anything platform specific. + +Findings that only showed up while encoding the semantics: + +* `FLOATING_WINDOW_TOGGLE_ASPECT_RATIO` starts at **Widescreen** on all three platforms, but a load + whose file has no `floating_window_aspect_ratio` writes **Standard** (`unwrap_or`). So the first + reload of a file without the key changes the ratio. `SharedDelta::apply` keeps this; fixing it is a + separate user-visible change. +* `TRANSPARENCY_ENABLED` is written by the load (`transparency`) and by the toggle command, so it is a + setting, not session state (corrected from the first draft of this document's table). +* `komorebi-config` warns about an unused import (`crate::defaults`, `static_config.rs:39`) when it is + built with `default-features = false`; the settings crate builds it that way. Not touched. +* Windows `reload` runs `apply_globals` twice per reload: in `preload` of the new window manager + (while the old one is paused) and again in `reload`; both writes become visible to the threads that + read without the wm lock. One `update` per load keeps the two visible publishes. + +## 8. S1 and S2 as landed for KDE and macOS, and the Windows patch (not applied) + +KDE and macOS (`wip-u-settings`): S1 (the `DEFAULT_*` statics take their values from +`komorebi_settings::shared`, paddings from `PlatformDefaults::{KDE, MACOS}`; the statics keep their +names and types) and S2 (`src/settings.rs` with `KdeSettings` / `MacosSettings` and `settings()`; +a test pins that the starting settings equal the starting values of the border and default +statics). The new crate is a path dependency of both workspaces (manifest, package manifest, +`Cargo.lock` +1 package). S3 was **not** started: it moves the writers (`apply_globals`) and the +readers in `monitor.rs`, `workspace.rs`, `window.rs`, `process_command.rs`, which the KDE and macOS +stacks are editing, and the load would publish once instead of storing key by key, which is the tear +removal marked BEHAVIOUR in section 5. It needs the rebase onto the merged stacks and its gate. + +Windows S1/S2, to apply when told (all in the files kfw is changing, so not done): + +1. `komorebi/Cargo.toml`: `komorebi-settings = { path = "../crates/komorebi-settings" }` (the crate is + already a root workspace member; `Cargo.lock` gets the dependency edge, no new package). +2. `komorebi/src/lib.rs`: `DEFAULT_WORKSPACE_PADDING` / `DEFAULT_CONTAINER_PADDING` start from + `PlatformDefaults::WINDOWS.workspace_padding` / `.container_padding` (10, 10); + `DEFAULT_RESIZE_DELTA` and `DEFAULT_MOUSE_FOLLOWS_FOCUS` are `komorebi_settings::shared::...` + (50, true); add `pub mod settings;`. +3. New `komorebi/src/settings.rs`, a copy of the KDE one with `WindowsSettings` (empty) and + `PlatformDefaults::WINDOWS`; its pin test compares the paddings, resize delta, mouse-follows-focus, + `BORDER_ENABLED`, `BORDER_WIDTH` (8), `BORDER_OFFSET` (-1) and the six colours, and leaves out + `border.radius` (Windows has no `BORDER_RADIUS`). +4. Gate: Windows clippy (`-D warnings`) and `cargo test -p komorebi --lib`; `tools/e2e-needed` will + say YES (the crate is in the closure of `komorebi.exe`) so one e2e run is owed, but behaviour is + unchanged. diff --git a/docs/dev/unified-binaries.md b/docs/dev/unified-binaries.md new file mode 100644 index 00000000..a26f2fd5 --- /dev/null +++ b/docs/dev/unified-binaries.md @@ -0,0 +1,325 @@ +# One `komorebi`, one `komorebic`, one `komorebi-bar` + +Goal: three packages and three binaries that build on Windows, KDE (Linux) and macOS, the platform +chosen by `cfg(target_os)` (generics, `cfg_select!`, exhaustive `match`; no macros as a design tool). +This file records a spike (throwaway revisions on bookmark `wip-u-pkg-spike`, titled `spike:`; nothing +landed on `wip-main`), the layout it recommends, the migration order, the risks and the gates. + +Measured on `wip-main` 633e7453 with the light gates only (`nice -n 19`, 3 jobs, persistent target +dirs, `COMMIT_HASH=dev`); no nix build, no e2e, no VM. macOS is type-checked with the fake CC only: it +was never linked or run. + +## What the spike did + +1. `spike: one root workspace ...` (rev `yuuyzssl`): the 10 KDE and macOS member crates became members + of the root workspace. Their two `[workspace]` manifests were deleted, their `workspace = true` + dependencies were written out, packages renamed (`komorebi-linux`, `komorebic-linux`, + `komorebi-client-linux`, `komorebi-hotkeys-linux`, `version-linux`, and `-macos` for the macOS + ones including `komorebi-bar-macos`); binary and lib names stayed (`[lib] name`, `[[bin]] name`) so + no source file changed. One `Cargo.lock`. +2. `spike: unified komorebic package by #[path] includes`: the root `komorebic` package became the + unified one. `src/main.rs` is a `cfg_select!` over `target_os` that includes the old Windows + `main.rs` (moved to `windows.rs`) and, by `#[path]`, the KDE and macOS `main.rs` where they live. + Dependencies are in `[target.'cfg(...)'.dependencies]` tables. Edits to the old files: `fn main` + became `pub fn main`; `crate::HOME_DIR` became `super::HOME_DIR` in KDE `hotkeys.rs`. +3. `spike: target-gate the macOS daemon crate`: objc2 and friends under + `[target.'cfg(target_os = "macos")'.dependencies]` plus `#![cfg(target_os = "macos")]` in + `komorebi-macos`, to test `cargo check --workspace` on a foreign target. + +The script that did step 1 is `S/pkg-spike.py` (scratchpad; rerunnable on a fresh `wip-main`). + +## Results + +| question | result | +|---|---| +| One lock resolves? | Yes. 859 packages (root) -> 900. All 859 Windows entries unchanged. The KDE lock had 644 and the macOS lock 786 entries, so +41 only. Crates with more than one version: 81 -> 95 (the `sysinfo` 0.38/0.39/0.40, `dirs` 6/7, `parking_lot` 0.12/0.13, `shadow-rs` 1/2, `netdev` 0.40/0.46 splits coexist; nothing needs unifying). | +| Locked versions kept? | Not exactly: crates that only KDE or macOS use were re-resolved to newest: `zbus`/`zbus_macros` 6.1 -> 6.2, `zbus_utils`, `zruntime`, `sysinfo` 0.40.0 -> 0.40.1, `libz-sys`, `unicode-width`. Pin with `cargo update zbus@6.2.0 --precise 6.1.0` (needs the `name@version` spelling) if the VM suites must see the old versions. | +| Windows `cargo check -p komorebic --target x86_64-pc-windows-msvc` (nix develop) | passes, 14.8 s wall warm (11.2 s compile); unified `komorebic` also passes, 7 s. | +| KDE native `cargo check -p komorebi-linux -p komorebic-linux` | passes; 1 m 38 s cold into a fresh lite target dir. Unified `komorebic` on Linux passes (1.4 s after touch) when openssl is available (see risk 2). | +| KDE tests unchanged | `cargo test -p komorebi-linux --lib`: 294 passed. `--test schemas -- --test-threads=1`: 5 passed. All four KDE packages, `--no-fail-fast`, 1 m 26 s warm: 879 passed, 1 failed. The failure is `tests/version.rs`: `komorebi-linux 0.1.0` instead of `komorebi 0.1.0` (clap takes the command name from `CARGO_PKG_NAME`); a renamed package needs `#[command(name = "komorebi")]`. Nothing else depends on the package name. | +| macOS fake-CC `cargo check --target aarch64-apple-darwin -p komorebi-macos -p komorebic-macos -p komorebi-bar-macos --all-targets --locked` | passes, 32 s warm (6 warnings in the bar, as before). Unified `komorebic` on macOS passes, 12 s. Type-check only. | +| Feature unification | Resolver 2 keeps `komorebi-layouts/darwin` off Windows: `cargo tree -p komorebic --target x86_64-pc-windows-msvc -e features -i komorebi-layouts` shows only `default`, the macOS package shows `darwin`. This holds only while the package that asks for `darwin` is not in the same build; `cargo ... --workspace` on one target selects them all (see risk 3). | +| `cargo check --workspace` for Windows (what clippy, fmt, nextest and crane do today) | FAILS in 52 s: `objc2 only works on Apple platforms`. With objc2 target-gated and `#![cfg(target_os = "macos")]`, `komorebi-macos` compiles empty on Windows (spike 3), so the fix is to gate every foreign-platform crate, not to exclude them. Done for one crate only. | +| Same dependency key, different path per target | REJECTED by cargo: `Dependency 'komorebi-client' has different source paths depending on the build target`. Same for `version`. So the unified package must use one key per platform (`komorebi-client-linux`, `komorebi-client-macos`, ...) and the platform module must alias it (`extern crate komorebi_client_linux as komorebi_client;` at the root, or `use komorebi_linux as komorebi;` at the top of each platform module). The spike used `extern crate`. | +| Compile time | No extra cost on a target: a build selects its own target's dependency tables, so Windows never sees zbus or objc2 and Linux never sees `windows`. The only added cost is resolution (`cargo metadata` 6.5 s with the network). | + +## Option A or B + +Measured size of what would have to move into `#[cfg(target_os)] mod` of one crate (Option B): +daemon `crate::` paths: Windows 669, KDE 447, macOS 587 (35,149 / 32,932 / 34,505 lines, 3 lib+bin +crates each with their own tests and a `komorebi-client` that re-exports them); bar 111 / 90 (7,710 / +5,551 lines); `komorebic` 0 (1,467 / 807 / 1,537 lines). + +Recommendation: + +- `komorebic`: B. One package `komorebic`, `src/main.rs` = `cfg_select!` choosing `mod windows`, + `mod linux`, `mod macos` (each the present `main.rs`, `hotkeys.rs` for Linux), one clap command name, + target-gated dependencies. Zero `crate::` rewrites, so the files move whole. This is what the spike + built (with `#[path]` instead of the final moves). +- `komorebi-bar`: B, as `bar-unification.md` already plans (`src/bar/{mod,windows,macos}.rs`, + `os/{windows,macos}.rs`); needs the bar stack integrated first. +- `komorebi` (daemon): A. Keep three library crates, rename to `komorebi-windows`, `komorebi-linux`, + `komorebi-macos` (distinct lib names, `komorebi_windows` etc.), each gated to its OS + (`#![cfg(target_os = ...)]`, target-gated dependencies, so `--workspace` works everywhere), each + keeping its own `crate::` paths and its own tests (KDE's 881 run unchanged but for the name). One + thin `komorebi` binary package: `src/main.rs` is a `cfg_select!` over the three daemons' + `main` bodies (each daemon's present `main.rs` becomes `pub fn run()` of its library). Option B for + the daemon would be a rewrite of about 1,700 `crate::` paths (669 + 447 + 587) for no behavioural gain, and it would + put KDE's tests and the VM suites on a moving target. +- `komorebi-client`: one package with `src/{windows,linux,macos}.rs` (211 / 394 / 225 lines, almost all + `pub use komorebi::...`), each starting with `use komorebi_windows as komorebi;` and so on. + +## Migration order + +Every revision keeps the three existing trees building with their present gates. "Gate" says what +must pass before it counts as landed: `C` compile (fast-check, the three checks), `S` the CLI oracle +(`S/step4/oracle-check.sh`, byte-identical for all three platforms; it reads `komorebic/src/main.rs` +of each tree, so it needs its paths updated in the revision that moves a file), `N` nix evaluation +(`nix flake show`), `NB` a nix build of the checks in an idle window, `E` Windows e2e, `V` KDE VM `fast`. + +0. Prerequisites, no moves (any time, small): explicit `#[command(name = ...)]` on the three CLIs; + `build.rs` of `komorebic` stops fetching `applications.json` over the network (the file is checked + in; a build script that needs `reqwest`, and so openssl, on Linux is what stopped the unified + package building natively); `pub fn main` and `crate::` -> `super::` in the `komorebic` files. + Gates C, S. Not behaviour. +1. Package renames inside the present workspaces (KDE: `komorebi-linux` and so on; macOS the same; + Windows daemon `komorebi-windows` last), with `[lib] name` and `[[bin]] name` unchanged. Gates C, + N; the Windows daemon rename is `E` (the executable's inputs change). +2. Workspace merge: delete `komorebi-for-kde/Cargo.toml` and `komorebi-for-mac/Cargo.toml`, add their + crates to the root members, write out the inherited dependencies, one lock (+41 packages), add + `.cargo/config.toml` with `[env] COMMIT_HASH` (KDE's file moves from `komorebi-for-kde/.cargo`; + cargo reads it from the working directory upward only). Same revision gates every foreign crate + (`#![cfg(target_os)]`, target-gated dependencies) so `--workspace` works on all targets. Gates C on + all three, plus KDE tests unchanged. Cargo-wise this is one revision (the spike's script); it must + not be split without breaking `--locked`. +3. Flakes, same integration as 2 (nix cannot be half-merged): the root flake builds all three; the two + nested flakes already take the whole repository as their source (`lib.mkOutputs`), so they become + thin: `workspaceArgs` change from a subdirectory workspace to `-p `. The KDE source filter + must list the new member directories. Gates N, then `NB` (deps, clippy, nextest of each system), + then `V`. +4. `komorebic` unified by `#[path]` (spike 2, minus the hacks): new `komorebic/src/main.rs`, target + tables, aliases. The old `komorebic-linux`/`-macos` packages stay until step 5 so the old names + work. Gates C, S, and `E` for `komorebic.exe` (the Windows main moves to `windows.rs`). +5. `komorebic` real moves, one platform per revision: `komorebi-for-kde/komorebic/src/*` to + `komorebic/src/linux/`, the macOS one to `komorebic/src/macos/`, tests with them, then delete the old + packages. Pure moves (jj does not follow moves, so each is a delete/modify conflict if another stack + touches those files; today none does). Gates C, S, tests. +6. `komorebi-client` unified (modules per platform), same pattern. Gates C, E (Windows client is in the + closure of `komorebi.exe`). +7. `komorebi-bar` unified after the bar stack integrates: `bar-unification.md` plan; Windows bar + screenshot gate and the Mac hand check are owed by that stack. +8. Daemon: three libraries gated to their OS and one thin `komorebi` package with the `cfg_select!` + `main`. KDE `main.rs` and the Windows `main.rs` become `run()` in their libraries. Gates C, `E`, `V`, + Mac hand check. +9. Cutover: one flake output per binary, old per-platform package names, `justfile`, CI + (`.github/workflows`), docs paths, release version (0.1.42 / 0.1.0 / 0.1.1 become one). + +## Risks + +1. One lock for three platforms: a `cargo update` for one platform moves the others; crane's dummy + source includes every member's manifest and the lock, so any dependency change rebuilds the + dependency derivation of all three systems (today a KDE-only lock change cannot touch Windows). The + `COMMIT_HASH`-constant fix (flow finding 1) must be in first or every commit rebuilds ~1,000 crates. +2. `build.rs` fetching over the network is not usable in a unified package (openssl on Linux); see step 0. +3. `--workspace` commands (clippy, fmt, nextest, crane) select every member on every target: every + foreign crate must compile empty (spike 3 shows it works for the daemon; only one crate was + converted). Without it, feature unification would also turn `komorebi-layouts/darwin` on for + Windows in a whole-workspace build. +4. The one-key-one-path rule forces distinct dependency keys and aliases per platform module. +5. `CARGO_BUILD_TARGET` is set by the root `nix develop` shell, so native Linux checks must run outside it + (as `fast-check` does) or pass `--target x86_64-unknown-linux-gnu`. +6. Command names and `--version` text come from `CARGO_PKG_NAME`/the version crate: pin them or the KDE + `version` test and the docs oracle change. `shadow-rs` major versions differ (2 on Windows, 1 on + macOS); the unified `komorebic` build script can only use one. +7. The KDE VM suites rebuild on any change to the KDE closure: the merge is one full `V` run. +8. Tests that use `CARGO_BIN_EXE_*` or relative paths (`tests/schemas.rs` writes beside the manifest) + must move with their package; not exercised beyond the spike. + +## Gates by step, in short + +Compile only: 0, 4 (but see `E`), 5, 6 at the Rust level; nix evaluation only: 3 until built. Needs +e2e (Windows guest): anything that changes an input of `komorebi.exe`, `komorebic.exe` or the client +(`tools/e2e-needed` says: 1 for the Windows daemon, 4, 6, 8). Needs the KDE VM: 2, 3, 8. Needs a Mac, +by hand: 4, 7, 8, 9. + +Mac hand check (type-check proves none of it): `komorebic --version` and `--help` show the macOS +command set and the name `komorebic`; `komorebic start` finds and starts `komorebi`, `stop` stops it; +`komorebic docgen` unchanged; `komorebi --version`; the daemon starts, tiles and `komorebic state` +answers; `komorebi-bar` opens, `--schema` equals `komorebi-for-mac/schema.bar.json`; +the embedded `applications.json` is the macOS one; +`otool -L` of each binary lists no Windows or Linux-only library. + +## Conflicts with the open stacks (sequence in a quiet period) + +Paths touched by each bookmark relative to `wip-main`: + +| bookmark | touches | moves in this plan that conflict | +|---|---|---| +| wip-u-kfw | `komorebi/src/**`, `crates/komorebi-backend/**` | daemon rename and any move of `komorebi/` (steps 1 Windows, 8) | +| wip-u-kfm | `komorebi-for-mac/komorebi/src/**`, `crates/komorebi-backend/**` | macOS daemon rename and moves (1, 8) | +| wip-u-kfde | `komorebi-for-kde/komorebi/{src,tests}/**` | KDE daemon rename (1) and moves (8); tests are edited | +| wip-u-bar | `Cargo.lock`, `komorebi-for-mac/Cargo.lock`, `komorebi-bar/src/**`, `komorebi-for-mac/komorebi-bar/src/**`, `crates/komorebi-bar-core` | step 2 (locks, manifests) and step 7 | +| wip-u-settings | `Cargo.toml`, `Cargo.lock`, `crates/komorebi-settings` | step 2 (root manifest and lock) | +| wip-u-nix | `flake.nix`, `komorebi-for-kde/flake.nix`, `komorebi-for-kde/nix/**` | step 3 | + +Not touched by any open stack, so safe now: `komorebic/**` (all three), the `komorebic` tests, the +`version` crates, the `komorebi-client` crates (steps 0, 4, 5, 6 are free of conflicts except the lock +and root manifest lines of step 2/4). Hard conflicts: every `Cargo.lock` and the root `Cargo.toml` +`members` list (resolve by taking one side and running `cargo metadata`; never hand-merge a lock), +`flake.nix` lines for the extracted binaries. Suggested order: integrate kfw, kfm, kfde, bar, settings, +nix first; then steps 0 and 1; then 2 and 3 as one integration; the rest in any order, daemon (8) +last. + +## What landed + +Only this file. The spike revisions are on `wip-u-pkg-spike` and can be dropped or cherry-picked. +Step 0 and the renames were not landed because they only pay off with step 2, which edits the locks +and manifests that three open stacks edit. + +## State of the migration (bookmark wip-u-pkg-mig, on wip-u-pkg-base) + +Done, in this order (each revision keeps the three trees building; gates are in the revision messages): + +0. `applications.json` committed (build.rs fetch gone), explicit clap names, the KDE closure list fixed. +1. KDE and macOS packages suffixed (`komorebi-linux`, `komorebic-macos`, ...); Windows daemon `komorebi-windows`. +2. One root workspace, one lock (901 packages), `default-members` is the Windows set. +3. `nix/workspace-src.nix`: each flake builds its platform's source plus stubs of every other member, + `-p` per platform. +4. `komorebic` is one package with a `cfg_select!` over three CLI modules; the help text of each platform + is a literal (it used to come from the package description). +5. The Linux and macOS CLI files moved into `komorebic/src/{linux,macos}` (pure moves, one per revision); + the KDE `komorebic` tests are `komorebic/tests/linux_*.rs`. The old `komorebic-linux` and + `komorebic-macos` packages are shims that include the moved files; they have no tests of their own. +6. `komorebi-client`: the three socket codes made equal (Connection on all), then one package whose + `lib.rs` is a `cfg_select!` re-exporting `windows.rs`, `linux.rs` or `macos.rs`; old + `komorebi-client-linux`/`-macos` are shims; `komorebic` uses the one client. + +Measured by evaluation (no build): an edit of a Windows-only crate or of `komorebic/src/windows.rs` or +`komorebi-client/src/windows.rs` changes the Windows derivations and no kfde derivation; an edit of a Linux +file changes kfde and no Windows derivation; an edit of a macOS file changes neither. The cache isolation of +the three trees survived the merge and the unified packages. + +Costs and limits found on the way: +- The stubbed source is a derivation that crane reads at evaluation (`readDir` in `mkDummySrc`), so + evaluating another system's attributes needs a builder for that system (decision D-pkg-1). + `nix flake show --all-systems` and aarch64-darwin drvPaths do not evaluate on a Linux host. +- cargo deny, cargo fmt and taplo run over the merged workspace: deny is called with + `--workspace --exclude ` and the tree's own deny.toml, fmt gets `-p`; + none of them has been built. +- cargo allows one path per dependency key: the daemon crates keep distinct keys and the modules alias them + (`extern crate komorebi_linux as komorebi`, `use crate::komorebi_linux as komorebi`). A dependency with + no `package =` is named by its lib name, not by its key: write `package = ""` when the key + must be the extern name. +- Building both `komorebic` and `komorebic-linux` in one cargo command writes the same binary name twice. +- Comments and docs that name `komorebic/src/main.rs`, `komorebic/tests/*.rs` or the KDE client paths + (check.rs, ARCHITECTURE.md, scripts/compare-gen.py, the VM check suite) still carry the old paths; they + are text in files whose change would rebuild the KDE derivations. + +## Step 7 for the bar (B0-B3 executed, B4 not) + +State: `crates/komorebi-bar-core` holds the shared code (config, widgets, `BarPlatform`, schema views); the +two shells are `komorebi-bar` (Windows) and `komorebi-for-mac/komorebi-bar` (package `komorebi-bar-macos`), +see `bar-unification.md` for what stays per platform. Both use `komorebi-bar-core` (one version) and +differ in `main.rs`, `bar.rs`, `os.rs`, `widgets/{komorebi,network,widget,mod}.rs`; Windows adds +`widgets/{keyboard,media,systray}.rs`. `crate::` occurs 111 times (Windows) and 90 (macOS). + +B0. Prerequisite (done, step 6): one `komorebi-client`. In `komorebi-for-mac/komorebi-bar/Cargo.toml` change + `komorebi-client = { package = "komorebi-client-macos", path = "../komorebi-client", ... }` to + `komorebi-client = { path = "../../komorebi-client", default-features = false }`; the feature + `schemars` already forwards to `komorebi-client/default`. Gate: macOS fake-CC check of + `komorebi-bar-macos`; one revision. + +B1. Windows bar becomes a module, in place. Create `komorebi-bar/src/windows/`; `git mv`/`jj` move + `bar.rs config.rs os.rs widgets/` into it and `main.rs` to `windows/mod.rs` (`mod bar; mod config; mod + os; mod widgets;` stay as they are, `fn main` becomes `pub fn main`). In the moved files replace + `crate::` by `crate::windows::` (sed, 111 sites; do not touch `komorebi_bar_core::`). New + `komorebi-bar/src/main.rs`: `mod windows; fn main() -> color_eyre::eyre::Result<()> { windows::main() }`. + Pure move plus one mechanical edit, two revisions (move, then the paths). Gate: Windows clippy + `-D warnings`; the bar screenshot gate (owed since the bar stack) and `e2e-needed` says NO for the bar. + +B2. macOS bar the same, in its own package: `komorebi-for-mac/komorebi-bar/src/macos/`, + `crate::` -> `crate::macos::` (90 sites), `main.rs` = `mod macos; fn main() { macos::main() }`. Gate: + macOS fake-CC check; the Mac hand check. + +B3. Merge into one package (one revision, with its flake edit): + - Move `komorebi-for-mac/komorebi-bar/src/macos` to `komorebi-bar/src/macos`. + - `komorebi-bar/src/main.rs`: `cfg_select! { target_os = "windows" => { mod windows; use windows as + platform; } target_os = "macos" => { mod macos; use macos as platform; } }` and `fn main() { platform::main() }`. + - `komorebi-bar/Cargo.toml`: common `[dependencies]` = what both manifests share (`komorebi-bar-core`, + `komorebi-client`, `komorebi-themes`, `chrono`, `chrono-tz`, `clap`, `color-eyre`, `crossbeam-channel`, + `dirs`, `dunce`, `eframe`, `egui-phosphor`, `font-loader`, `hotwatch`, `image`, `lazy_static`, `num*`, + `parking_lot`, `random_word`, `reqwest`, `schemars`, `serde`, `serde_json`, `sysinfo`, `tracing*`); + `[target.'cfg(windows)'.dependencies]`: `egui_extras`, `netdev = "0.46"`, `regex`, `systray-util`, + `tokio`, `which`, `windows`, `windows-core`, both `windows-icons` revisions; + `[target.'cfg(target_os = "macos")'.dependencies]`: `netdev = "0.40"`, `icns`, `objc2`, + `objc2-app-kit` (the feature list of the macOS manifest), `raw-window-handle`. The dependency versions + of the two manifests differ only for `netdev` (0.46 / 0.40), which cargo accepts per target. + - Old package `komorebi-bar-macos` stays: `komorebi-for-mac/komorebi-bar/src/main.rs` is + `#[path = "../../../komorebi-bar/src/macos/mod.rs"] mod macos; fn main() { macos::main() }` + (the moved code names `crate::macos::`, which this root provides). + - Flakes: the macOS flake `-p komorebi-bar` instead of `-p komorebi-bar-macos`, its source filter takes + `komorebi-bar/{Cargo.toml,src/main.rs,src/macos/**}` and `isReal` `komorebi-bar`; the root filter + leaves `komorebi-bar/src/macos` out and the KDE flake needs nothing (it never had a bar; the stub + is the member's manifest). The `fmt`/`deny` lists drop `komorebi-bar` from the macOS exclusions. + - Schemas: `schema.bar.json` and `komorebi-for-mac/schema.bar.json` stay; the oracle test in + `komorebi-bar-core` reads both. `cargo run -p komorebi-bar -- --schema` prints the view of the target OS. + Gates: Windows clippy, macOS fake-CC check of `komorebi-bar` and `komorebi-bar-macos`, the schema oracle + (`cargo test -p komorebi-bar-core`), nix evaluation, the isolation test of the evaluation (an edit of + `komorebi-bar/src/windows/` must not change a macOS derivation and the reverse). Owed: the Windows bar + screenshot, the Mac hand check. + +B4. Converge the remaining differences one revision each, each BEHAVIOUR on one platform and needing its + screenshot or Mac check: `widgets/komorebi.rs` frame margins, `network.rs`, then the platform seams in + `bar.rs`/`main.rs` behind `BarPlatform` hooks (list in `bar-unification.md`). + +## Owed from the coordinator (heavy gates, idle host; everything below was evaluated, none built) + +At bookmark `wip-u-pkg-mig`: + +``` +tools/gate-lock run --class heavy --label "pkg checks" --est 25 -- nix build -L --no-link \ + .#checks.x86_64-linux.komorebi-workspace-clippy .#checks.x86_64-linux.komorebi-workspace-deny \ + .#checks.x86_64-linux.komorebi-workspace-fmt .#checks.x86_64-linux.komorebi-workspace-toml-fmt \ + .#checks.x86_64-linux.komorebi-workspace-nextest +tools/gate-lock run --class heavy --label "pkg kfde checks" --est 40 -- nix build -L --no-link \ + .#checks.x86_64-linux.kfde-komorebi-workspace-{clippy,doc,deny,fmt,toml-fmt,nextest} \ + .#checks.x86_64-linux.kfde-schema-fresh .#packages.x86_64-linux.kfde-komorebic .#packages.x86_64-linux.kfde-komorebi +nix build -L .#packages.x86_64-linux.komorebic .#packages.x86_64-linux.komorebi +``` + +then the KDE VM `fast` suites (the KDE package derivations changed), and the Windows e2e gate +(`tools/e2e-needed` says YES: `komorebi-windows`, `komorebic` and `komorebi-client` changed); on a Mac or +a darwin builder `nix build -L .#packages.aarch64-darwin.kfm-komorebic .#packages.aarch64-darwin.kfm-komorebi +.#packages.aarch64-darwin.kfm-komorebi-bar` and the `kfm-` checks. By hand on a Mac: `komorebic --help`, +`--version`, `quickstart`, `start`, `stop`, `state`, `docgen`; `komorebi-bar` still builds from the old +package name. If deny, fmt or taplo fail in the merged workspace, the fix is in the `cargoDenyExtraArgs`, +`cargoExtraArgs` of the three flakes, not in the code. + +### Bar: what was done and what was left + +B0-B3 are done as revisions of `wip-u-pkg-mig` (client edge, Windows module, macOS module, merge). Edits +were mechanical: `crate::` to `crate::windows::` / `crate::macos::`, one more `../` in the `include_str!` +paths, the unused root re-export of `komorebi_bar_core::platform` dropped. `komorebi-bar-macos` remains as +a shim. The schema gate is `S/bar2/regen.sh` (now reads `src/windows` and `src/macos`): both bars' schema +files regenerate byte-identical on Linux. B4 was not done: the remaining differences are rendering +(frame margins in `widgets/komorebi.rs`), `network.rs` behaviour and the window seams in `bar.rs`/`main.rs`, +none of which can be shown to be mechanical without a screen. + +## For the Mac Mini (aarch64-darwin, native) + +Run on the revisions of `wip-u-pkg-mig` at or after the stated one, from the repository root: + +``` +cargo build --locked -p komorebic -p komorebi-macos -p komorebi-bar # after "one komorebi-bar package" +cargo build --locked -p komorebic-macos -p komorebi-bar-macos -p komorebi-client-macos # the shims still build +cargo clippy --locked -p komorebic -p komorebi-client -p komorebi-bar -p komorebi-bar-core -p komorebi-macos --all-targets -- -D warnings +cargo test --locked -p komorebi-macos -p komorebic -p komorebi-client -p komorebi-bar-core -p komorebi-bar +target/debug/komorebic --help; target/debug/komorebic --version; target/debug/komorebic docgen --output /tmp/docs-mac +target/debug/komorebi-bar --schema | cmp - komorebi-for-mac/schema.bar.json +``` + +Note: there is no package named `komorebi` yet: the daemon is `komorebi-macos` on macOS and `komorebi-windows` on Windows (binary name `komorebi` for both; the single `komorebi` package is step 8). Never write `-p komorebi`. Do not build `komorebic` and `komorebic-macos` in the same command (same binary name). The lint fix `fix(bar-core): WidgetConfig::supported as matches!` is needed for clippy to pass. +The macOS checks that matter by revision: +`refactor(komorebic): move the macOS CLI ...` (komorebic, quickstart, start, stop), `refactor(client): one +komorebi-client ...` (the client tests in `komorebi-client/src/macos.rs`), and `refactor(bar): one +komorebi-bar package ...` (the bar opens, `--schema`). Everything in `docs/dev/macos-handcheck.md` still applies. diff --git a/flake.nix b/flake.nix index 264b0d41..e3a4727b 100644 --- a/flake.nix +++ b/flake.nix @@ -215,12 +215,16 @@ msvcEnv = mkMsvcEnv { inherit pkgs windowsSdk; }; - src = pkgs.lib.cleanSourceWith { + # the files of the Windows crates; the KDE and macOS crates are in the same Cargo workspace and + # are added as stubs (nix/workspace-src.nix), so that an edit of one changes nothing here + real = pkgs.lib.cleanSourceWith { src = ./.; filter = path: type: - # the other platforms' trees have their own workspaces and are built by their own outputs + # the other platforms' crates are added as stubs below !(pkgs.lib.hasInfix "/komorebi-for-kde" path || pkgs.lib.hasInfix "/komorebi-for-mac" path) + # the Linux and macOS files of komorebic are not read when building for Windows + && !(builtins.match ".*/komorebi(c/(src/(linux|macos)|tests/(linux|macos)_)|-client/(src/(linux|macos)\\.rs|tests/(linux|macos)_)|-bar/src/macos)[^/]*.*" path != null) && ( (craneLib.filterCargoSources path type) || (pkgs.lib.hasInfix "/docs/" path) @@ -229,13 +233,25 @@ ); }; + src = import ./nix/workspace-src.nix { + inherit pkgs real; + repoRoot = ./.; + isReal = member: !(pkgs.lib.hasPrefix "komorebi-for-" member); + }; + commonArgs = { inherit src version; + cargoLock = "${real}/Cargo.lock"; + cargoToml = "${real}/Cargo.toml"; + # vendored from the filtered source, not the stubbed one: no build is needed to evaluate + cargoVendorDir = craneLib.vendorCargoDeps { src = real; }; strictDeps = true; - # komorebic/build.rs downloads applications.json if it is missing, which - # is not possible in the sandbox, so provide the pinned copy instead + # applications.json is committed now; this copies the pinned asc input over it, so that the + # embedded file is the pinned one even when the committed copy is older preBuild = "mkdir -p komorebic && cp ${inputs.asc}/applications.json komorebic/applications.json"; - COMMIT_HASH = commit; + # a constant, so that the dependencies and every check are the same + # derivations for every commit; only fullBuild stamps the real one + COMMIT_HASH = "nix-check"; # build inputs for cross-compilation nativeBuildInputs = [ @@ -278,6 +294,7 @@ individualCrateArgs // { pname = "komorebi-workspace"; + COMMIT_HASH = commit; } ); @@ -296,6 +313,7 @@ inherit craneLib src + real individualCrateArgs fullBuild msvcEnv @@ -493,14 +511,37 @@ komorebi-workspace-fmt = build.craneLib.cargoFmt { inherit (build) src; + pname = "komorebi-workspace"; + version = "0.1.0"; + cargoToml = "${build.real}/Cargo.toml"; }; komorebi-workspace-toml-fmt = build.craneLib.taploFmt { - src = pkgs.lib.sources.sourceFilesBySuffices build.src [ ".toml" ]; + src = pkgs.lib.sources.sourceFilesBySuffices build.real [ ".toml" ]; }; + # cargo deny sees every member of the workspace: leave out the KDE and macOS packages, which + # have their own policy (komorebi-for-*/deny.toml) in their own checks komorebi-workspace-deny = build.craneLib.cargoDeny { inherit (build) src; + pname = "komorebi-workspace"; + version = "0.1.0"; + cargoToml = "${build.real}/Cargo.toml"; + cargoLock = "${build.real}/Cargo.lock"; + cargoDenyExtraArgs = + "--workspace " + + pkgs.lib.concatMapStringsSep " " (p: "--exclude ${p}") [ + "komorebi-linux" + "komorebic-linux" + "komorebi-client-linux" + "komorebi-hotkeys" + "version-linux" + "komorebi-macos" + "komorebic-macos" + "komorebi-client-macos" + "komorebi-bar-macos" + "version-macos" + ]; }; komorebi-workspace-nextest = build.craneLib.cargoNextest build.individualCrateArgs; diff --git a/justfile b/justfile index 8353731e..3296b7dd 100644 --- a/justfile +++ b/justfile @@ -86,7 +86,7 @@ jsonschema: cargo run --package komorebic -- application-specific-configuration-schema > schema.asc.json cargo run --package komorebi-bar -- --schema > schema.bar.json -version := `cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "komorebi") | .version'` +version := `cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "komorebi-windows") | .version'` schemapub: rm -Force komorebi-schema diff --git a/komorebi-bar/Cargo.toml b/komorebi-bar/Cargo.toml index f75831f4..74b6b1da 100644 --- a/komorebi-bar/Cargo.toml +++ b/komorebi-bar/Cargo.toml @@ -5,10 +5,12 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +# What both platforms use is in [dependencies]; what only one uses, or uses in another version or with other +# features, is in the table of its target OS, so that a build for one compiles nothing of the other. + [dependencies] komorebi-bar-core = { path = "../crates/komorebi-bar-core", default-features = false } komorebi-client = { path = "../komorebi-client", default-features = false } -komorebi-themes = { path = "../komorebi-themes", default-features = false } chrono-tz = { workspace = true } chrono = { workspace = true } @@ -19,33 +21,51 @@ dirs = { workspace = true } dunce = { workspace = true } eframe = { workspace = true } egui-phosphor = { git = "https://github.com/amPerl/egui-phosphor", rev = "d13688738478ecd12b426e3e74c59d6577a85b59" } -egui_extras = { workspace = true } font-loader = "0.11" hotwatch = { workspace = true } image = "0.25" lazy_static = { workspace = true } -netdev = "0.46" num = "0.4" num-derive = "0.4" num-traits = "0.2" parking_lot = { workspace = true } -regex = "1" random_word = { version = "0.5", features = ["en"] } reqwest = { version = "0.12", features = ["blocking"] } schemars = { workspace = true, optional = true } serde = { workspace = true } serde_json = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } + +[target.'cfg(windows)'.dependencies] +komorebi-themes = { path = "../komorebi-themes", default-features = false } +egui_extras = { workspace = true } +netdev = "0.46" +regex = "1" sysinfo = { workspace = true } systray-util = "0.2.0" tokio = { version = "1", features = ["rt", "sync", "time"] } -tracing = { workspace = true } -tracing-subscriber = { workspace = true } which = { workspace = true } windows = { workspace = true } windows-core = { workspace = true } windows-icons = { git = "https://github.com/LGUG2Z/windows-icons", rev = "0c9d7ee1b807347c507d3a9862dd007b4d3f4354" } windows-icons-fallback = { package = "windows-icons", git = "https://github.com/LGUG2Z/windows-icons", rev = "d67cc9920aa9b4883393e411fb4fa2ddd4c498b5" } +[target.'cfg(target_os = "macos")'.dependencies] +komorebi-themes = { path = "../komorebi-themes" } +icns = "0.4" +netdev = "0.40" +objc2 = { version = "0.6", default-features = false, features = ["std"] } +objc2-app-kit = { version = "0.3", default-features = false, features = [ + "std", + "NSApplication", + "NSResponder", + "NSView", + "NSWindow", +] } +raw-window-handle = "0.6" +sysinfo = "0.38" + [features] default = ["schemars"] schemars = [ diff --git a/komorebi-for-mac/komorebi-bar/src/bar.rs b/komorebi-bar/src/macos/bar.rs similarity index 97% rename from komorebi-for-mac/komorebi-bar/src/bar.rs rename to komorebi-bar/src/macos/bar.rs index 533ac9af..b46f4bce 100644 --- a/komorebi-for-mac/komorebi-bar/src/bar.rs +++ b/komorebi-bar/src/macos/bar.rs @@ -1,25 +1,26 @@ -use crate::AUTO_SELECT_FILL_COLOUR; -use crate::AUTO_SELECT_TEXT_COLOUR; -use crate::BAR_HEIGHT; -use crate::DEFAULT_PADDING; -use crate::KomorebiEvent; -use crate::MAX_LABEL_WIDTH; -use crate::MONITOR_LEFT; -use crate::MONITOR_RIGHT; -use crate::MONITOR_TOP; -use crate::config::KomobarConfig; -use crate::config::MonitorConfigOrIndex; -use crate::config::Position; -use crate::config::PositionConfig; -use crate::config::get_individual_spacing; -use crate::render::Color32Ext; -use crate::render::Grouping; -use crate::render::RenderConfig; -use crate::render::RenderExt; -use crate::widgets::komorebi::Komorebi; -use crate::widgets::komorebi::MonitorInfo; -use crate::widgets::widget::BarWidget; -use crate::widgets::widget::WidgetConfig; +use crate::macos::AUTO_SELECT_FILL_COLOUR; +use crate::macos::AUTO_SELECT_TEXT_COLOUR; +use crate::macos::BAR_HEIGHT; +use crate::macos::DEFAULT_PADDING; +use crate::macos::KomorebiEvent; +use crate::macos::MAX_LABEL_WIDTH; +use crate::macos::MONITOR_LEFT; +use crate::macos::MONITOR_RIGHT; +use crate::macos::MONITOR_TOP; +use crate::macos::config::KomobarConfig; +use crate::macos::config::MonitorConfigOrIndex; +use crate::macos::config::Position; +use crate::macos::config::PositionConfig; +use crate::macos::config::get_individual_spacing; +use crate::macos::render::Color32Ext; +use crate::macos::render::Grouping; +use crate::macos::render::RenderConfig; +use crate::macos::render::RenderExt; +use crate::macos::widgets::komorebi::Komorebi; +use crate::macos::widgets::komorebi::MonitorInfo; +use crate::macos::widgets::widget::BarWidget; +use crate::macos::widgets::widget::WidgetConfig; +use crate::macos::widgets::widget::WidgetConfigExt; use crossbeam_channel::Receiver; use crossbeam_channel::TryRecvError; use eframe::egui::Align; diff --git a/komorebi-bar/src/macos/config.rs b/komorebi-bar/src/macos/config.rs new file mode 100644 index 00000000..0702a6d7 --- /dev/null +++ b/komorebi-bar/src/macos/config.rs @@ -0,0 +1 @@ +pub use komorebi_bar_core::config::*; diff --git a/komorebi-bar/src/macos/mod.rs b/komorebi-bar/src/macos/mod.rs new file mode 100644 index 00000000..8808d49d --- /dev/null +++ b/komorebi-bar/src/macos/mod.rs @@ -0,0 +1,387 @@ +mod bar; +mod config; +mod os; +pub use komorebi_bar_core::render; +pub use komorebi_bar_core::selected_frame; +pub use komorebi_bar_core::ui; +mod widgets; + +use crate::macos::bar::Komobar; +use crate::macos::config::KomobarConfig; +use crate::macos::config::Position; +use crate::macos::config::PositionConfig; +use clap::Parser; +use color_eyre::eyre; +use config::MonitorConfigOrIndex; +use eframe::egui::ViewportBuilder; +use font_loader::system_fonts; +use hotwatch::EventKind; +use hotwatch::Hotwatch; +use komorebi_client::PathExt; +use komorebi_client::SocketMessage; +use komorebi_client::SubscribeOptions; +use komorebi_client::replace_env_in_path; +use objc2::MainThreadMarker; +use objc2_app_kit::NSApplication; +use objc2_app_kit::NSApplicationActivationPolicy; +use objc2_app_kit::NSView; +use raw_window_handle::HasWindowHandle; +use raw_window_handle::RawWindowHandle; +use std::io::BufReader; +use std::io::Read; +use std::path::PathBuf; +use std::sync::atomic::Ordering; +use std::time::Duration; +use tracing_subscriber::EnvFilter; + +pub use komorebi_bar_core::statics::*; + +#[derive(Parser)] +#[clap(name = "komorebi-bar", author, about, version)] +struct Opts { + /// Print the JSON schema of the configuration file and exit + #[clap(long)] + schema: bool, + /// Print a list of fonts available on this system and exit + #[clap(long)] + fonts: bool, + /// Path to a JSON or YAML configuration file + #[clap(short, long)] + #[clap(value_parser = replace_env_in_path)] + config: Option, + /// Write an example komorebi.bar.json to disk + #[clap(long)] + quickstart: bool, + /// Print a list of aliases that can be renamed to canonical variants + #[clap(long)] + #[clap(hide = true)] + aliases: bool, +} + +pub enum KomorebiEvent { + Notification(komorebi_client::Notification), + Reconnect, +} + +pub fn main() -> eyre::Result<()> { + komorebi_bar_core::platform::install(&os::MacBar); + + let opts: Opts = Opts::parse(); + + #[cfg(feature = "schemars")] + if opts.schema { + print!( + "{}", + komorebi_bar_core::schema::generated_text::( + komorebi_bar_core::schema::SchemaPlatform::MacOs + ) + ); + std::process::exit(0); + } + + if opts.fonts { + for font in system_fonts::query_all() { + println!("{font}"); + } + + std::process::exit(0); + } + + if std::env::var("RUST_LIB_BACKTRACE").is_err() { + unsafe { + std::env::set_var("RUST_LIB_BACKTRACE", "1"); + } + } + + color_eyre::install()?; + + if std::env::var("RUST_LOG").is_err() { + unsafe { + std::env::set_var("RUST_LOG", "info"); + } + } + + tracing::subscriber::set_global_default( + tracing_subscriber::fmt::Subscriber::builder() + .with_env_filter(EnvFilter::from_default_env()) + .finish(), + )?; + + let home_dir: PathBuf = std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( + |_| { + dirs::home_dir() + .expect("there is no home directory") + .join(".config") + .join("komorebi") + }, + |home_path| { + let home = home_path.replace_env(); + + assert!( + home.is_dir(), + "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory" + ); + + home + }, + ); + + if opts.quickstart { + let komorebi_bar_json = include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json").to_string(); + std::fs::write(home_dir.join("komorebi.bar.json"), komorebi_bar_json)?; + println!( + "Example komorebi.bar.json file written to {}", + home_dir.display() + ); + + std::process::exit(0); + } + + let default_config_path = home_dir.join("komorebi.bar.json"); + + let config_path = opts.config.or_else(|| { + default_config_path + .is_file() + .then_some(default_config_path.clone()) + }); + + let mut config = match config_path { + None => { + let komorebi_bar_json = + include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json").to_string(); + + std::fs::write(&default_config_path, komorebi_bar_json)?; + tracing::info!( + "created example configuration file: {}", + default_config_path.display() + ); + + KomobarConfig::read(&default_config_path)? + } + Some(ref config) => { + if !opts.aliases { + tracing::info!("found configuration file: {}", config.display()); + } + + KomobarConfig::read(config)? + } + }; + + let config_path = config_path.unwrap_or(default_config_path); + + if opts.aliases { + KomobarConfig::aliases(&std::fs::read_to_string(&config_path)?); + std::process::exit(0); + } + + let state = serde_json::from_str::(&komorebi_client::send_query( + &SocketMessage::State, + )?)?; + + let (usr_monitor_index, work_area_offset) = match &config.monitor { + Some(MonitorConfigOrIndex::MonitorConfig(monitor_config)) => { + (monitor_config.index, monitor_config.work_area_offset) + } + Some(MonitorConfigOrIndex::Index(idx)) => (*idx, None), + None => (0, None), + }; + let monitor_index = state + .monitor_usr_idx_map + .get(&usr_monitor_index) + .map_or(usr_monitor_index, |i| *i); + + MONITOR_RIGHT.store( + state.monitors.elements()[monitor_index].size.right, + Ordering::SeqCst, + ); + + MONITOR_TOP.store( + state.monitors.elements()[monitor_index].size.top, + Ordering::SeqCst, + ); + + MONITOR_LEFT.store( + state.monitors.elements()[monitor_index].size.left, + Ordering::SeqCst, + ); + + MONITOR_INDEX.store(monitor_index, Ordering::SeqCst); + + // use monitor.size for the actual monitor bounds (top-left origin in global coordinates) + // the window level kCGBackstopMenuLevel positions the bar behind the menu bar + match config.position { + None => { + config.position = Some(PositionConfig { + start: Some(Position { + x: state.monitors.elements()[monitor_index].size.left as f32, + y: state.monitors.elements()[monitor_index].size.top as f32, + }), + end: Some(Position { + x: state.monitors.elements()[monitor_index].size.right as f32, + y: 50.0, + }), + }) + } + Some(ref mut position) => { + if position.start.is_none() { + position.start = Some(Position { + x: state.monitors.elements()[monitor_index].size.left as f32, + y: state.monitors.elements()[monitor_index].size.top as f32, + }); + } + + if position.end.is_none() { + position.end = Some(Position { + x: state.monitors.elements()[monitor_index].size.right as f32, + y: 50.0, + }) + } + } + } + + let viewport_builder = ViewportBuilder::default() + .with_decorations(false) + .with_transparent(true) + .with_has_shadow(false) + .with_taskbar(false); + + let native_options = eframe::NativeOptions { + viewport: viewport_builder, + ..Default::default() + }; + + if let Some(rect) = &work_area_offset { + komorebi_client::send_message(&SocketMessage::MonitorWorkAreaOffset(monitor_index, *rect))?; + tracing::info!("work area offset applied to monitor: {}", monitor_index); + } + + let (tx_gui, rx_gui) = crossbeam_channel::unbounded(); + let (tx_config, rx_config) = crossbeam_channel::unbounded(); + + let mut hotwatch = Hotwatch::new()?; + let config_path_cl = config_path.clone(); + + hotwatch.watch(config_path, move |event| match event.kind { + EventKind::Modify(_) | EventKind::Remove(_) => match KomobarConfig::read(&config_path_cl) { + Ok(updated) => { + tracing::info!("configuration file updated: {}", config_path_cl.display()); + + if let Err(error) = tx_config.send(updated) { + tracing::error!("could not send configuration update to gui: {error}") + } + } + Err(error) => { + tracing::error!("{error}"); + } + }, + _ => {} + })?; + + tracing::info!("watching configuration file for changes"); + + eframe::run_native( + "komorebi-bar", + native_options, + Box::new(|cc| { + unsafe { + let app = NSApplication::sharedApplication(MainThreadMarker::new_unchecked()); + app.setActivationPolicy(NSApplicationActivationPolicy::Accessory); + } + + if let Ok(handle) = cc.window_handle() + && let RawWindowHandle::AppKit(appkit_handle) = handle.as_raw() { + // kCGBackstopMenuLevel = -20 (behind menu bar, at notch level) + const K_CG_BACKSTOP_MENU_LEVEL: isize = -20; + + unsafe { + let ns_view: &NSView = appkit_handle.ns_view.cast().as_ref(); + if let Some(ns_window) = ns_view.window() { + ns_window.setLevel(K_CG_BACKSTOP_MENU_LEVEL); + } + } + } + + let ctx_repainter = cc.egui_ctx.clone(); + std::thread::spawn(move || loop { + std::thread::sleep(Duration::from_secs(1)); + ctx_repainter.request_repaint(); + }); + + let ctx_komorebi = cc.egui_ctx.clone(); + std::thread::spawn(move || { + let subscriber_name = format!("komorebi-bar-{}", random_word::get(random_word::Lang::En)); + + let listener = komorebi_client::subscribe_with_options(&subscriber_name, SubscribeOptions { + filter_state_changes: true, + }) + .expect("could not subscribe to komorebi notifications"); + + tracing::info!("subscribed to komorebi notifications: \"{}\"", subscriber_name); + + for client in listener.incoming() { + match client { + Ok(subscription) => { + let mut buffer = Vec::new(); + let mut reader = BufReader::new(subscription); + + // this is when we know a shutdown has been sent + if matches!(reader.read_to_end(&mut buffer), Ok(0)) { + tracing::info!("disconnected from komorebi"); + + // keep trying to reconnect to komorebi + while komorebi_client::send_message( + &SocketMessage::AddSubscriberSocket(subscriber_name.clone()), + ) + .is_err() + { + std::thread::sleep(Duration::from_secs(1)); + } + + tracing::info!("reconnected to komorebi"); + + if let Err(error) = tx_gui.send(KomorebiEvent::Reconnect) { + tracing::error!("could not send komorebi reconnect event to gui thread: {error}") + } + + ctx_komorebi.request_repaint(); + continue; + } + + match String::from_utf8(buffer) { + Ok(notification_string) => { + match serde_json::from_str::( + ¬ification_string, + ) { + Ok(notification) => { + tracing::debug!("received notification from komorebi"); + + if let Err(error) = tx_gui.send(KomorebiEvent::Notification(notification)) { + tracing::error!("could not send komorebi notification update to gui thread: {error}") + } + + ctx_komorebi.request_repaint(); + } + Err(error) => { + tracing::error!("could not deserialize komorebi notification: {error}"); + } + } + } + Err(error) => { + tracing::error!( + "komorebi notification string was invalid utf8: {error}" + ) + } + } + } + Err(error) => { + tracing::error!("{error}"); + } + } + } + }); + + Ok(Box::new(Komobar::new(cc, rx_gui, rx_config, config))) + }), + ) + .map_err(|error| color_eyre::eyre::Error::msg(error.to_string())) +} diff --git a/komorebi-for-mac/komorebi-bar/src/os.rs b/komorebi-bar/src/macos/os.rs similarity index 57% rename from komorebi-for-mac/komorebi-bar/src/os.rs rename to komorebi-bar/src/macos/os.rs index c3df076a..3275456e 100644 --- a/komorebi-for-mac/komorebi-bar/src/os.rs +++ b/komorebi-bar/src/macos/os.rs @@ -1,6 +1,8 @@ +use crate::macos::widgets::ImageIcon; use egui_phosphor::regular::CALENDAR; use komorebi_bar_core::platform::BarPlatform; use komorebi_bar_core::platform::SystemTool; +use komorebi_client::SocketMessage; use std::io; use std::process::Command; @@ -21,6 +23,12 @@ impl BarPlatform for MacBar { .spawn(), // explorer.exe does not exist on macOS: this is what the update widget does today SystemTool::Url(url) => Command::new("explorer.exe").args([url]).spawn(), + SystemTool::StorageLocation(label) => { + let parts: Vec<&str> = label.split(' ').collect(); + let path = parts[..parts.len() - 1].join(" "); + + Command::new("open").args([path]).spawn() + } } .map(|_| ()) } @@ -32,4 +40,21 @@ impl BarPlatform for MacBar { fn calendar_icon(&self) -> &'static str { CALENDAR } + + fn exec_shell_command(&self, _command: &str) -> color_eyre::Result<()> { + // the macOS bar has no shell session: the mouse commands are not supported here + Err(io::Error::new(io::ErrorKind::Unsupported, "no shell session on macOS").into()) + } + + fn send_komorebi_message(&self, message: &SocketMessage) -> io::Result<()> { + komorebi_client::send_message(message) + } + + fn send_komorebi_batch(&self, messages: Vec) -> io::Result<()> { + komorebi_client::send_batch(messages) + } + + fn command_icon(&self, _command: &str) -> Option { + None + } } diff --git a/komorebi-for-mac/komorebi-bar/src/widgets/komorebi.rs b/komorebi-bar/src/macos/widgets/komorebi.rs similarity index 90% rename from komorebi-for-mac/komorebi-bar/src/widgets/komorebi.rs rename to komorebi-bar/src/macos/widgets/komorebi.rs index 0b9cbaf5..25e6808d 100644 --- a/komorebi-for-mac/komorebi-bar/src/widgets/komorebi.rs +++ b/komorebi-bar/src/macos/widgets/komorebi.rs @@ -1,14 +1,22 @@ use super::ImageIcon; -use crate::MAX_LABEL_WIDTH; -use crate::MONITOR_INDEX; -use crate::config::DisplayFormat; -use crate::config::DisplayFormat::*; -use crate::config::WorkspacesDisplayFormat; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::ui::CustomUi; -use crate::widgets::komorebi_layout::KomorebiLayout; -use crate::widgets::widget::BarWidget; +use crate::macos::MAX_LABEL_WIDTH; +use crate::macos::MONITOR_INDEX; +use crate::macos::config::DisplayFormat; +use crate::macos::config::DisplayFormat::*; +use crate::macos::config::WorkspacesDisplayFormat; +use crate::macos::render::RenderConfig; +use crate::macos::selected_frame::SelectableFrame; +use crate::macos::ui::CustomUi; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiConfigurationSwitcherConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiFocusedContainerConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLayoutConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLockedContainerConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiWorkspaceLayerConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiWorkspacesConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLayout; +use crate::macos::widgets::komorebi_layout::KomorebiLayoutExt; +use crate::macos::widgets::widget::BarWidget; use eframe::egui::Align; use eframe::egui::Color32; use eframe::egui::Context; @@ -40,10 +48,7 @@ use komorebi_client::State; use komorebi_client::Window; use komorebi_client::Workspace; use komorebi_client::WorkspaceLayer; -use serde::Deserialize; -use serde::Serialize; use std::cell::RefCell; -use std::collections::BTreeMap; use std::collections::HashMap; use std::fs::File; use std::io::BufReader; @@ -52,95 +57,6 @@ use std::path::Path; use std::rc::Rc; use std::sync::atomic::Ordering; -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget configuration -pub struct KomorebiConfig { - /// Configure the Workspaces widget - pub workspaces: Option, - /// Configure the Layout widget - pub layout: Option, - /// Configure the Workspace Layer widget - pub workspace_layer: Option, - /// Configure the Focused Container widget - #[serde(alias = "focused_window")] - pub focused_container: Option, - /// Configure the Locked Container widget - pub locked_container: Option, - /// Configure the Configuration Switcher widget - pub configuration_switcher: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget workspaces configuration -pub struct KomorebiWorkspacesConfig { - /// Enable the Komorebi Workspaces widget - pub enable: bool, - /// Hide workspaces without any windows - pub hide_empty_workspaces: bool, - /// Display format of the workspace - pub display: Option, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget layout configuration -pub struct KomorebiLayoutConfig { - /// Enable the Komorebi Layout widget - pub enable: bool, - /// List of layout options - pub options: Option>, - /// Display format of the current layout - pub display: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget workspace layer configuration -pub struct KomorebiWorkspaceLayerConfig { - /// Enable the Komorebi Workspace Layer widget - pub enable: bool, - /// Display format of the current layer - pub display: Option, - /// Show the widget event if the layer is Tiling - pub show_when_tiling: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget focused container configuration -pub struct KomorebiFocusedContainerConfig { - /// Enable the Komorebi Focused Container widget - pub enable: bool, - /// DEPRECATED: use 'display' instead (Show the icon of the currently focused container) - pub show_icon: Option, - /// Display format of the currently focused container - pub display: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget locked container configuration -pub struct KomorebiLockedContainerConfig { - /// Enable the Komorebi Locked Container widget - pub enable: bool, - /// Display format of the current locked state - pub display: Option, - /// Show the widget event if the layer is unlocked - pub show_when_unlocked: Option, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget configuration switcher configuration -pub struct KomorebiConfigurationSwitcherConfig { - /// Enable the Komorebi Configurations widget - pub enable: bool, - /// A map of display friendly name => path to configuration.json - pub configurations: BTreeMap, -} - impl From<&KomorebiConfig> for Komorebi { fn from(cfg: &KomorebiConfig) -> Self { let configuration_switcher = cfg.configuration_switcher.clone().map(|mut cs| { @@ -474,7 +390,7 @@ impl WorkspacesBar { .show(ui, |ui| { let (response, painter) = ui.allocate_painter(self.icon_size, Sense::hover()); let stroke: Stroke = Stroke::new( - 1.0, + 1.0_f32, if ws.is_selected { ctx.style().visuals.selection.stroke.color } else { @@ -530,7 +446,9 @@ impl FocusedContainerBar { if !value.enable { return None; } + // Handle legacy setting - convert show_icon to display format + #[allow(deprecated)] let format = value .display .unwrap_or(if value.show_icon.unwrap_or(false) { @@ -643,7 +561,7 @@ impl WorkspaceLayerBar { if matches!(layer, WorkspaceLayer::Tiling) { let (response, painter) = ui.allocate_painter(size, Sense::hover()); let color = ctx.style().visuals.selection.stroke.color; - let stroke = Stroke::new(1.0, color); + let stroke = Stroke::new(1.0_f32, color); let mut rect = response.rect; let corner = CornerRadius::same((rect.width() * 0.1) as u8); rect = rect.shrink(stroke.width); @@ -666,7 +584,7 @@ impl WorkspaceLayerBar { } else { let (response, painter) = ui.allocate_painter(size, Sense::hover()); let color = ctx.style().visuals.selection.stroke.color; - let stroke = Stroke::new(1.0, color); + let stroke = Stroke::new(1.0_f32, color); let mut rect = response.rect; let corner = CornerRadius::same((rect.width() * 0.1) as u8); rect = rect.shrink(stroke.width); diff --git a/komorebi-bar/src/macos/widgets/mod.rs b/komorebi-bar/src/macos/widgets/mod.rs new file mode 100644 index 00000000..a429e6b8 --- /dev/null +++ b/komorebi-bar/src/macos/widgets/mod.rs @@ -0,0 +1,15 @@ + +pub use komorebi_bar_core::widgets::applications; +pub use komorebi_bar_core::widgets::battery; +pub use komorebi_bar_core::widgets::cpu; +pub use komorebi_bar_core::widgets::date; +pub mod komorebi; +pub use komorebi_bar_core::widgets::komorebi_layout; +pub use komorebi_bar_core::widgets::memory; +pub mod network; +pub use komorebi_bar_core::widgets::storage; +pub use komorebi_bar_core::widgets::time; +pub use komorebi_bar_core::widgets::update; +pub mod widget; + +pub use komorebi_bar_core::widgets::icons::ImageIcon; diff --git a/komorebi-for-mac/komorebi-bar/src/widgets/network.rs b/komorebi-bar/src/macos/widgets/network.rs similarity index 91% rename from komorebi-for-mac/komorebi-bar/src/widgets/network.rs rename to komorebi-bar/src/macos/widgets/network.rs index 806c7968..fb7b4041 100644 --- a/komorebi-for-mac/komorebi-bar/src/widgets/network.rs +++ b/komorebi-bar/src/macos/widgets/network.rs @@ -1,8 +1,10 @@ -use crate::bar::Alignment; -use crate::config::LabelPrefix; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::widgets::widget::BarWidget; +use crate::macos::bar::Alignment; +pub use komorebi_bar_core::widgets::network_config::NetworkConfig; +pub use komorebi_bar_core::widgets::network_config::NetworkSelectConfig; +use crate::macos::config::LabelPrefix; +use crate::macos::render::RenderConfig; +use crate::macos::selected_frame::SelectableFrame; +use crate::macos::widgets::widget::BarWidget; use eframe::egui::Align; use eframe::egui::Color32; use eframe::egui::Context; @@ -12,8 +14,6 @@ use eframe::egui::Ui; use eframe::egui::text::LayoutJob; use num_derive::FromPrimitive; use parking_lot::Mutex; -use serde::Deserialize; -use serde::Serialize; use std::fmt; use std::process::Command; use std::sync::Arc; @@ -24,48 +24,14 @@ use std::time::Duration; use std::time::Instant; use sysinfo::Networks; -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Network widget configuration -pub struct NetworkConfig { - /// Enable the Network widget - pub enable: bool, - /// Show total received and transmitted activity - #[serde(alias = "show_total_data_transmitted")] - pub show_total_activity: bool, - /// Show received and transmitted activity - #[serde(alias = "show_network_activity")] - pub show_activity: bool, - /// Show default interface - pub show_default_interface: Option, - /// Characters to reserve for received and transmitted activity - #[serde(alias = "network_activity_fill_characters")] - pub activity_left_padding: Option, - /// Data refresh interval in seconds - #[cfg_attr(feature = "schemars", schemars(extend("default" = 10)))] - pub data_refresh_interval: Option, - /// Display label prefix - pub label_prefix: Option, - /// Select when the value is over a limit (1MiB is 1048576 bytes (1024*1024)) - pub auto_select: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Network select configuration -pub struct NetworkSelectConfig { - /// Select the total received data when it's over this value - pub total_received_over: Option, - /// Select the total transmitted data when it's over this value - pub total_transmitted_over: Option, - /// Select the received data when it's over this value - pub received_over: Option, - /// Select the transmitted data when it's over this value - pub transmitted_over: Option, -} - impl From for Network { fn from(value: NetworkConfig) -> Self { + if value.default_interface_options.is_some() { + tracing::warn!( + "the network widget option `default_interface_options` is not supported on macOS and is ignored" + ); + } + let default_refresh_interval = 10; let data_refresh_interval = value.data_refresh_interval.unwrap_or(10); diff --git a/komorebi-bar/src/macos/widgets/widget.rs b/komorebi-bar/src/macos/widgets/widget.rs new file mode 100644 index 00000000..e2d56474 --- /dev/null +++ b/komorebi-bar/src/macos/widgets/widget.rs @@ -0,0 +1,49 @@ +use crate::macos::widgets::applications::Applications; +use crate::macos::widgets::battery::Battery; +use crate::macos::widgets::cpu::Cpu; +use crate::macos::widgets::date::Date; +use crate::macos::widgets::komorebi::Komorebi; +use crate::macos::widgets::memory::Memory; +use crate::macos::widgets::network::Network; +use crate::macos::widgets::storage::Storage; +use crate::macos::widgets::time::Time; +use crate::macos::widgets::update::Update; +use eframe::egui::Context; +use eframe::egui::Ui; + +pub use komorebi_bar_core::widgets::widget::BarWidget; +pub use komorebi_bar_core::widgets::widget::WidgetConfig; +use komorebi_bar_core::render::RenderConfig; + +/// Stands in for a widget that macOS cannot run; `WidgetConfig::enabled` is false for those, so +/// this is never built from a configuration that the bar loads. +struct Unsupported; + +impl BarWidget for Unsupported { + fn render(&mut self, _ctx: &Context, _ui: &mut Ui, _config: &mut RenderConfig) {} +} + +/// Turns a widget configuration into the widget that renders it. +pub trait WidgetConfigExt { + fn as_boxed_bar_widget(&self) -> Box; +} + +impl WidgetConfigExt for WidgetConfig { + fn as_boxed_bar_widget(&self) -> Box { + match self { + WidgetConfig::Applications(config) => Box::new(Applications::from(config)), + WidgetConfig::Battery(config) => Box::new(Battery::from(*config)), + WidgetConfig::Cpu(config) => Box::new(Cpu::from(*config)), + WidgetConfig::Date(config) => Box::new(Date::from(config.clone())), + WidgetConfig::Komorebi(config) => Box::new(Komorebi::from(config)), + WidgetConfig::Memory(config) => Box::new(Memory::from(*config)), + WidgetConfig::Network(config) => Box::new(Network::from(*config)), + WidgetConfig::Storage(config) => Box::new(Storage::from(*config)), + WidgetConfig::Time(config) => Box::new(Time::from(config.clone())), + WidgetConfig::Update(config) => Box::new(Update::from(*config)), + WidgetConfig::Keyboard(_) | WidgetConfig::Media(_) | WidgetConfig::Systray(_) => { + Box::new(Unsupported) + } + } + } +} diff --git a/komorebi-bar/src/main.rs b/komorebi-bar/src/main.rs index 89b25c77..0a906cc0 100644 --- a/komorebi-bar/src/main.rs +++ b/komorebi-bar/src/main.rs @@ -1,400 +1,17 @@ -mod bar; -mod config; -mod os; -pub use komorebi_bar_core::platform; -pub use komorebi_bar_core::render; -pub use komorebi_bar_core::selected_frame; -pub use komorebi_bar_core::ui; -mod widgets; +//! `komorebi-bar`, the status bar of komorebi, for Windows and macOS: the module of the target OS is +//! the bar, the code both share is in `komorebi-bar-core`. -use crate::bar::Komobar; -use crate::config::KomobarConfig; -use crate::config::Position; -use crate::config::PositionConfig; -use clap::Parser; -use config::MonitorConfigOrIndex; -use eframe::egui::ViewportBuilder; -use font_loader::system_fonts; -use hotwatch::EventKind; -use hotwatch::Hotwatch; -use komorebi_client::PathExt; -use komorebi_client::SocketMessage; -use komorebi_client::SubscribeOptions; -use komorebi_client::replace_env_in_path; -use std::io::BufReader; -use std::io::Read; -use std::path::PathBuf; -use std::sync::atomic::Ordering; -use std::time::Duration; -use tracing_subscriber::EnvFilter; -use windows::Win32::Foundation::HWND; -use windows::Win32::Foundation::LPARAM; -use windows::Win32::System::Threading::GetCurrentProcessId; -use windows::Win32::System::Threading::GetCurrentThreadId; -use windows::Win32::UI::HiDpi::DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2; -use windows::Win32::UI::HiDpi::SetProcessDpiAwarenessContext; -use windows::Win32::UI::WindowsAndMessaging::EnumThreadWindows; -use windows::Win32::UI::WindowsAndMessaging::GetWindowThreadProcessId; -use windows_core::BOOL; - -pub use komorebi_bar_core::statics::*; - -#[derive(Parser)] -#[clap(author, about, version)] -struct Opts { - /// Print the JSON schema of the configuration file and exit - #[clap(long)] - schema: bool, - /// Print a list of fonts available on this system and exit - #[clap(long)] - fonts: bool, - /// Path to a JSON or YAML configuration file - #[clap(short, long)] - #[clap(value_parser = replace_env_in_path)] - config: Option, - /// Write an example komorebi.bar.json to disk - #[clap(long)] - quickstart: bool, - /// Print a list of aliases that can be renamed to canonical variants - #[clap(long)] - #[clap(hide = true)] - aliases: bool, -} - -extern "system" fn enum_window(hwnd: HWND, lparam: LPARAM) -> BOOL { - unsafe { - let mut process_id = 0; - GetWindowThreadProcessId(hwnd, Some(&mut process_id)); - - if process_id == GetCurrentProcessId() { - *(lparam.0 as *mut HWND) = hwnd; - BOOL::from(false) // Stop enumeration - } else { - BOOL::from(true) // Continue enumeration - } +cfg_select! { + target_os = "windows" => { + mod windows; + use windows as platform; } -} - -fn process_hwnd() -> Option { - unsafe { - let mut hwnd = HWND::default(); - let _ = EnumThreadWindows( - GetCurrentThreadId(), - Some(enum_window), - LPARAM(&mut hwnd as *mut HWND as isize), - ); - - if hwnd.0 as isize == 0 { - None - } else { - Some(hwnd.0 as isize) - } + target_os = "macos" => { + mod macos; + use macos as platform; } } -pub enum KomorebiEvent { - Notification(Box), - Reconnect, -} - fn main() -> color_eyre::Result<()> { - komorebi_bar_core::platform::install(&os::WindowsBar); - - unsafe { SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) }?; - - let opts: Opts = Opts::parse(); - - #[cfg(feature = "schemars")] - if opts.schema { - let bar_config = schemars::schema_for!(KomobarConfig); - let schema = serde_json::to_string_pretty(&bar_config)?; - - println!("{schema}"); - std::process::exit(0); - } - - if opts.fonts { - for font in system_fonts::query_all() { - println!("{font}"); - } - - std::process::exit(0); - } - - if std::env::var("RUST_LIB_BACKTRACE").is_err() { - unsafe { - std::env::set_var("RUST_LIB_BACKTRACE", "1"); - } - } - - color_eyre::install()?; - - if std::env::var("RUST_LOG").is_err() { - unsafe { - std::env::set_var("RUST_LOG", "info"); - } - } - - tracing::subscriber::set_global_default( - tracing_subscriber::fmt::Subscriber::builder() - .with_env_filter(EnvFilter::from_default_env()) - .finish(), - )?; - - let home_dir: PathBuf = std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( - |_| dirs::home_dir().expect("there is no home directory"), - |home_path| { - let home = home_path.replace_env(); - - assert!( - home.is_dir(), - "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory" - ); - - home - }, - ); - - if opts.quickstart { - let komorebi_bar_json = include_str!("../../docs/komorebi.bar.example.json").to_string(); - std::fs::write(home_dir.join("komorebi.bar.json"), komorebi_bar_json)?; - println!( - "Example komorebi.bar.json file written to {}", - home_dir.display() - ); - - std::process::exit(0); - } - - let default_config_path = home_dir.join("komorebi.bar.json"); - - let config_path = opts.config.or_else(|| { - default_config_path - .is_file() - .then_some(default_config_path.clone()) - }); - - let mut config = match config_path { - None => { - let komorebi_bar_json = - include_str!("../../docs/komorebi.bar.example.json").to_string(); - - std::fs::write(&default_config_path, komorebi_bar_json)?; - tracing::info!( - "created example configuration file: {}", - default_config_path.display() - ); - - KomobarConfig::read(&default_config_path)? - } - Some(ref config) => { - if !opts.aliases { - tracing::info!("found configuration file: {}", config.display()); - } - - KomobarConfig::read(config)? - } - }; - - let config_path = config_path.unwrap_or(default_config_path); - - if opts.aliases { - KomobarConfig::aliases(&std::fs::read_to_string(&config_path)?); - std::process::exit(0); - } - - let state = serde_json::from_str::(&komorebi_client::send_query( - &SocketMessage::State, - )?)?; - - let (usr_monitor_index, work_area_offset) = match &config.monitor { - Some(MonitorConfigOrIndex::MonitorConfig(monitor_config)) => { - (monitor_config.index, monitor_config.work_area_offset) - } - Some(MonitorConfigOrIndex::Index(idx)) => (*idx, None), - None => (0, None), - }; - - let monitor_index = state - .monitor_usr_idx_map - .get(&usr_monitor_index) - .map_or(usr_monitor_index, |i| *i); - - MONITOR_RIGHT.store( - state.monitors.elements()[monitor_index].size.right, - Ordering::SeqCst, - ); - - MONITOR_TOP.store( - state.monitors.elements()[monitor_index].size.top, - Ordering::SeqCst, - ); - - MONITOR_LEFT.store( - state.monitors.elements()[monitor_index].size.left, - Ordering::SeqCst, - ); - - MONITOR_INDEX.store(monitor_index, Ordering::SeqCst); - - match config.position { - None => { - config.position = Some(PositionConfig { - start: Some(Position { - x: state.monitors.elements()[monitor_index].size.left as f32, - y: state.monitors.elements()[monitor_index].size.top as f32, - }), - end: Some(Position { - x: state.monitors.elements()[monitor_index].size.right as f32, - y: 50.0, - }), - }) - } - Some(ref mut position) => { - if position.start.is_none() { - position.start = Some(Position { - x: state.monitors.elements()[monitor_index].size.left as f32, - y: state.monitors.elements()[monitor_index].size.top as f32, - }); - } - - if position.end.is_none() { - position.end = Some(Position { - x: state.monitors.elements()[monitor_index].size.right as f32, - y: 50.0, - }) - } - } - } - - let viewport_builder = ViewportBuilder::default() - .with_decorations(false) - .with_transparent(true) - .with_taskbar(false); - - let native_options = eframe::NativeOptions { - viewport: viewport_builder, - ..Default::default() - }; - - if let Some(rect) = &work_area_offset { - komorebi_client::send_message(&SocketMessage::MonitorWorkAreaOffset(monitor_index, *rect))?; - tracing::info!("work area offset applied to monitor: {}", monitor_index); - } - - let (tx_gui, rx_gui) = crossbeam_channel::unbounded(); - let (tx_config, rx_config) = crossbeam_channel::unbounded(); - - let mut hotwatch = Hotwatch::new()?; - let config_path_cl = config_path.clone(); - - hotwatch.watch(config_path, move |event| match event.kind { - EventKind::Modify(_) | EventKind::Remove(_) => match KomobarConfig::read(&config_path_cl) { - Ok(updated) => { - tracing::info!("configuration file updated: {}", config_path_cl.display()); - - if let Err(error) = tx_config.send(updated) { - tracing::error!("could not send configuration update to gui: {error}") - } - } - Err(error) => { - tracing::error!("{error}"); - } - }, - _ => {} - })?; - - tracing::info!("watching configuration file for changes"); - - eframe::run_native( - "komorebi-bar", - native_options, - Box::new(|cc| { - let ctx_repainter = cc.egui_ctx.clone(); - std::thread::spawn(move || loop { - std::thread::sleep(Duration::from_secs(1)); - ctx_repainter.request_repaint(); - }); - - let ctx_komorebi = cc.egui_ctx.clone(); - std::thread::spawn(move || { - let subscriber_name = format!("komorebi-bar-{}", random_word::get(random_word::Lang::En)); - - let listener = komorebi_client::subscribe_with_options(&subscriber_name, SubscribeOptions { - filter_state_changes: true, - }) - .expect("could not subscribe to komorebi notifications"); - - tracing::info!("subscribed to komorebi notifications: \"{}\"", subscriber_name); - - for client in listener.incoming() { - match client { - Ok(subscription) => { - match subscription.set_read_timeout(Some(Duration::from_secs(1))) { - Ok(()) => {} - Err(error) => tracing::error!("{}", error), - } - let mut buffer = Vec::new(); - let mut reader = BufReader::new(subscription); - - // this is when we know a shutdown has been sent - if matches!(reader.read_to_end(&mut buffer), Ok(0)) { - tracing::info!("disconnected from komorebi"); - - // keep trying to reconnect to komorebi - while komorebi_client::send_message( - &SocketMessage::AddSubscriberSocket(subscriber_name.clone()), - ) - .is_err() - { - std::thread::sleep(Duration::from_secs(1)); - } - - tracing::info!("reconnected to komorebi"); - - if let Err(error) = tx_gui.send(KomorebiEvent::Reconnect) { - tracing::error!("could not send komorebi reconnect event to gui thread: {error}") - } - - ctx_komorebi.request_repaint(); - continue; - } - - match String::from_utf8(buffer) { - Ok(notification_string) => { - match serde_json::from_str::( - ¬ification_string, - ) { - Ok(notification) => { - tracing::debug!("received notification from komorebi"); - - if let Err(error) = tx_gui.send(KomorebiEvent::Notification(Box::new(notification))) { - tracing::error!("could not send komorebi notification update to gui thread: {error}") - } - - ctx_komorebi.request_repaint(); - } - Err(error) => { - tracing::error!("could not deserialize komorebi notification: {error}"); - } - } - } - Err(error) => { - tracing::error!( - "komorebi notification string was invalid utf8: {error}" - ) - } - } - } - Err(error) => { - tracing::error!("{error}"); - } - } - } - }); - - Ok(Box::new(Komobar::new(cc, rx_gui, rx_config, config))) - }), - ) - .map_err(|error| color_eyre::eyre::Error::msg(error.to_string())) + platform::main() } diff --git a/komorebi-bar/src/os.rs b/komorebi-bar/src/os.rs deleted file mode 100644 index 2fca94c4..00000000 --- a/komorebi-bar/src/os.rs +++ /dev/null @@ -1,29 +0,0 @@ -use egui_phosphor::regular::CALENDAR_DOTS; -use komorebi_bar_core::platform::BarPlatform; -use komorebi_bar_core::platform::SystemTool; -use std::io; -use std::process::Command; - -pub struct WindowsBar; - -impl BarPlatform for WindowsBar { - fn open_system_tool(&self, tool: SystemTool) -> io::Result<()> { - match tool { - SystemTool::TaskManager => Command::new("cmd.exe").args(["/C", "taskmgr.exe"]).spawn(), - SystemTool::PowerSettings => Command::new("cmd.exe") - .args(["/C", "start", "ms-settings:batterysaver"]) - .spawn(), - SystemTool::NetworkSettings => Command::new("cmd.exe").args(["/C", "ncpa"]).spawn(), - SystemTool::Url(url) => Command::new("explorer.exe").args([url]).spawn(), - } - .map(|_| ()) - } - - fn latest_release_api_url(&self) -> &'static str { - "https://api.github.com/repos/LGUG2Z/komorebi/releases/latest" - } - - fn calendar_icon(&self) -> &'static str { - CALENDAR_DOTS - } -} diff --git a/komorebi-bar/src/widgets/widget.rs b/komorebi-bar/src/widgets/widget.rs deleted file mode 100644 index 0b9fa4c6..00000000 --- a/komorebi-bar/src/widgets/widget.rs +++ /dev/null @@ -1,126 +0,0 @@ -use crate::widgets::applications::Applications; -use crate::widgets::applications::ApplicationsConfig; -use crate::widgets::battery::Battery; -use crate::widgets::battery::BatteryConfig; -use crate::widgets::cpu::Cpu; -use crate::widgets::cpu::CpuConfig; -use crate::widgets::date::Date; -use crate::widgets::date::DateConfig; -use crate::widgets::keyboard::Keyboard; -use crate::widgets::keyboard::KeyboardConfig; -use crate::widgets::komorebi::Komorebi; -use crate::widgets::komorebi::KomorebiConfig; -use crate::widgets::media::Media; -use crate::widgets::media::MediaConfig; -use crate::widgets::memory::Memory; -use crate::widgets::memory::MemoryConfig; -use crate::widgets::network::Network; -use crate::widgets::network::NetworkConfig; -use crate::widgets::storage::Storage; -use crate::widgets::storage::StorageConfig; -#[cfg(target_os = "windows")] -use crate::widgets::systray::Systray; -#[cfg(target_os = "windows")] -use crate::widgets::systray::SystrayConfig; -use crate::widgets::time::Time; -use crate::widgets::time::TimeConfig; -use crate::widgets::update::Update; -use crate::widgets::update::UpdateConfig; -use serde::Deserialize; -use serde::Serialize; - -pub use komorebi_bar_core::widgets::widget::BarWidget; - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Widget configuration -pub enum WidgetConfig { - /// Applications widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Applications"))] - Applications(ApplicationsConfig), - /// Battery widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Battery"))] - Battery(BatteryConfig), - /// CPU widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Cpu"))] - Cpu(CpuConfig), - /// Date widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Date"))] - Date(DateConfig), - /// Keyboard widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Keyboard"))] - Keyboard(KeyboardConfig), - /// Komorebi widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Komorebi"))] - Komorebi(KomorebiConfig), - /// Media widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Media"))] - Media(MediaConfig), - /// Memory widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Memory"))] - Memory(MemoryConfig), - /// Network widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Network"))] - Network(NetworkConfig), - /// Storage widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Storage"))] - Storage(StorageConfig), - /// System Tray widget configuration (Windows only) - #[cfg(target_os = "windows")] - #[cfg_attr(feature = "schemars", schemars(title = "Systray"))] - Systray(SystrayConfig), - /// Time widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Time"))] - Time(TimeConfig), - /// Update widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Update"))] - Update(UpdateConfig), -} - -impl WidgetConfig { - pub fn as_boxed_bar_widget(&self) -> Box { - match self { - WidgetConfig::Applications(config) => Box::new(Applications::from(config)), - WidgetConfig::Battery(config) => Box::new(Battery::from(*config)), - WidgetConfig::Cpu(config) => Box::new(Cpu::from(*config)), - WidgetConfig::Date(config) => Box::new(Date::from(config.clone())), - WidgetConfig::Keyboard(config) => Box::new(Keyboard::from(*config)), - WidgetConfig::Komorebi(config) => Box::new(Komorebi::from(config)), - WidgetConfig::Media(config) => Box::new(Media::from(*config)), - WidgetConfig::Memory(config) => Box::new(Memory::from(*config)), - WidgetConfig::Network(config) => Box::new(Network::from(*config)), - WidgetConfig::Storage(config) => Box::new(Storage::from(*config)), - #[cfg(target_os = "windows")] - WidgetConfig::Systray(config) => Box::new(Systray::from(config)), - WidgetConfig::Time(config) => Box::new(Time::from(config.clone())), - WidgetConfig::Update(config) => Box::new(Update::from(*config)), - } - } - - pub fn enabled(&self) -> bool { - match self { - WidgetConfig::Applications(config) => config.enable, - WidgetConfig::Battery(config) => config.enable, - WidgetConfig::Cpu(config) => config.enable, - WidgetConfig::Date(config) => config.enable, - WidgetConfig::Keyboard(config) => config.enable, - WidgetConfig::Komorebi(config) => { - config.workspaces.as_ref().is_some_and(|w| w.enable) - || config.layout.as_ref().is_some_and(|w| w.enable) - || config.focused_container.as_ref().is_some_and(|w| w.enable) - || config - .configuration_switcher - .as_ref() - .is_some_and(|w| w.enable) - } - WidgetConfig::Media(config) => config.enable, - WidgetConfig::Memory(config) => config.enable, - WidgetConfig::Network(config) => config.enable, - WidgetConfig::Storage(config) => config.enable, - #[cfg(target_os = "windows")] - WidgetConfig::Systray(config) => config.enable, - WidgetConfig::Time(config) => config.enable, - WidgetConfig::Update(config) => config.enable, - } - } -} diff --git a/komorebi-bar/src/bar.rs b/komorebi-bar/src/windows/bar.rs similarity index 97% rename from komorebi-bar/src/bar.rs rename to komorebi-bar/src/windows/bar.rs index f113e3e2..717e058c 100644 --- a/komorebi-bar/src/bar.rs +++ b/komorebi-bar/src/windows/bar.rs @@ -1,28 +1,29 @@ -use crate::AUTO_SELECT_FILL_COLOUR; -use crate::AUTO_SELECT_TEXT_COLOUR; -use crate::BAR_HEIGHT; -use crate::DEFAULT_PADDING; -use crate::KomorebiEvent; -use crate::MAX_LABEL_WIDTH; -use crate::MONITOR_LEFT; -use crate::MONITOR_RIGHT; -use crate::MONITOR_TOP; -use crate::config::KomobarConfig; -use crate::config::KomobarTheme; -use crate::config::MonitorConfigOrIndex; -use crate::config::Position; -use crate::config::PositionConfig; -use crate::config::get_individual_spacing; -use crate::process_hwnd; -use crate::render::Color32Ext; -use crate::render::Grouping; -use crate::render::RenderConfig; -use crate::render::RenderExt; -use crate::take_widget_clicked; -use crate::widgets::komorebi::Komorebi; -use crate::widgets::komorebi::MonitorInfo; -use crate::widgets::widget::BarWidget; -use crate::widgets::widget::WidgetConfig; +use crate::windows::AUTO_SELECT_FILL_COLOUR; +use crate::windows::AUTO_SELECT_TEXT_COLOUR; +use crate::windows::BAR_HEIGHT; +use crate::windows::DEFAULT_PADDING; +use crate::windows::KomorebiEvent; +use crate::windows::MAX_LABEL_WIDTH; +use crate::windows::MONITOR_LEFT; +use crate::windows::MONITOR_RIGHT; +use crate::windows::MONITOR_TOP; +use crate::windows::config::KomobarConfig; +use crate::windows::config::KomobarTheme; +use crate::windows::config::MonitorConfigOrIndex; +use crate::windows::config::Position; +use crate::windows::config::PositionConfig; +use crate::windows::config::get_individual_spacing; +use crate::windows::process_hwnd; +use crate::windows::render::Color32Ext; +use crate::windows::render::Grouping; +use crate::windows::render::RenderConfig; +use crate::windows::render::RenderExt; +use crate::windows::take_widget_clicked; +use crate::windows::widgets::komorebi::Komorebi; +use crate::windows::widgets::komorebi::MonitorInfo; +use crate::windows::widgets::widget::BarWidget; +use crate::windows::widgets::widget::WidgetConfig; +use crate::windows::widgets::widget::WidgetConfigExt; use color_eyre::eyre; use crossbeam_channel::Receiver; use crossbeam_channel::TryRecvError; @@ -1085,7 +1086,7 @@ impl eframe::App for Komobar { CentralPanel::default().frame(frame).show(ctx, |ui| { // Variable to store command to execute after widgets are rendered // This allows widgets to mark clicks as consumed before bar processes them - let mut pending_command: Option = None; + let mut pending_command: Option = None; if let Some(mouse_config) = &self.config.mouse { let command = if ui diff --git a/komorebi-bar/src/windows/config.rs b/komorebi-bar/src/windows/config.rs new file mode 100644 index 00000000..0702a6d7 --- /dev/null +++ b/komorebi-bar/src/windows/config.rs @@ -0,0 +1 @@ +pub use komorebi_bar_core::config::*; diff --git a/komorebi-bar/src/windows/mod.rs b/komorebi-bar/src/windows/mod.rs new file mode 100644 index 00000000..58e6d745 --- /dev/null +++ b/komorebi-bar/src/windows/mod.rs @@ -0,0 +1,401 @@ +mod bar; +mod config; +mod os; +pub use komorebi_bar_core::render; +pub use komorebi_bar_core::selected_frame; +pub use komorebi_bar_core::ui; +mod widgets; + +use crate::windows::bar::Komobar; +use crate::windows::config::KomobarConfig; +use crate::windows::config::Position; +use crate::windows::config::PositionConfig; +use clap::Parser; +use config::MonitorConfigOrIndex; +use eframe::egui::ViewportBuilder; +use font_loader::system_fonts; +use hotwatch::EventKind; +use hotwatch::Hotwatch; +use komorebi_client::PathExt; +use komorebi_client::SocketMessage; +use komorebi_client::SubscribeOptions; +use komorebi_client::replace_env_in_path; +use std::io::BufReader; +use std::io::Read; +use std::path::PathBuf; +use std::sync::atomic::Ordering; +use std::time::Duration; +use tracing_subscriber::EnvFilter; +use windows::Win32::Foundation::HWND; +use windows::Win32::Foundation::LPARAM; +use windows::Win32::System::Threading::GetCurrentProcessId; +use windows::Win32::System::Threading::GetCurrentThreadId; +use windows::Win32::UI::HiDpi::DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2; +use windows::Win32::UI::HiDpi::SetProcessDpiAwarenessContext; +use windows::Win32::UI::WindowsAndMessaging::EnumThreadWindows; +use windows::Win32::UI::WindowsAndMessaging::GetWindowThreadProcessId; +use windows_core::BOOL; + +pub use komorebi_bar_core::statics::*; + +#[derive(Parser)] +#[clap(name = "komorebi-bar", author, about, version)] +struct Opts { + /// Print the JSON schema of the configuration file and exit + #[clap(long)] + schema: bool, + /// Print a list of fonts available on this system and exit + #[clap(long)] + fonts: bool, + /// Path to a JSON or YAML configuration file + #[clap(short, long)] + #[clap(value_parser = replace_env_in_path)] + config: Option, + /// Write an example komorebi.bar.json to disk + #[clap(long)] + quickstart: bool, + /// Print a list of aliases that can be renamed to canonical variants + #[clap(long)] + #[clap(hide = true)] + aliases: bool, +} + +extern "system" fn enum_window(hwnd: HWND, lparam: LPARAM) -> BOOL { + unsafe { + let mut process_id = 0; + GetWindowThreadProcessId(hwnd, Some(&mut process_id)); + + if process_id == GetCurrentProcessId() { + *(lparam.0 as *mut HWND) = hwnd; + BOOL::from(false) // Stop enumeration + } else { + BOOL::from(true) // Continue enumeration + } + } +} + +fn process_hwnd() -> Option { + unsafe { + let mut hwnd = HWND::default(); + let _ = EnumThreadWindows( + GetCurrentThreadId(), + Some(enum_window), + LPARAM(&mut hwnd as *mut HWND as isize), + ); + + if hwnd.0 as isize == 0 { + None + } else { + Some(hwnd.0 as isize) + } + } +} + +pub enum KomorebiEvent { + Notification(Box), + Reconnect, +} + +pub fn main() -> color_eyre::Result<()> { + komorebi_bar_core::platform::install(&os::WindowsBar); + + unsafe { SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) }?; + + let opts: Opts = Opts::parse(); + + #[cfg(feature = "schemars")] + if opts.schema { + print!( + "{}", + komorebi_bar_core::schema::generated_text::( + komorebi_bar_core::schema::SchemaPlatform::Windows + ) + ); + std::process::exit(0); + } + + if opts.fonts { + for font in system_fonts::query_all() { + println!("{font}"); + } + + std::process::exit(0); + } + + if std::env::var("RUST_LIB_BACKTRACE").is_err() { + unsafe { + std::env::set_var("RUST_LIB_BACKTRACE", "1"); + } + } + + color_eyre::install()?; + + if std::env::var("RUST_LOG").is_err() { + unsafe { + std::env::set_var("RUST_LOG", "info"); + } + } + + tracing::subscriber::set_global_default( + tracing_subscriber::fmt::Subscriber::builder() + .with_env_filter(EnvFilter::from_default_env()) + .finish(), + )?; + + let home_dir: PathBuf = std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( + |_| dirs::home_dir().expect("there is no home directory"), + |home_path| { + let home = home_path.replace_env(); + + assert!( + home.is_dir(), + "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory" + ); + + home + }, + ); + + if opts.quickstart { + let komorebi_bar_json = include_str!("../../../docs/komorebi.bar.example.json").to_string(); + std::fs::write(home_dir.join("komorebi.bar.json"), komorebi_bar_json)?; + println!( + "Example komorebi.bar.json file written to {}", + home_dir.display() + ); + + std::process::exit(0); + } + + let default_config_path = home_dir.join("komorebi.bar.json"); + + let config_path = opts.config.or_else(|| { + default_config_path + .is_file() + .then_some(default_config_path.clone()) + }); + + let mut config = match config_path { + None => { + let komorebi_bar_json = + include_str!("../../../docs/komorebi.bar.example.json").to_string(); + + std::fs::write(&default_config_path, komorebi_bar_json)?; + tracing::info!( + "created example configuration file: {}", + default_config_path.display() + ); + + KomobarConfig::read(&default_config_path)? + } + Some(ref config) => { + if !opts.aliases { + tracing::info!("found configuration file: {}", config.display()); + } + + KomobarConfig::read(config)? + } + }; + + let config_path = config_path.unwrap_or(default_config_path); + + if opts.aliases { + KomobarConfig::aliases(&std::fs::read_to_string(&config_path)?); + std::process::exit(0); + } + + let state = serde_json::from_str::(&komorebi_client::send_query( + &SocketMessage::State, + )?)?; + + let (usr_monitor_index, work_area_offset) = match &config.monitor { + Some(MonitorConfigOrIndex::MonitorConfig(monitor_config)) => { + (monitor_config.index, monitor_config.work_area_offset) + } + Some(MonitorConfigOrIndex::Index(idx)) => (*idx, None), + None => (0, None), + }; + + let monitor_index = state + .monitor_usr_idx_map + .get(&usr_monitor_index) + .map_or(usr_monitor_index, |i| *i); + + MONITOR_RIGHT.store( + state.monitors.elements()[monitor_index].size.right, + Ordering::SeqCst, + ); + + MONITOR_TOP.store( + state.monitors.elements()[monitor_index].size.top, + Ordering::SeqCst, + ); + + MONITOR_LEFT.store( + state.monitors.elements()[monitor_index].size.left, + Ordering::SeqCst, + ); + + MONITOR_INDEX.store(monitor_index, Ordering::SeqCst); + + match config.position { + None => { + config.position = Some(PositionConfig { + start: Some(Position { + x: state.monitors.elements()[monitor_index].size.left as f32, + y: state.monitors.elements()[monitor_index].size.top as f32, + }), + end: Some(Position { + x: state.monitors.elements()[monitor_index].size.right as f32, + y: 50.0, + }), + }) + } + Some(ref mut position) => { + if position.start.is_none() { + position.start = Some(Position { + x: state.monitors.elements()[monitor_index].size.left as f32, + y: state.monitors.elements()[monitor_index].size.top as f32, + }); + } + + if position.end.is_none() { + position.end = Some(Position { + x: state.monitors.elements()[monitor_index].size.right as f32, + y: 50.0, + }) + } + } + } + + let viewport_builder = ViewportBuilder::default() + .with_decorations(false) + .with_transparent(true) + .with_taskbar(false); + + let native_options = eframe::NativeOptions { + viewport: viewport_builder, + ..Default::default() + }; + + if let Some(rect) = &work_area_offset { + komorebi_client::send_message(&SocketMessage::MonitorWorkAreaOffset(monitor_index, *rect))?; + tracing::info!("work area offset applied to monitor: {}", monitor_index); + } + + let (tx_gui, rx_gui) = crossbeam_channel::unbounded(); + let (tx_config, rx_config) = crossbeam_channel::unbounded(); + + let mut hotwatch = Hotwatch::new()?; + let config_path_cl = config_path.clone(); + + hotwatch.watch(config_path, move |event| match event.kind { + EventKind::Modify(_) | EventKind::Remove(_) => match KomobarConfig::read(&config_path_cl) { + Ok(updated) => { + tracing::info!("configuration file updated: {}", config_path_cl.display()); + + if let Err(error) = tx_config.send(updated) { + tracing::error!("could not send configuration update to gui: {error}") + } + } + Err(error) => { + tracing::error!("{error}"); + } + }, + _ => {} + })?; + + tracing::info!("watching configuration file for changes"); + + eframe::run_native( + "komorebi-bar", + native_options, + Box::new(|cc| { + let ctx_repainter = cc.egui_ctx.clone(); + std::thread::spawn(move || loop { + std::thread::sleep(Duration::from_secs(1)); + ctx_repainter.request_repaint(); + }); + + let ctx_komorebi = cc.egui_ctx.clone(); + std::thread::spawn(move || { + let subscriber_name = format!("komorebi-bar-{}", random_word::get(random_word::Lang::En)); + + let listener = komorebi_client::subscribe_with_options(&subscriber_name, SubscribeOptions { + filter_state_changes: true, + }) + .expect("could not subscribe to komorebi notifications"); + + tracing::info!("subscribed to komorebi notifications: \"{}\"", subscriber_name); + + for client in listener.incoming() { + match client { + Ok(subscription) => { + match subscription.set_read_timeout(Some(Duration::from_secs(1))) { + Ok(()) => {} + Err(error) => tracing::error!("{}", error), + } + let mut buffer = Vec::new(); + let mut reader = BufReader::new(subscription); + + // this is when we know a shutdown has been sent + if matches!(reader.read_to_end(&mut buffer), Ok(0)) { + tracing::info!("disconnected from komorebi"); + + // keep trying to reconnect to komorebi + while komorebi_client::send_message( + &SocketMessage::AddSubscriberSocket(subscriber_name.clone()), + ) + .is_err() + { + std::thread::sleep(Duration::from_secs(1)); + } + + tracing::info!("reconnected to komorebi"); + + if let Err(error) = tx_gui.send(KomorebiEvent::Reconnect) { + tracing::error!("could not send komorebi reconnect event to gui thread: {error}") + } + + ctx_komorebi.request_repaint(); + continue; + } + + match String::from_utf8(buffer) { + Ok(notification_string) => { + match serde_json::from_str::( + ¬ification_string, + ) { + Ok(notification) => { + tracing::debug!("received notification from komorebi"); + + if let Err(error) = tx_gui.send(KomorebiEvent::Notification(Box::new(notification))) { + tracing::error!("could not send komorebi notification update to gui thread: {error}") + } + + ctx_komorebi.request_repaint(); + } + Err(error) => { + tracing::error!("could not deserialize komorebi notification: {error}"); + } + } + } + Err(error) => { + tracing::error!( + "komorebi notification string was invalid utf8: {error}" + ) + } + } + } + Err(error) => { + tracing::error!("{error}"); + } + } + } + }); + + Ok(Box::new(Komobar::new(cc, rx_gui, rx_config, config))) + }), + ) + .map_err(|error| color_eyre::eyre::Error::msg(error.to_string())) +} diff --git a/komorebi-bar/src/windows/os.rs b/komorebi-bar/src/windows/os.rs new file mode 100644 index 00000000..5ba8990c --- /dev/null +++ b/komorebi-bar/src/windows/os.rs @@ -0,0 +1,83 @@ +use crate::windows::widgets::ImageIcon; +use egui_phosphor::regular::CALENDAR_DOTS; +use komorebi_bar_core::platform::BarPlatform; +use komorebi_bar_core::platform::SystemTool; +use std::borrow::Cow; +use komorebi_client::SocketMessage; +use std::io; +use std::path::Path; +use std::process::Command; +use which::which; + +pub struct WindowsBar; + +impl BarPlatform for WindowsBar { + fn open_system_tool(&self, tool: SystemTool) -> io::Result<()> { + match tool { + SystemTool::TaskManager => Command::new("cmd.exe").args(["/C", "taskmgr.exe"]).spawn(), + SystemTool::PowerSettings => Command::new("cmd.exe") + .args(["/C", "start", "ms-settings:batterysaver"]) + .spawn(), + SystemTool::NetworkSettings => Command::new("cmd.exe").args(["/C", "ncpa"]).spawn(), + SystemTool::Url(url) => Command::new("explorer.exe").args([url]).spawn(), + SystemTool::StorageLocation(label) => Command::new("cmd.exe") + .args([ + "/C", + "explorer.exe", + label.split(' ').collect::>()[0], + ]) + .spawn(), + } + .map(|_| ()) + } + + fn latest_release_api_url(&self) -> &'static str { + "https://api.github.com/repos/LGUG2Z/komorebi/releases/latest" + } + + fn calendar_icon(&self) -> &'static str { + CALENDAR_DOTS + } + + fn exec_shell_command(&self, command: &str) -> color_eyre::Result<()> { + crate::windows::bar::exec_powershell(command) + } + + fn send_komorebi_message(&self, message: &SocketMessage) -> io::Result<()> { + komorebi_client::send_message(message) + } + + fn send_komorebi_batch(&self, messages: Vec) -> io::Result<()> { + komorebi_client::send_batch(messages) + } + + fn command_icon(&self, command: &str) -> Option { + let path = executable_of(command)?; + ImageIcon::try_load(path.as_ref(), || { + let path_str = path.to_str()?; + windows_icons::get_icon_by_path(path_str) + .or_else(|| windows_icons_fallback::get_icon_by_path(path_str)) + }) + } +} + +/// Attempts to resolve the executable path from the command string. +/// +/// Resolution logic: +/// - Splits the command by ".exe" and checks if the first part is an existing file. +/// - If not, attempts to locate the binary using [`which`] on this name. +/// - If still unresolved, takes the first word (separated by whitespace) and attempts +/// to find it in the system `PATH` using [`which`]. +/// +/// Returns `None` if no executable path can be determined. +fn executable_of(command: &str) -> Option> { + if let Some(binary) = command.split(".exe").next().map(Path::new) { + if binary.is_file() { + return Some(Cow::Borrowed(binary)); + } else if let Ok(binary) = which(binary) { + return Some(Cow::Owned(binary)); + } + } + + which(command.split(' ').next()?).ok().map(Cow::Owned) +} diff --git a/komorebi-bar/src/widgets/keyboard.rs b/komorebi-bar/src/windows/widgets/keyboard.rs similarity index 90% rename from komorebi-bar/src/widgets/keyboard.rs rename to komorebi-bar/src/windows/widgets/keyboard.rs index 5fe6d0a7..1a03c4e9 100644 --- a/komorebi-bar/src/widgets/keyboard.rs +++ b/komorebi-bar/src/windows/widgets/keyboard.rs @@ -1,6 +1,7 @@ -use crate::config::LabelPrefix; -use crate::render::RenderConfig; -use crate::widgets::widget::BarWidget; +use crate::windows::config::LabelPrefix; +pub use komorebi_bar_core::widgets::platform_config::KeyboardConfig; +use crate::windows::render::RenderConfig; +use crate::windows::widgets::widget::BarWidget; use color_eyre::eyre; use eframe::egui::Align; use eframe::egui::Context; @@ -9,8 +10,6 @@ use eframe::egui::TextFormat; use eframe::egui::Ui; use eframe::egui::WidgetText; use eframe::egui::text::LayoutJob; -use serde::Deserialize; -use serde::Serialize; use std::sync::Arc; use std::time::Duration; use std::time::Instant; @@ -23,19 +22,6 @@ use windows::Win32::UI::WindowsAndMessaging::GetWindowThreadProcessId; const ERROR_TEXT: &str = "Error"; -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Keyboard widget configuration -pub struct KeyboardConfig { - /// Enable the Input widget - pub enable: bool, - /// Data refresh interval - #[cfg_attr(feature = "schemars", schemars(extend("default" = 10)))] - pub data_refresh_interval: Option, - /// Display label prefix - pub label_prefix: Option, -} - impl From for Keyboard { fn from(value: KeyboardConfig) -> Self { let data_refresh_interval = value.data_refresh_interval.unwrap_or(10); diff --git a/komorebi-bar/src/widgets/komorebi.rs b/komorebi-bar/src/windows/widgets/komorebi.rs similarity index 90% rename from komorebi-bar/src/widgets/komorebi.rs rename to komorebi-bar/src/windows/widgets/komorebi.rs index 2f19b9c7..497eac61 100644 --- a/komorebi-bar/src/widgets/komorebi.rs +++ b/komorebi-bar/src/windows/widgets/komorebi.rs @@ -1,14 +1,14 @@ use super::ImageIcon; -use crate::MAX_LABEL_WIDTH; -use crate::MONITOR_INDEX; -use crate::config::DisplayFormat; -use crate::config::DisplayFormat::*; -use crate::config::WorkspacesDisplayFormat; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::ui::CustomUi; -use crate::widgets::komorebi_layout::KomorebiLayout; -use crate::widgets::widget::BarWidget; +use crate::windows::MAX_LABEL_WIDTH; +use crate::windows::MONITOR_INDEX; +use crate::windows::config::DisplayFormat; +use crate::windows::config::DisplayFormat::*; +use crate::windows::config::WorkspacesDisplayFormat; +use crate::windows::render::RenderConfig; +use crate::windows::selected_frame::SelectableFrame; +use crate::windows::ui::CustomUi; +use crate::windows::widgets::komorebi_layout::KomorebiLayoutExt; +use crate::windows::widgets::widget::BarWidget; use eframe::egui::Align; use eframe::egui::Color32; use eframe::egui::Context; @@ -28,6 +28,14 @@ use eframe::egui::Ui; use eframe::egui::Vec2; use eframe::egui::text::LayoutJob; use eframe::egui::vec2; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiConfigurationSwitcherConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiFocusedContainerConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLayout; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLayoutConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiLockedContainerConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiWorkspaceLayerConfig; +pub use komorebi_bar_core::widgets::komorebi_config::KomorebiWorkspacesConfig; use komorebi_client::Container; use komorebi_client::PathExt; use komorebi_client::Rect; @@ -37,106 +45,13 @@ use komorebi_client::State; use komorebi_client::Window; use komorebi_client::Workspace; use komorebi_client::WorkspaceLayer; -use serde::Deserialize; -use serde::Serialize; use std::cell::RefCell; -use std::collections::BTreeMap; use std::collections::HashMap; use std::io::Result as IoResult; use std::path::Path; use std::rc::Rc; use std::sync::atomic::Ordering; -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget configuration -pub struct KomorebiConfig { - /// Configure the Workspaces widget - pub workspaces: Option, - /// Configure the Layout widget - pub layout: Option, - /// Configure the Workspace Layer widget - pub workspace_layer: Option, - /// Configure the Focused Container widget - #[serde(alias = "focused_window")] - pub focused_container: Option, - /// Configure the Locked Container widget - pub locked_container: Option, - /// Configure the Configuration Switcher widget - pub configuration_switcher: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget workspaces configuration -pub struct KomorebiWorkspacesConfig { - /// Enable the Komorebi Workspaces widget - pub enable: bool, - /// Hide workspaces without any windows - pub hide_empty_workspaces: bool, - /// Display format of the workspace - pub display: Option, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget layout configuration -pub struct KomorebiLayoutConfig { - /// Enable the Komorebi Layout widget - pub enable: bool, - /// List of layout options - pub options: Option>, - /// Display format of the current layout - pub display: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget workspace layer configuration -pub struct KomorebiWorkspaceLayerConfig { - /// Enable the Komorebi Workspace Layer widget - pub enable: bool, - /// Display format of the current layer - pub display: Option, - /// Show the widget event if the layer is Tiling - pub show_when_tiling: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget focused container configuration -pub struct KomorebiFocusedContainerConfig { - /// Enable the Komorebi Focused Container widget - pub enable: bool, - /// DEPRECATED: use `display` instead (Show the icon of the currently focused container) - #[deprecated(note = "Use `display` instead")] - pub show_icon: Option, - /// Display format of the currently focused container - pub display: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget locked container configuration -pub struct KomorebiLockedContainerConfig { - /// Enable the Komorebi Locked Container widget - pub enable: bool, - /// Display format of the current locked state - pub display: Option, - /// Show the widget event if the layer is unlocked - pub show_when_unlocked: Option, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi widget configuration switcher configuration -pub struct KomorebiConfigurationSwitcherConfig { - /// Enable the Komorebi Configurations widget - pub enable: bool, - /// A map of display friendly name => path to configuration.json - pub configurations: BTreeMap, -} - impl From<&KomorebiConfig> for Komorebi { fn from(cfg: &KomorebiConfig) -> Self { let configuration_switcher = cfg.configuration_switcher.clone().map(|mut cs| { diff --git a/komorebi-bar/src/widgets/media.rs b/komorebi-bar/src/windows/widgets/media.rs similarity index 94% rename from komorebi-bar/src/widgets/media.rs rename to komorebi-bar/src/windows/widgets/media.rs index e0155fe0..5d1be1b6 100644 --- a/komorebi-bar/src/widgets/media.rs +++ b/komorebi-bar/src/windows/widgets/media.rs @@ -1,10 +1,11 @@ -use crate::MAX_LABEL_WIDTH; -use crate::bar::Alignment; -use crate::config::MediaDisplayFormat; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::ui::CustomUi; -use crate::widgets::widget::BarWidget; +use crate::windows::MAX_LABEL_WIDTH; +use crate::windows::bar::Alignment; +use crate::windows::config::MediaDisplayFormat; +pub use komorebi_bar_core::widgets::platform_config::MediaConfig; +use crate::windows::render::RenderConfig; +use crate::windows::selected_frame::SelectableFrame; +use crate::windows::ui::CustomUi; +use crate::windows::widgets::widget::BarWidget; use eframe::egui::Align; use eframe::egui::Context; use eframe::egui::Label; @@ -12,22 +13,10 @@ use eframe::egui::TextFormat; use eframe::egui::Ui; use eframe::egui::Vec2; use eframe::egui::text::LayoutJob; -use serde::Deserialize; -use serde::Serialize; use std::sync::atomic::Ordering; use windows::Media::Control::GlobalSystemMediaTransportControlsSessionManager; use windows::Media::Control::GlobalSystemMediaTransportControlsSessionPlaybackStatus; -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Media widget configuration -pub struct MediaConfig { - /// Enable the Media widget - pub enable: bool, - /// Display format of the media widget (defaults to IconAndText) - pub display: Option, -} - impl From for Media { fn from(value: MediaConfig) -> Self { Self::new( diff --git a/komorebi-bar/src/windows/widgets/mod.rs b/komorebi-bar/src/windows/widgets/mod.rs new file mode 100644 index 00000000..a8306d3d --- /dev/null +++ b/komorebi-bar/src/windows/widgets/mod.rs @@ -0,0 +1,22 @@ + +pub use komorebi_bar_core::widgets::applications; +pub use komorebi_bar_core::widgets::battery; +pub use komorebi_bar_core::widgets::cpu; +pub use komorebi_bar_core::widgets::date; +pub mod keyboard; +pub mod komorebi; +pub use komorebi_bar_core::widgets::komorebi_layout; +pub mod media; +pub use komorebi_bar_core::widgets::memory; +pub mod network; +pub use komorebi_bar_core::widgets::storage; +#[cfg(target_os = "windows")] +pub mod systray; +pub use komorebi_bar_core::widgets::time; +pub use komorebi_bar_core::widgets::update; +pub mod widget; + +pub use komorebi_bar_core::widgets::icons::ICONS_CACHE; +pub use komorebi_bar_core::widgets::icons::ImageIcon; +pub use komorebi_bar_core::widgets::icons::ImageIconId; +pub use komorebi_bar_core::widgets::icons::rgba_to_color_image; diff --git a/komorebi-bar/src/widgets/network.rs b/komorebi-bar/src/windows/widgets/network.rs similarity index 89% rename from komorebi-bar/src/widgets/network.rs rename to komorebi-bar/src/windows/widgets/network.rs index 740702ca..eb6e588d 100644 --- a/komorebi-bar/src/widgets/network.rs +++ b/komorebi-bar/src/windows/widgets/network.rs @@ -1,8 +1,12 @@ -use crate::bar::Alignment; -use crate::config::LabelPrefix; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::widgets::widget::BarWidget; +use crate::windows::bar::Alignment; +pub use komorebi_bar_core::widgets::network_config::DefaultInterfaceConfig; +pub use komorebi_bar_core::widgets::network_config::InterfaceDisplayType; +pub use komorebi_bar_core::widgets::network_config::NetworkConfig; +pub use komorebi_bar_core::widgets::network_config::NetworkSelectConfig; +use crate::windows::config::LabelPrefix; +use crate::windows::render::RenderConfig; +use crate::windows::selected_frame::SelectableFrame; +use crate::windows::widgets::widget::BarWidget; use eframe::egui::Align; use eframe::egui::Color32; use eframe::egui::Context; @@ -11,8 +15,6 @@ use eframe::egui::TextFormat; use eframe::egui::Ui; use eframe::egui::text::LayoutJob; use num_derive::FromPrimitive; -use serde::Deserialize; -use serde::Serialize; use std::fmt; use std::process::Command; use std::sync::Arc; @@ -24,66 +26,6 @@ use std::time::Duration; use std::time::Instant; use sysinfo::Networks; -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Network widget configuration -pub struct NetworkConfig { - /// Enable the Network widget - pub enable: bool, - /// Show total received and transmitted activity - #[serde(alias = "show_total_data_transmitted")] - pub show_total_activity: bool, - /// Show received and transmitted activity - #[serde(alias = "show_network_activity")] - pub show_activity: bool, - /// Show default interface - pub show_default_interface: Option, - /// Default interface options: whether to show the friendly name, IPv4 or IPv6 address - pub default_interface_options: Option, - /// Characters to reserve for received and transmitted activity - #[serde(alias = "network_activity_fill_characters")] - pub activity_left_padding: Option, - /// Data refresh interval in seconds - #[cfg_attr(feature = "schemars", schemars(extend("default" = 10)))] - pub data_refresh_interval: Option, - /// Display label prefix - pub label_prefix: Option, - /// Select when the value is over a limit (1MiB is 1048576 bytes (1024*1024)) - pub auto_select: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Network select configuration -pub struct NetworkSelectConfig { - /// Select the total received data when it's over this value - pub total_received_over: Option, - /// Select the total transmitted data when it's over this value - pub total_transmitted_over: Option, - /// Select the received data when it's over this value - pub received_over: Option, - /// Select the transmitted data when it's over this value - pub transmitted_over: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize, Default)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Which IP address to show for the default interface -pub enum InterfaceDisplayType { - #[default] - FriendlyName, - Ipv4, - Ipv6, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Default interface configuration -pub struct DefaultInterfaceConfig { - #[serde(default)] - pub display_type: InterfaceDisplayType, -} - impl From for Network { fn from(value: NetworkConfig) -> Self { let default_refresh_interval = 10; diff --git a/komorebi-bar/src/widgets/systray.rs b/komorebi-bar/src/windows/widgets/systray.rs similarity index 91% rename from komorebi-bar/src/widgets/systray.rs rename to komorebi-bar/src/windows/widgets/systray.rs index 5d6f6367..d96073af 100644 --- a/komorebi-bar/src/widgets/systray.rs +++ b/komorebi-bar/src/windows/widgets/systray.rs @@ -2,11 +2,11 @@ use super::ICONS_CACHE; use super::ImageIcon; use super::ImageIconId; use super::rgba_to_color_image; -use crate::bar::Alignment; -use crate::mark_widget_clicked; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::widgets::widget::BarWidget; +use crate::windows::bar::Alignment; +use crate::windows::mark_widget_clicked; +use crate::windows::render::RenderConfig; +use crate::windows::selected_frame::SelectableFrame; +use crate::windows::widgets::widget::BarWidget; use crossbeam_channel::Receiver; use crossbeam_channel::Sender; use crossbeam_channel::unbounded; @@ -26,10 +26,13 @@ use eframe::egui::ViewportId; use eframe::egui::Window as EguiWindow; use egui_extras::Column; use egui_extras::TableBuilder; +pub use komorebi_bar_core::widgets::platform_config::ButtonPosition; +pub use komorebi_bar_core::widgets::platform_config::FieldMatch; +pub use komorebi_bar_core::widgets::platform_config::HiddenIconRule; +pub use komorebi_bar_core::widgets::platform_config::OverflowTogglePosition; +pub use komorebi_bar_core::widgets::platform_config::SystrayConfig; use komorebi_client::MatchingStrategy; use parking_lot::Mutex; -use serde::Deserialize; -use serde::Serialize; use std::collections::HashMap; use std::sync::Arc; use std::sync::LazyLock; @@ -61,105 +64,6 @@ static SHOW_HIDDEN_ICONS: AtomicBool = AtomicBool::new(false); /// Whether the systray info panel is currently shown static SHOW_SYSTRAY_INFO: AtomicBool = AtomicBool::new(false); -#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Position of the overflow toggle button -pub enum OverflowTogglePosition { - /// Toggle button appears on the left side (before visible icons) - Left, - /// Toggle button appears on the right side (after visible icons) - #[default] - Right, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Where to place a systray button (refresh, info, shortcuts, etc.) -pub enum ButtonPosition { - /// Show in the main visible area - Visible, - /// Show in the overflow/hidden section - Overflow, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(untagged)] -/// A field value with an optional matching strategy. -/// -/// A plain string uses exact (case-insensitive) matching. -/// An object with `value` and `matching_strategy` uses the specified strategy. -pub enum FieldMatch { - /// Exact case-insensitive match - Exact(String), - /// Match using a specific strategy - WithStrategy { - /// The value to match against - value: String, - /// How to match (Equals, StartsWith, EndsWith, Contains, Regex, etc.) - matching_strategy: MatchingStrategy, - }, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(untagged)] -/// Rule for matching a systray icon to hide -/// -/// A plain string matches the exe name (backward compatible). -/// An object with optional `exe`, `tooltip`, and/or `guid` fields -/// uses AND logic: all specified fields must match. -/// Each field can be a plain string (exact match) or an object with -/// `value` and `matching_strategy` for advanced matching. -pub enum HiddenIconRule { - /// Match by exe name (case-insensitive, exact) - Exe(String), - /// Match by one or more properties (all specified fields must match) - Match { - /// Exe name to match - exe: Option, - /// Tooltip text to match - tooltip: Option, - /// Icon GUID to match (most stable identifier across restarts) - guid: Option, - }, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// System tray widget configuration -pub struct SystrayConfig { - /// Enable the System Tray widget - pub enable: bool, - /// A list of rules for icons to hide from the system tray - /// - /// Each entry can be a plain string (matches exe name, case-insensitive) - /// or an object with optional `exe`, `tooltip`, and/or `guid` fields - /// (all specified fields must match, AND logic, case-insensitive). - /// - /// Run komorebi-bar with RUST_LOG=info to see the properties of all - /// systray icons in the log output. - pub hidden_icons: Option>, - /// Position of the overflow toggle button (default: Right) - pub overflow_toggle_position: Option, - /// Show an info button that opens a floating panel listing all systray icons - /// with their exe, tooltip, and GUID. Set to "Visible" to show it in the main - /// area, or "Overflow" to show it in the hidden/overflow section. - pub info_button: Option, - /// Interval in seconds to automatically check for and remove stale icons - /// whose owning process has exited. Clamped between 30 and 600 seconds. - /// Defaults to 60. Set to 0 to disable. - pub stale_icons_check_interval: Option, - /// Show a refresh button that manually triggers stale icon cleanup. - /// Set to "Visible" to show it in the main area, or "Overflow" to - /// show it in the hidden/overflow section. - pub refresh_button: Option, - /// Show a button that toggles komorebi-shortcuts (kills the process if - /// running, starts it otherwise). Set to "Visible" to show it in the main - /// area, or "Overflow" to show it in the hidden/overflow section. - pub shortcuts_button: Option, -} - /// Command sent from UI to background thread #[derive(Debug)] enum SystrayCommand { diff --git a/komorebi-bar/src/windows/widgets/widget.rs b/komorebi-bar/src/windows/widgets/widget.rs new file mode 100644 index 00000000..603ad931 --- /dev/null +++ b/komorebi-bar/src/windows/widgets/widget.rs @@ -0,0 +1,41 @@ +use crate::windows::widgets::applications::Applications; +use crate::windows::widgets::battery::Battery; +use crate::windows::widgets::cpu::Cpu; +use crate::windows::widgets::date::Date; +use crate::windows::widgets::keyboard::Keyboard; +use crate::windows::widgets::komorebi::Komorebi; +use crate::windows::widgets::media::Media; +use crate::windows::widgets::memory::Memory; +use crate::windows::widgets::network::Network; +use crate::windows::widgets::storage::Storage; +use crate::windows::widgets::systray::Systray; +use crate::windows::widgets::time::Time; +use crate::windows::widgets::update::Update; + +pub use komorebi_bar_core::widgets::widget::BarWidget; +pub use komorebi_bar_core::widgets::widget::WidgetConfig; + +/// Turns a widget configuration into the widget that renders it. +pub trait WidgetConfigExt { + fn as_boxed_bar_widget(&self) -> Box; +} + +impl WidgetConfigExt for WidgetConfig { + fn as_boxed_bar_widget(&self) -> Box { + match self { + WidgetConfig::Applications(config) => Box::new(Applications::from(config)), + WidgetConfig::Battery(config) => Box::new(Battery::from(*config)), + WidgetConfig::Cpu(config) => Box::new(Cpu::from(*config)), + WidgetConfig::Date(config) => Box::new(Date::from(config.clone())), + WidgetConfig::Keyboard(config) => Box::new(Keyboard::from(*config)), + WidgetConfig::Komorebi(config) => Box::new(Komorebi::from(config)), + WidgetConfig::Media(config) => Box::new(Media::from(*config)), + WidgetConfig::Memory(config) => Box::new(Memory::from(*config)), + WidgetConfig::Network(config) => Box::new(Network::from(*config)), + WidgetConfig::Storage(config) => Box::new(Storage::from(*config)), + WidgetConfig::Systray(config) => Box::new(Systray::from(config)), + WidgetConfig::Time(config) => Box::new(Time::from(config.clone())), + WidgetConfig::Update(config) => Box::new(Update::from(*config)), + } + } +} diff --git a/komorebi-client/Cargo.toml b/komorebi-client/Cargo.toml index 81ac42a8..5b5e1a3b 100644 --- a/komorebi-client/Cargo.toml +++ b/komorebi-client/Cargo.toml @@ -5,12 +5,27 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[dependencies] -komorebi = { path = "../komorebi", default-features = false } +# One dependency key has one path, so the daemon of each platform has a key of its own, and the module of +# the platform names it (`use crate::komorebi_linux as komorebi`). -uds_windows = { workspace = true } +[dependencies] serde_json = { workspace = true } +[target.'cfg(windows)'.dependencies] +komorebi = { package = "komorebi-windows", path = "../komorebi", default-features = false } +uds_windows = { workspace = true } + +[target.'cfg(target_os = "linux")'.dependencies] +komorebi-linux = { package = "komorebi-linux", path = "../komorebi-for-kde/komorebi", default-features = false } +komorebi-themes = { path = "../komorebi-themes" } + +[target.'cfg(target_os = "macos")'.dependencies] +komorebi-macos = { package = "komorebi-macos", path = "../komorebi-for-mac/komorebi", default-features = false } +komorebi-themes = { path = "../komorebi-themes" } + +[target.'cfg(target_os = "linux")'.dev-dependencies] +parking_lot = "0.13" + [features] default = ["schemars"] -schemars = ["komorebi/default"] +schemars = ["komorebi/default", "komorebi-linux/default", "komorebi-macos/default"] diff --git a/komorebi-client/src/lib.rs b/komorebi-client/src/lib.rs index a2eb0a28..8173b659 100644 --- a/komorebi-client/src/lib.rs +++ b/komorebi-client/src/lib.rs @@ -1,211 +1,24 @@ #![warn(clippy::all)] #![allow(clippy::missing_errors_doc)] -pub use komorebi::AnimationsConfig; -pub use komorebi::AppSpecificConfigurationPath; -pub use komorebi::AspectRatio; -pub use komorebi::BorderColours; -pub use komorebi::Colour; -pub use komorebi::CrossBoundaryBehaviour; -pub use komorebi::GridLayoutOptions; -pub use komorebi::KomorebiTheme; -pub use komorebi::LayoutOptions; -pub use komorebi::MonitorConfig; -pub use komorebi::Notification; -pub use komorebi::NotificationEvent; -pub use komorebi::Placement; -pub use komorebi::PredefinedAspectRatio; -pub use komorebi::Rgb; -pub use komorebi::RuleDebug; -pub use komorebi::ScrollingLayoutOptions; -pub use komorebi::StackbarConfig; -pub use komorebi::StaticConfig; -pub use komorebi::SubscribeOptions; -pub use komorebi::TabsConfig; -pub use komorebi::ThemeOptions; -pub use komorebi::VirtualDesktopNotification; -pub use komorebi::Wallpaper; -pub use komorebi::WindowContainerBehaviour; -pub use komorebi::WindowHandlingBehaviour; -pub use komorebi::WindowsApi; -pub use komorebi::WorkspaceConfig; -pub use komorebi::animation::PerAnimationPrefixConfig; -pub use komorebi::animation::prefix::AnimationPrefix; -pub use komorebi::asc::ApplicationSpecificConfiguration; -pub use komorebi::border_manager::BorderInfo; -pub use komorebi::config_generation::ApplicationConfiguration; -pub use komorebi::config_generation::IdWithIdentifier; -pub use komorebi::config_generation::IdWithIdentifierAndComment; -pub use komorebi::config_generation::MatchingRule; -pub use komorebi::config_generation::MatchingStrategy; -pub use komorebi::container::Container; -pub use komorebi::core::AnimationStyle; -pub use komorebi::core::ApplicationIdentifier; -pub use komorebi::core::Arrangement; -pub use komorebi::core::Axis; -pub use komorebi::core::BorderImplementation; -pub use komorebi::core::BorderStyle; -pub use komorebi::core::Column; -pub use komorebi::core::ColumnSplit; -pub use komorebi::core::ColumnSplitWithCapacity; -pub use komorebi::core::ColumnWidth; -pub use komorebi::core::CustomLayout; -pub use komorebi::core::CycleDirection; -pub use komorebi::core::DefaultLayout; -pub use komorebi::core::Direction; -pub use komorebi::core::FloatingLayerBehaviour; -pub use komorebi::core::FocusFollowsMouseImplementation; -pub use komorebi::core::HidingBehaviour; -pub use komorebi::core::Layout; -pub use komorebi::core::MonocleFocusBehaviour; -pub use komorebi::core::MoveBehaviour; -pub use komorebi::core::OperationBehaviour; -pub use komorebi::core::OperationDirection; -pub use komorebi::core::PanDirection; -pub use komorebi::core::PanGesture; -pub use komorebi::core::PathExt; -pub use komorebi::core::Rect; -pub use komorebi::core::Sizing; -pub use komorebi::core::SocketMessage; -pub use komorebi::core::StackbarLabel; -pub use komorebi::core::StackbarMode; -pub use komorebi::core::StateQuery; -pub use komorebi::core::WindowKind; -pub use komorebi::core::config_generation::ApplicationConfigurationGenerator; -pub use komorebi::core::replace_env_in_path; -pub use komorebi::monitor::Monitor; -pub use komorebi::monitor_reconciliator::MonitorNotification; -pub use komorebi::ring::Ring; -pub use komorebi::splash; -pub use komorebi::state::GlobalState; -pub use komorebi::state::State; -pub use komorebi::win32_display_data; -pub use komorebi::window::Window; -pub use komorebi::window_manager_event::WindowManagerEvent; -pub use komorebi::workspace::Workspace; -pub use komorebi::workspace::WorkspaceGlobals; -pub use komorebi::workspace::WorkspaceLayer; +//! The client of the komorebi daemon, for Windows, KDE Plasma and macOS: one crate, with the module +//! of the target OS re-exported at its root. The functions that talk to the daemon's socket and the +//! types they send are the same in the three modules; what differs is the daemon crate they +//! re-export from and the socket type (`uds_windows` on Windows, `std::os::unix` elsewhere). -use komorebi::DATA_DIR; - -use std::borrow::Borrow; -use std::io::BufReader; -use std::io::Read; -use std::io::Write; -use std::net::Shutdown; -use std::time::Duration; -pub use uds_windows::UnixListener; -use uds_windows::UnixStream; - -const KOMOREBI: &str = "komorebi.sock"; - -pub fn send_message(message: &SocketMessage) -> std::io::Result<()> { - let socket = DATA_DIR.join(KOMOREBI); - let mut stream = UnixStream::connect(socket)?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - stream.write_all(serde_json::to_string(message)?.as_bytes()) -} - -/// A connection to komorebi that messages are written to one after the other, which komorebi -/// handles in the order that they were written, as it does the lines of a batch. Messages sent -/// with [`send_message`] are each on a connection of their own, which komorebi handles on a -/// thread of its own, so two that are sent together can be handled in either order. -pub struct Connection { - stream: UnixStream, -} - -impl Connection { - pub fn open() -> std::io::Result { - let socket = DATA_DIR.join(KOMOREBI); - let stream = UnixStream::connect(socket)?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - - Ok(Self { stream }) +cfg_select! { + target_os = "windows" => { + mod windows; + pub use windows::*; } - - pub fn send(&mut self, message: &SocketMessage) -> std::io::Result<()> { - let mut line = serde_json::to_string(message)?; - line.push('\n'); - - self.stream.write_all(line.as_bytes()) + target_os = "linux" => { + extern crate komorebi_linux; + mod linux; + pub use linux::*; + } + target_os = "macos" => { + extern crate komorebi_macos; + mod macos; + pub use macos::*; } } - -pub fn send_batch(messages: impl IntoIterator) -> std::io::Result<()> -where - Q: Borrow, -{ - let socket = DATA_DIR.join(KOMOREBI); - let mut stream = UnixStream::connect(socket)?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - let msgs = messages.into_iter().fold(String::new(), |mut s, m| { - if let Ok(m_str) = serde_json::to_string(m.borrow()) { - s.push_str(&m_str); - s.push('\n'); - } - s - }); - stream.write_all(msgs.as_bytes()) -} - -pub fn send_query(message: &SocketMessage) -> std::io::Result { - let socket = DATA_DIR.join(KOMOREBI); - - let mut stream = UnixStream::connect(socket)?; - stream.set_read_timeout(Some(Duration::from_secs(1)))?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - stream.write_all(serde_json::to_string(message)?.as_bytes())?; - stream.shutdown(Shutdown::Write)?; - - let mut reader = BufReader::new(stream); - let mut response = String::new(); - reader.read_to_string(&mut response)?; - - Ok(response) -} - -pub fn subscribe(name: &str) -> std::io::Result { - let socket = DATA_DIR.join(name); - - match std::fs::remove_file(&socket) { - Ok(()) => {} - Err(error) => match error.kind() { - std::io::ErrorKind::NotFound => {} - _ => { - return Err(error); - } - }, - }; - - let listener = UnixListener::bind(&socket)?; - - send_message(&SocketMessage::AddSubscriberSocket(name.to_string()))?; - - Ok(listener) -} - -pub fn subscribe_with_options( - name: &str, - options: SubscribeOptions, -) -> std::io::Result { - let socket = DATA_DIR.join(name); - - match std::fs::remove_file(&socket) { - Ok(()) => {} - Err(error) => match error.kind() { - std::io::ErrorKind::NotFound => {} - _ => { - return Err(error); - } - }, - }; - - let listener = UnixListener::bind(&socket)?; - - send_message(&SocketMessage::AddSubscriberSocketWithOptions( - name.to_string(), - options, - ))?; - - Ok(listener) -} diff --git a/komorebi-client/src/linux.rs b/komorebi-client/src/linux.rs new file mode 100644 index 00000000..dee73eca --- /dev/null +++ b/komorebi-client/src/linux.rs @@ -0,0 +1,435 @@ +//! A client for the komorebi daemon: it writes [`SocketMessage`]s on the daemon's socket and reads +//! the daemon's answers. +//! +//! The daemon listens on `komorebi.sock` in [`struct@DATA_DIR`], which is +//! `$XDG_RUNTIME_DIR/komorebi` in a desktop session. Every function here opens a new connection +//! and writes each message as one line of JSON. [`send_message`] and [`send_batch`] give +//! orders and read nothing back; [`send_query`] asks a question and returns the answer, which the +//! daemon ends by closing the connection. A function fails with the error of the connection, so a +//! daemon that is not running is an [`std::io::ErrorKind::NotFound`] or a +//! [`std::io::ErrorKind::ConnectionRefused`]. +//! +//! [`subscribe`] and [`subscribe_with_options`] make the program a subscriber: they listen on a +//! socket of its own in [`struct@DATA_DIR`], and ask the daemon to send a [`Notification`] to it +//! after each event and each message the window manager handles. +//! +//! The crate also re-exports the types the messages and the answers are made of, so that a client +//! needs nothing else, and [`check`], the checks `komorebic check` runs. +//! +//! # Example +//! +//! The examples on this page answer for the daemon: each one listens on the socket itself, in a +//! runtime directory made for it, before it sends anything. +//! +//! ```rust +//! # use std::io::{BufRead, BufReader, Write}; +//! # let runtime = format!("/tmp/komorebi-client-doc-crate-{}", std::process::id()); +//! # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; +//! # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the socket is in it +//! # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); +//! # let listener = std::os::unix::net::UnixListener::bind(&socket)?; +//! # let daemon = std::thread::spawn(move || -> std::io::Result { +//! # let (mut stream, _) = listener.accept()?; +//! # let mut line = String::new(); +//! # BufReader::new(stream.try_clone()?).read_line(&mut line)?; +//! # stream.write_all(b"2")?; +//! # Ok(line) +//! # }); +//! use komorebi_client::SocketMessage; +//! use komorebi_client::StateQuery; +//! use komorebi_client::send_query; +//! +//! let workspace = send_query(&SocketMessage::Query(StateQuery::FocusedWorkspaceIndex))?; +//! assert_eq!(workspace, "2"); +//! +//! # assert_eq!( +//! # daemon.join().unwrap()?, +//! # r#"{"type":"Query","content":"FocusedWorkspaceIndex"}"# +//! # ); +//! # std::fs::remove_dir_all(&runtime)?; +//! # Ok::<(), Box>(()) +//! ``` +//! +//! `komorebi-client/tests/daemon.rs` sends the same messages to a window manager that listens the +//! way the daemon does, over an in-memory desktop. + +use crate::komorebi_linux as komorebi; + +pub use komorebi::DATA_DIR; +pub use komorebi::LOG_DIR; +pub use komorebi::Notification; +pub use komorebi::NotificationEvent; +pub use komorebi::animation::AnimationPrefix; +pub use komorebi::check; +pub use komorebi::container::Container; +pub use komorebi::core::ApplicationIdentifier; +pub use komorebi::core::Axis; +pub use komorebi::core::CycleDirection; +pub use komorebi::core::DefaultLayout; +pub use komorebi::core::FocusFollowsMouseImplementation; +pub use komorebi::core::Layout; +pub use komorebi::core::MonocleFocusBehaviour; +pub use komorebi::core::MoveBehaviour; +pub use komorebi::core::OperationBehaviour; +pub use komorebi::core::OperationDirection; +pub use komorebi::core::PanDirection; +pub use komorebi::core::Rect; +pub use komorebi::core::ScrollingCentering; +pub use komorebi::core::Sizing; +pub use komorebi::core::SocketMessage; +pub use komorebi::core::StateQuery; +pub use komorebi::core::SubscribeOptions; +pub use komorebi::core::WindowKind; +pub use komorebi::core::animation::AnimationStyle; +pub use komorebi::core::asc::ApplicationSpecificConfiguration; +pub use komorebi::core::pathext::PathExt; +pub use komorebi::core::pathext::replace_env_in_path; +pub use komorebi::monitor_reconciliator::MonitorNotification; +pub use komorebi::state::State; +pub use komorebi::static_config::StaticConfig; +pub use komorebi::window::Window; +pub use komorebi::workspace::Workspace; +pub use komorebi::workspace::WorkspaceLayer; +pub use komorebi_themes::KomorebiTheme; +pub use komorebi_themes::colour::Colour; +pub use komorebi_themes::colour::Rgb; +use std::borrow::Borrow; +use std::io::BufReader; +use std::io::Read; +use std::io::Write; +use std::net::Shutdown; +use std::os::unix::net::UnixListener; +use std::os::unix::net::UnixStream; +use std::time::Duration; + +const KOMOREBI: &str = "komorebi.sock"; + +/// Sends one message to the daemon, and does not wait for it to be handled +/// +/// # Errors +/// +/// - The daemon's socket cannot be connected to, for example because the daemon is not running. +/// - The message cannot be written within a second. +/// +/// # Example +/// +/// ```rust +/// # use std::io::{BufRead, BufReader}; +/// # let runtime = format!("/tmp/komorebi-client-doc-message-{}", std::process::id()); +/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; +/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the socket is in it +/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); +/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; +/// # let daemon = std::thread::spawn(move || -> std::io::Result { +/// # let (stream, _) = listener.accept()?; +/// # let mut line = String::new(); +/// # BufReader::new(stream).read_line(&mut line)?; +/// # Ok(line) +/// # }); +/// use komorebi_client::SocketMessage; +/// use komorebi_client::send_message; +/// +/// send_message(&SocketMessage::Retile)?; +/// +/// # assert_eq!(daemon.join().unwrap()?, r#"{"type":"Retile"}"#); +/// # std::fs::remove_dir_all(&runtime)?; +/// # Ok::<(), Box>(()) +/// ``` +pub fn send_message(message: &SocketMessage) -> std::io::Result<()> { + let socket = DATA_DIR.join(KOMOREBI); + let mut stream = UnixStream::connect(socket)?; + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + stream.write_all(serde_json::to_string(message)?.as_bytes()) +} + +/// A connection to komorebi that messages are written to one after the other, which komorebi +/// handles in the order that they were written, as it does the lines of a batch. Messages sent +/// with [`send_message`] are each on a connection of their own, which komorebi handles on a +/// thread of its own, so two that are sent together can be handled in either order. +pub struct Connection { + stream: UnixStream, +} + +impl Connection { + /// Opens a connection to the daemon's socket. + /// + /// # Errors + /// + /// The daemon's socket cannot be connected to, or written to within a second. + pub fn open() -> std::io::Result { + let socket = DATA_DIR.join(KOMOREBI); + + Self::from_stream(UnixStream::connect(socket)?) + } + + fn from_stream(stream: UnixStream) -> std::io::Result { + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + + Ok(Self { stream }) + } + + /// Writes one message as a line. + /// + /// # Errors + /// + /// The message cannot be written, for example because the daemon let go of the connection. + pub fn send(&mut self, message: &SocketMessage) -> std::io::Result<()> { + let mut line = serde_json::to_string(message)?; + line.push('\n'); + + self.stream.write_all(line.as_bytes()) + } +} + +/// Sends several messages to the daemon on one connection, which handles them in order, and does +/// not wait for them to be handled +/// +/// # Errors +/// +/// The same as [`send_message`]. +/// +/// # Example +/// +/// ```rust +/// # use std::io::{BufRead, BufReader}; +/// # let runtime = format!("/tmp/komorebi-client-doc-batch-{}", std::process::id()); +/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; +/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the socket is in it +/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); +/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; +/// # let daemon = std::thread::spawn(move || -> std::io::Result> { +/// # let (stream, _) = listener.accept()?; +/// # BufReader::new(stream).lines().collect() +/// # }); +/// use komorebi_client::SocketMessage; +/// use komorebi_client::send_batch; +/// +/// send_batch([SocketMessage::Retile, SocketMessage::Stop])?; +/// +/// # assert_eq!(daemon.join().unwrap()?, [r#"{"type":"Retile"}"#, r#"{"type":"Stop"}"#]); +/// # std::fs::remove_dir_all(&runtime)?; +/// # Ok::<(), Box>(()) +/// ``` +pub fn send_batch(messages: impl IntoIterator) -> std::io::Result<()> +where + Q: Borrow, +{ + let socket = DATA_DIR.join(KOMOREBI); + let mut stream = UnixStream::connect(socket)?; + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + let msgs = messages.into_iter().fold(String::new(), |mut s, m| { + if let Ok(m_str) = serde_json::to_string(m.borrow()) { + s.push_str(&m_str); + s.push('\n'); + } + s + }); + stream.write_all(msgs.as_bytes()) +} + +/// Sends one message to the daemon and returns its answer: JSON for +/// [`SocketMessage::State`] and [`SocketMessage::MonitorInformation`], one value as text for +/// [`SocketMessage::Query`], and nothing for a message that is not a question +/// +/// # Errors +/// +/// - The daemon's socket cannot be connected to, for example because the daemon is not running. +/// - The message cannot be written within a second. +/// - The daemon sends nothing for a second before its answer is complete. +/// +/// # Example +/// +/// The answer to [`SocketMessage::State`] reads back as a [`State`]: +/// +/// ```rust +/// # use std::io::{BufRead, BufReader, Write}; +/// # let runtime = format!("/tmp/komorebi-client-doc-query-{}", std::process::id()); +/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; +/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the socket is in it +/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); +/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; +/// # let daemon = std::thread::spawn(move || -> std::io::Result<()> { +/// # let (mut stream, _) = listener.accept()?; +/// # BufReader::new(stream.try_clone()?).read_line(&mut String::new())?; +/// # let state = r#"{"monitors":{"elements":[],"focused":0},"monitor_usr_idx_map":{},"is_paused":false,"resize_delta":50,"new_window_behaviour":"Create","float_override":false,"cross_monitor_move_behaviour":"Swap","monocle_focus_behaviour":"NoOp","unmanaged_window_operation_behaviour":"Op","work_area_offset":null,"mouse_follows_focus":true}"#; +/// # stream.write_all(state.as_bytes()) +/// # }); +/// use komorebi_client::SocketMessage; +/// use komorebi_client::State; +/// use komorebi_client::send_query; +/// +/// let state: State = serde_json::from_str(&send_query(&SocketMessage::State)?)?; +/// assert!(state.mouse_follows_focus); +/// +/// # daemon.join().unwrap()?; +/// # std::fs::remove_dir_all(&runtime)?; +/// # Ok::<(), Box>(()) +/// ``` +pub fn send_query(message: &SocketMessage) -> std::io::Result { + let socket = DATA_DIR.join(KOMOREBI); + + let mut stream = UnixStream::connect(socket)?; + stream.set_read_timeout(Some(Duration::from_secs(1)))?; + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + stream.write_all(serde_json::to_string(message)?.as_bytes())?; + stream.shutdown(Shutdown::Write)?; + + let mut reader = BufReader::new(stream); + let mut response = String::new(); + reader.read_to_string(&mut response)?; + + Ok(response) +} + +/// Listens on the socket `name` in [`struct@DATA_DIR`], and asks the daemon to send a +/// [`Notification`] to it after each event and each message the window manager handles +/// +/// A socket file that is left over at that path is removed first. Each notification comes on a +/// new connection, as JSON, and ends when the daemon closes the connection; the first is the +/// notification of the subscription itself. When the daemon stops, it connects and closes the +/// connection without writing anything. +/// +/// A subscriber that the daemon cannot connect to, because its program has exited or its socket +/// was removed, is removed at the next notification, with its socket file. It has to subscribe +/// again: the daemon does not try it again, and does not keep its subscribers when it restarts. +/// +/// # Errors +/// +/// - The socket file left over at that path cannot be removed. +/// - The socket cannot be bound, for example because [`struct@DATA_DIR`] does not exist. +/// - The subscription cannot be sent, for one of the reasons [`send_message`] gives. +/// +/// # Example +/// +/// ```rust +/// # use std::io::{BufRead, BufReader, Write}; +/// # let runtime = format!("/tmp/komorebi-client-doc-subscribe-{}", std::process::id()); +/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; +/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the sockets are in it +/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); +/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; +/// # let daemon = std::thread::spawn(move || -> std::io::Result { +/// # let (stream, _) = listener.accept()?; +/// # let mut message = String::new(); +/// # BufReader::new(stream).read_line(&mut message)?; +/// # let subscriber = komorebi_client::DATA_DIR.join("bar.sock"); +/// # let state = r#"{"monitors":{"elements":[],"focused":0},"monitor_usr_idx_map":{},"is_paused":false,"resize_delta":50,"new_window_behaviour":"Create","float_override":false,"cross_monitor_move_behaviour":"Swap","monocle_focus_behaviour":"NoOp","unmanaged_window_operation_behaviour":"Op","work_area_offset":null,"mouse_follows_focus":true}"#; +/// # let notification = format!(r#"{{"event":{message},"state":{state}}}"#); +/// # std::os::unix::net::UnixStream::connect(subscriber)?.write_all(notification.as_bytes())?; +/// # Ok(message) +/// # }); +/// use std::io::Read; +/// +/// use komorebi_client::Notification; +/// use komorebi_client::NotificationEvent; +/// use komorebi_client::SocketMessage; +/// use komorebi_client::subscribe; +/// +/// let listener = subscribe("bar.sock")?; +/// +/// // the first notification is the one of the subscription +/// let (mut connection, _) = listener.accept()?; +/// let mut json = String::new(); +/// connection.read_to_string(&mut json)?; +/// let notification: Notification = serde_json::from_str(&json)?; +/// assert!(matches!( +/// notification.event, +/// NotificationEvent::Socket(SocketMessage::AddSubscriberSocket(name)) if name == "bar.sock" +/// )); +/// +/// # assert_eq!( +/// # daemon.join().unwrap()?, +/// # r#"{"type":"AddSubscriberSocket","content":"bar.sock"}"# +/// # ); +/// # std::fs::remove_dir_all(&runtime)?; +/// # Ok::<(), Box>(()) +/// ``` +pub fn subscribe(name: &str) -> std::io::Result { + let socket = DATA_DIR.join(name); + + match std::fs::remove_file(&socket) { + Ok(()) => {} + Err(error) => match error.kind() { + std::io::ErrorKind::NotFound => {} + _ => { + return Err(error); + } + }, + }; + + let listener = UnixListener::bind(&socket)?; + + send_message(&SocketMessage::AddSubscriberSocket(name.to_string()))?; + + Ok(listener) +} + +/// The same as [`subscribe`], with the [`SubscribeOptions`] the daemon applies to this subscriber +/// +/// With `filter_state_changes`, the daemon sends a notification only when the event or the message +/// changed the [`State`], and always when a window is shown, when a subscriber is added, when a +/// theme is set and when the configuration is reloaded. +/// +/// # Errors +/// +/// The same as [`subscribe`]. +/// +/// # Example +/// +/// ```rust +/// # use std::io::{BufRead, BufReader}; +/// # let runtime = format!("/tmp/komorebi-client-doc-options-{}", std::process::id()); +/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; +/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the sockets are in it +/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); +/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; +/// # let daemon = std::thread::spawn(move || -> std::io::Result { +/// # let (stream, _) = listener.accept()?; +/// # let mut message = String::new(); +/// # BufReader::new(stream).read_line(&mut message)?; +/// # Ok(message) +/// # }); +/// use komorebi_client::DATA_DIR; +/// use komorebi_client::SubscribeOptions; +/// use komorebi_client::subscribe_with_options; +/// +/// let options = SubscribeOptions { +/// filter_state_changes: true, +/// }; +/// let listener = subscribe_with_options("bar.sock", options)?; +/// +/// let socket = DATA_DIR.join("bar.sock"); +/// assert_eq!(listener.local_addr()?.as_pathname(), Some(socket.as_path())); +/// +/// # assert_eq!( +/// # daemon.join().unwrap()?, +/// # r#"{"type":"AddSubscriberSocketWithOptions","content":["bar.sock",{"filter_state_changes":true}]}"# +/// # ); +/// # std::fs::remove_dir_all(&runtime)?; +/// # Ok::<(), Box>(()) +/// ``` +pub fn subscribe_with_options( + name: &str, + options: SubscribeOptions, +) -> std::io::Result { + let socket = DATA_DIR.join(name); + + match std::fs::remove_file(&socket) { + Ok(()) => {} + Err(error) => match error.kind() { + std::io::ErrorKind::NotFound => {} + _ => { + return Err(error); + } + }, + }; + + let listener = UnixListener::bind(&socket)?; + + send_message(&SocketMessage::AddSubscriberSocketWithOptions( + name.to_string(), + options, + ))?; + + Ok(listener) +} diff --git a/komorebi-client/src/macos.rs b/komorebi-client/src/macos.rs new file mode 100644 index 00000000..b930ae68 --- /dev/null +++ b/komorebi-client/src/macos.rs @@ -0,0 +1,227 @@ +use crate::komorebi_macos as komorebi; + +pub use komorebi::DATA_DIR; +pub use komorebi::Notification; +pub use komorebi::NotificationEvent; +pub use komorebi::animation::AnimationPrefix; +pub use komorebi::container::Container; +pub use komorebi::core::ApplicationIdentifier; +pub use komorebi::core::Axis; +pub use komorebi::core::CycleDirection; +pub use komorebi::core::DefaultLayout; +pub use komorebi::core::Layout; +pub use komorebi::core::MonocleFocusBehaviour; +pub use komorebi::core::MoveBehaviour; +pub use komorebi::core::OperationBehaviour; +pub use komorebi::core::OperationDirection; +pub use komorebi::core::PanDirection; +pub use komorebi::core::PanGesture; +pub use komorebi::core::Rect; +pub use komorebi::core::Sizing; +pub use komorebi::core::SocketMessage; +pub use komorebi::core::StateQuery; +pub use komorebi::core::SubscribeOptions; +pub use komorebi::core::WindowKind; +pub use komorebi::core::animation::AnimationStyle; +pub use komorebi::core::asc::ApplicationSpecificConfiguration; +pub use komorebi::core::pathext::PathExt; +pub use komorebi::core::pathext::replace_env_in_path; +pub use komorebi::monitor_reconciliator::MonitorNotification; +pub use komorebi::splash; +pub use komorebi::state::State; +pub use komorebi::static_config::StaticConfig; +pub use komorebi::window::Window; +pub use komorebi::workspace::Workspace; +pub use komorebi::workspace::WorkspaceLayer; +pub use komorebi_themes::KomorebiTheme; +pub use komorebi_themes::colour::Colour; +pub use komorebi_themes::colour::Rgb; +use std::borrow::Borrow; +use std::io::BufReader; +use std::io::Read; +use std::io::Write; +use std::net::Shutdown; +use std::os::unix::net::UnixListener; +use std::os::unix::net::UnixStream; +use std::time::Duration; + +const KOMOREBI: &str = "komorebi.sock"; + +pub fn send_message(message: &SocketMessage) -> std::io::Result<()> { + let socket = DATA_DIR.join(KOMOREBI); + let mut stream = UnixStream::connect(socket)?; + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + stream.write_all(serde_json::to_string(message)?.as_bytes()) +} + +/// A connection to komorebi that messages are written to one after the other, which komorebi +/// handles in the order that they were written, as it does the lines of a batch. Messages sent +/// with [`send_message`] are each on a connection of their own, which komorebi handles on a +/// thread of its own, so two that are sent together can be handled in either order. +pub struct Connection { + stream: UnixStream, +} + +impl Connection { + pub fn open() -> std::io::Result { + let socket = DATA_DIR.join(KOMOREBI); + + Self::from_stream(UnixStream::connect(socket)?) + } + + fn from_stream(stream: UnixStream) -> std::io::Result { + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + + Ok(Self { stream }) + } + + pub fn send(&mut self, message: &SocketMessage) -> std::io::Result<()> { + let mut line = serde_json::to_string(message)?; + line.push('\n'); + + self.stream.write_all(line.as_bytes()) + } +} + +pub fn send_batch(messages: impl IntoIterator) -> std::io::Result<()> +where + Q: Borrow, +{ + let socket = DATA_DIR.join(KOMOREBI); + let mut stream = UnixStream::connect(socket)?; + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + let msgs = messages.into_iter().fold(String::new(), |mut s, m| { + if let Ok(m_str) = serde_json::to_string(m.borrow()) { + s.push_str(&m_str); + s.push('\n'); + } + s + }); + stream.write_all(msgs.as_bytes()) +} + +pub fn send_query(message: &SocketMessage) -> std::io::Result { + let socket = DATA_DIR.join(KOMOREBI); + + let mut stream = UnixStream::connect(socket)?; + stream.set_read_timeout(Some(Duration::from_secs(1)))?; + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + stream.write_all(serde_json::to_string(message)?.as_bytes())?; + stream.shutdown(Shutdown::Write)?; + + let mut reader = BufReader::new(stream); + let mut response = String::new(); + reader.read_to_string(&mut response)?; + + Ok(response) +} + +pub fn subscribe(name: &str) -> std::io::Result { + let socket = DATA_DIR.join(name); + + match std::fs::remove_file(&socket) { + Ok(()) => {} + Err(error) => match error.kind() { + std::io::ErrorKind::NotFound => {} + _ => { + return Err(error); + } + }, + }; + + let listener = UnixListener::bind(&socket)?; + + send_message(&SocketMessage::AddSubscriberSocket(name.to_string()))?; + + Ok(listener) +} + +pub fn subscribe_with_options( + name: &str, + options: SubscribeOptions, +) -> std::io::Result { + let socket = DATA_DIR.join(name); + + match std::fs::remove_file(&socket) { + Ok(()) => {} + Err(error) => match error.kind() { + std::io::ErrorKind::NotFound => {} + _ => { + return Err(error); + } + }, + }; + + let listener = UnixListener::bind(&socket)?; + + send_message(&SocketMessage::AddSubscriberSocketWithOptions( + name.to_string(), + options, + ))?; + + Ok(listener) +} + +#[cfg(test)] +mod tests { + use super::*; + use std::io::BufRead; + use std::str::FromStr; + + #[test] + fn messages_are_written_to_a_connection_a_line_each_in_the_order_that_they_were_sent() { + let (ours, theirs) = UnixStream::pair().unwrap(); + let mut connection = Connection::from_stream(ours).unwrap(); + + connection + .send(&SocketMessage::PanGesture(PanGesture::Begin)) + .unwrap(); + connection + .send(&SocketMessage::Pan(PanDirection::Right)) + .unwrap(); + connection + .send(&SocketMessage::PanGesture(PanGesture::Move { + dx: 0.5, + dy: 0.0, + t: 12.0, + })) + .unwrap(); + drop(connection); + + let lines: Vec = BufReader::new(theirs) + .lines() + .collect::>() + .unwrap(); + assert_eq!(lines.len(), 3, "one line to a message: {lines:?}"); + + let messages: Vec = lines + .iter() + .map(|line| SocketMessage::from_str(line).unwrap()) + .collect(); + assert!(matches!( + messages[0], + SocketMessage::PanGesture(PanGesture::Begin) + )); + assert!(matches!( + messages[1], + SocketMessage::Pan(PanDirection::Right) + )); + assert!(matches!( + messages[2], + SocketMessage::PanGesture(PanGesture::Move { dx, t, .. }) if dx == 0.5 && t == 12.0 + )); + } + + #[test] + fn writing_to_a_connection_that_was_let_go_of_is_an_error() { + let (ours, theirs) = UnixStream::pair().unwrap(); + let mut connection = Connection::from_stream(ours).unwrap(); + drop(theirs); + + assert!( + connection + .send(&SocketMessage::PanGesture(PanGesture::Cancel)) + .is_err() + ); + } +} diff --git a/komorebi-client/src/windows.rs b/komorebi-client/src/windows.rs new file mode 100644 index 00000000..96f15c0a --- /dev/null +++ b/komorebi-client/src/windows.rs @@ -0,0 +1,213 @@ + +pub use komorebi::AnimationsConfig; +pub use komorebi::AppSpecificConfigurationPath; +pub use komorebi::AspectRatio; +pub use komorebi::BorderColours; +pub use komorebi::Colour; +pub use komorebi::CrossBoundaryBehaviour; +pub use komorebi::GridLayoutOptions; +pub use komorebi::KomorebiTheme; +pub use komorebi::LayoutOptions; +pub use komorebi::MonitorConfig; +pub use komorebi::Notification; +pub use komorebi::NotificationEvent; +pub use komorebi::Placement; +pub use komorebi::PredefinedAspectRatio; +pub use komorebi::Rgb; +pub use komorebi::RuleDebug; +pub use komorebi::ScrollingLayoutOptions; +pub use komorebi::StackbarConfig; +pub use komorebi::StaticConfig; +pub use komorebi::SubscribeOptions; +pub use komorebi::TabsConfig; +pub use komorebi::ThemeOptions; +pub use komorebi::VirtualDesktopNotification; +pub use komorebi::Wallpaper; +pub use komorebi::WindowContainerBehaviour; +pub use komorebi::WindowHandlingBehaviour; +pub use komorebi::WindowsApi; +pub use komorebi::WorkspaceConfig; +pub use komorebi::animation::PerAnimationPrefixConfig; +pub use komorebi::animation::prefix::AnimationPrefix; +pub use komorebi::asc::ApplicationSpecificConfiguration; +pub use komorebi::border_manager::BorderInfo; +pub use komorebi::config_generation::ApplicationConfiguration; +pub use komorebi::config_generation::IdWithIdentifier; +pub use komorebi::config_generation::IdWithIdentifierAndComment; +pub use komorebi::config_generation::MatchingRule; +pub use komorebi::config_generation::MatchingStrategy; +pub use komorebi::container::Container; +pub use komorebi::core::AnimationStyle; +pub use komorebi::core::ApplicationIdentifier; +pub use komorebi::core::Arrangement; +pub use komorebi::core::Axis; +pub use komorebi::core::BorderImplementation; +pub use komorebi::core::BorderStyle; +pub use komorebi::core::Column; +pub use komorebi::core::ColumnSplit; +pub use komorebi::core::ColumnSplitWithCapacity; +pub use komorebi::core::ColumnWidth; +pub use komorebi::core::CustomLayout; +pub use komorebi::core::CycleDirection; +pub use komorebi::core::DefaultLayout; +pub use komorebi::core::Direction; +pub use komorebi::core::FloatingLayerBehaviour; +pub use komorebi::core::FocusFollowsMouseImplementation; +pub use komorebi::core::HidingBehaviour; +pub use komorebi::core::Layout; +pub use komorebi::core::MonocleFocusBehaviour; +pub use komorebi::core::MoveBehaviour; +pub use komorebi::core::OperationBehaviour; +pub use komorebi::core::OperationDirection; +pub use komorebi::core::PanDirection; +pub use komorebi::core::PanGesture; +pub use komorebi::core::PathExt; +pub use komorebi::core::Rect; +pub use komorebi::core::Sizing; +pub use komorebi::core::SocketMessage; +pub use komorebi::core::StackbarLabel; +pub use komorebi::core::StackbarMode; +pub use komorebi::core::StateQuery; +pub use komorebi::core::WindowKind; +pub use komorebi::core::config_generation::ApplicationConfigurationGenerator; +pub use komorebi::core::replace_env_in_path; +pub use komorebi::monitor::Monitor; +pub use komorebi::monitor_reconciliator::MonitorNotification; +pub use komorebi::ring::Ring; +pub use komorebi::splash; +pub use komorebi::state::GlobalState; +pub use komorebi::state::State; +pub use komorebi::win32_display_data; +pub use komorebi::window::Window; +pub use komorebi::window_manager_event::WindowManagerEvent; +pub use komorebi::workspace::Workspace; +pub use komorebi::workspace::WorkspaceGlobals; +pub use komorebi::workspace::WorkspaceLayer; + +pub use komorebi::DATA_DIR; + +use std::borrow::Borrow; +use std::io::BufReader; +use std::io::Read; +use std::io::Write; +use std::net::Shutdown; +use std::time::Duration; +pub use uds_windows::UnixListener; +use uds_windows::UnixStream; + +const KOMOREBI: &str = "komorebi.sock"; + +pub fn send_message(message: &SocketMessage) -> std::io::Result<()> { + let socket = DATA_DIR.join(KOMOREBI); + let mut stream = UnixStream::connect(socket)?; + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + stream.write_all(serde_json::to_string(message)?.as_bytes()) +} + +/// A connection to komorebi that messages are written to one after the other, which komorebi +/// handles in the order that they were written, as it does the lines of a batch. Messages sent +/// with [`send_message`] are each on a connection of their own, which komorebi handles on a +/// thread of its own, so two that are sent together can be handled in either order. +pub struct Connection { + stream: UnixStream, +} + +impl Connection { + pub fn open() -> std::io::Result { + let socket = DATA_DIR.join(KOMOREBI); + + Self::from_stream(UnixStream::connect(socket)?) + } + + fn from_stream(stream: UnixStream) -> std::io::Result { + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + + Ok(Self { stream }) + } + + pub fn send(&mut self, message: &SocketMessage) -> std::io::Result<()> { + let mut line = serde_json::to_string(message)?; + line.push('\n'); + + self.stream.write_all(line.as_bytes()) + } +} + +pub fn send_batch(messages: impl IntoIterator) -> std::io::Result<()> +where + Q: Borrow, +{ + let socket = DATA_DIR.join(KOMOREBI); + let mut stream = UnixStream::connect(socket)?; + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + let msgs = messages.into_iter().fold(String::new(), |mut s, m| { + if let Ok(m_str) = serde_json::to_string(m.borrow()) { + s.push_str(&m_str); + s.push('\n'); + } + s + }); + stream.write_all(msgs.as_bytes()) +} + +pub fn send_query(message: &SocketMessage) -> std::io::Result { + let socket = DATA_DIR.join(KOMOREBI); + + let mut stream = UnixStream::connect(socket)?; + stream.set_read_timeout(Some(Duration::from_secs(1)))?; + stream.set_write_timeout(Some(Duration::from_secs(1)))?; + stream.write_all(serde_json::to_string(message)?.as_bytes())?; + stream.shutdown(Shutdown::Write)?; + + let mut reader = BufReader::new(stream); + let mut response = String::new(); + reader.read_to_string(&mut response)?; + + Ok(response) +} + +pub fn subscribe(name: &str) -> std::io::Result { + let socket = DATA_DIR.join(name); + + match std::fs::remove_file(&socket) { + Ok(()) => {} + Err(error) => match error.kind() { + std::io::ErrorKind::NotFound => {} + _ => { + return Err(error); + } + }, + }; + + let listener = UnixListener::bind(&socket)?; + + send_message(&SocketMessage::AddSubscriberSocket(name.to_string()))?; + + Ok(listener) +} + +pub fn subscribe_with_options( + name: &str, + options: SubscribeOptions, +) -> std::io::Result { + let socket = DATA_DIR.join(name); + + match std::fs::remove_file(&socket) { + Ok(()) => {} + Err(error) => match error.kind() { + std::io::ErrorKind::NotFound => {} + _ => { + return Err(error); + } + }, + }; + + let listener = UnixListener::bind(&socket)?; + + send_message(&SocketMessage::AddSubscriberSocketWithOptions( + name.to_string(), + options, + ))?; + + Ok(listener) +} diff --git a/komorebi-for-kde/komorebi-client/tests/daemon.rs b/komorebi-client/tests/linux_daemon.rs similarity index 98% rename from komorebi-for-kde/komorebi-client/tests/daemon.rs rename to komorebi-client/tests/linux_daemon.rs index d41f977b..3dcb9625 100644 --- a/komorebi-for-kde/komorebi-client/tests/daemon.rs +++ b/komorebi-client/tests/linux_daemon.rs @@ -1,7 +1,9 @@ +#![cfg(target_os = "linux")] //! The client against a window manager that listens the way the daemon does, with //! [`listen_for_commands`], over an in-memory desktop with one monitor and two windows. //! //! The tests share the window manager, and its socket in a runtime directory of this process. +extern crate komorebi_linux as komorebi; use komorebi::backend::fake::FakeBackend; use komorebi::backend::set_backend; diff --git a/komorebi-for-kde/komorebi-client/tests/subscribe.rs b/komorebi-client/tests/linux_subscribe.rs similarity index 99% rename from komorebi-for-kde/komorebi-client/tests/subscribe.rs rename to komorebi-client/tests/linux_subscribe.rs index 070055f2..0fe96c90 100644 --- a/komorebi-for-kde/komorebi-client/tests/subscribe.rs +++ b/komorebi-client/tests/linux_subscribe.rs @@ -1,3 +1,4 @@ +#![cfg(target_os = "linux")] //! Subscribers against a window manager that listens the way the daemon does, with //! [`listen_for_commands`], over an in-memory desktop with one monitor: each subscriber listens on a //! socket of its own in a runtime directory of this process, subscribes with `komorebi-client`, and @@ -6,6 +7,7 @@ //! The tests share the window manager, and take turns: every subscriber is sent every //! notification, so a test that ran at the same time as another would read the other's //! notifications too. Window ids are 901 and up. +extern crate komorebi_linux as komorebi; use komorebi::SUBSCRIPTION_SOCKETS; use komorebi::backend::fake::FakeBackend; diff --git a/komorebi-for-kde/Cargo.lock b/komorebi-for-kde/Cargo.lock deleted file mode 100644 index d2d42a07..00000000 --- a/komorebi-for-kde/Cargo.lock +++ /dev/null @@ -1,6580 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "ab_glyph" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" -dependencies = [ - "ab_glyph_rasterizer", - "owned_ttf_parser", -] - -[[package]] -name = "ab_glyph_rasterizer" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" - -[[package]] -name = "accesskit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf203f9d3bd8f29f98833d1fbef628df18f759248a547e7e01cfbf63cda36a99" - -[[package]] -name = "accesskit_atspi_common" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "890d241cf51fc784f0ac5ac34dfc847421f8d39da6c7c91a0fcc987db62a8267" -dependencies = [ - "accesskit", - "accesskit_consumer", - "atspi-common", - "serde", - "thiserror 1.0.69", - "zvariant", -] - -[[package]] -name = "accesskit_consumer" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db81010a6895d8707f9072e6ce98070579b43b717193d2614014abd5cb17dd43" -dependencies = [ - "accesskit", - "hashbrown 0.15.5", -] - -[[package]] -name = "accesskit_macos" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0089e5c0ac0ca281e13ea374773898d9354cc28d15af9f0f7394d44a495b575" -dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.15.5", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "accesskit_unix" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301e55b39cfc15d9c48943ce5f572204a551646700d0e8efa424585f94fec528" -dependencies = [ - "accesskit", - "accesskit_atspi_common", - "async-channel", - "async-executor", - "async-task", - "atspi", - "futures-lite", - "futures-util", - "serde", - "zbus 5.19.0", -] - -[[package]] -name = "accesskit_windows" -version = "0.29.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d63dd5041e49c363d83f5419a896ecb074d309c414036f616dc0b04faca971" -dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.15.5", - "static_assertions", - "windows 0.61.3", - "windows-core 0.61.2", -] - -[[package]] -name = "accesskit_winit" -version = "0.29.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8cfabe59d0eaca7412bfb1f70198dd31e3b0496fee7e15b066f9c36a1a140a0" -dependencies = [ - "accesskit", - "accesskit_macos", - "accesskit_unix", - "accesskit_windows", - "raw-window-handle", - "winit", -] - -[[package]] -name = "addr2line" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e567177890eb1617b1f774005b66b26b2377afd138a2ca37aae7d8f0c81429d4" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - -[[package]] -name = "adler32" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" - -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "getrandom 0.3.4", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] -name = "android-activity" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" -dependencies = [ - "android-properties", - "bitflags 2.13.2", - "cc", - "jni", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-sys", - "num_enum", - "thiserror 2.0.21", -] - -[[package]] -name = "android-properties" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" - -[[package]] -name = "android_system_properties" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" -dependencies = [ - "libc", -] - -[[package]] -name = "anstream" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" - -[[package]] -name = "anstyle-parse" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys 0.61.2", -] - -[[package]] -name = "anyhow" -version = "1.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" - -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - -[[package]] -name = "ar_archive_writer" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73cd58deff2140a0a8eae87e417bd01db68a33e148aa93d1e8cd837e55e312b6" -dependencies = [ - "object 0.39.1", -] - -[[package]] -name = "arboard" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" -dependencies = [ - "clipboard-win", - "image 0.25.10", - "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", - "parking_lot 0.12.5", - "percent-encoding", - "windows-sys 0.61.2", - "x11rb", -] - -[[package]] -name = "arrayref" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" - -[[package]] -name = "arrayvec" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" - -[[package]] -name = "as-raw-xcb-connection" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" - -[[package]] -name = "ash" -version = "0.38.0+1.3.281" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" -dependencies = [ - "libloading", -] - -[[package]] -name = "async-broadcast" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" -dependencies = [ - "event-listener", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-channel" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-executor" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "pin-project-lite", - "slab", -] - -[[package]] -name = "async-io" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" -dependencies = [ - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix 1.1.6", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-lock" -version = "3.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" -dependencies = [ - "event-listener", - "event-listener-strategy", - "pin-project-lite", -] - -[[package]] -name = "async-process" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" -dependencies = [ - "async-channel", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "rustix 1.1.6", -] - -[[package]] -name = "async-recursion" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "async-signal" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix 1.1.6", - "signal-hook-registry", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - -[[package]] -name = "async-trait" -version = "0.1.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "atspi" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83247582e7508838caf5f316c00791eee0e15c0bf743e6880585b867e16815c" -dependencies = [ - "atspi-common", - "atspi-connection", - "atspi-proxies", -] - -[[package]] -name = "atspi-common" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33dfc05e7cdf90988a197803bf24f5788f94f7c94a69efa95683e8ffe76cfdfb" -dependencies = [ - "enumflags2", - "serde", - "static_assertions", - "zbus 5.19.0", - "zbus-lockstep", - "zbus-lockstep-macros", - "zbus_names", - "zvariant", -] - -[[package]] -name = "atspi-connection" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4193d51303d8332304056ae0004714256b46b6635a5c556109b319c0d3784938" -dependencies = [ - "atspi-common", - "atspi-proxies", - "futures-lite", - "zbus 5.19.0", -] - -[[package]] -name = "atspi-proxies" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2eebcb9e7e76f26d0bcfd6f0295e1cd1e6f33bedbc5698a971db8dc43d7751c" -dependencies = [ - "atspi-common", - "serde", - "zbus 5.19.0", -] - -[[package]] -name = "autocfg" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" - -[[package]] -name = "backtrace" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f4220217f3288537b83684130f42fad43320b1c3b805f1910d683d52ded24f" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide 0.9.1", - "object 0.40.0", - "rustc-demangle", - "windows-link 0.2.1", -] - -[[package]] -name = "base16-egui-themes" -version = "0.1.0" -source = "git+https://github.com/LGUG2Z/base16-egui-themes?rev=3f157904c641f0dc80f043449fe0214fc4182425#3f157904c641f0dc80f043449fe0214fc4182425" -dependencies = [ - "egui", - "schemars 1.2.3", - "serde", - "strum", - "strum_macros", -] - -[[package]] -name = "base16_color_scheme" -version = "0.3.2" -source = "git+https://github.com/LGUG2Z/base16_color_scheme#c32a9e290f0997eacba3e74bba2442667b5fc478" -dependencies = [ - "hex", - "nom", - "ramhorns", - "serde", -] - -[[package]] -name = "base64" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" - -[[package]] -name = "beef" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" - -[[package]] -name = "bit-set" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" - -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - -[[package]] -name = "block2" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" -dependencies = [ - "objc2 0.5.3", -] - -[[package]] -name = "block2" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" -dependencies = [ - "objc2 0.6.5", -] - -[[package]] -name = "blocking" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" -dependencies = [ - "async-channel", - "async-task", - "futures-io", - "futures-lite", - "piper", -] - -[[package]] -name = "bs58" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "bumpalo" -version = "3.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" - -[[package]] -name = "by_address" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" - -[[package]] -name = "bytemuck" -version = "1.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "byteorder-lite" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" - -[[package]] -name = "bytes" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" - -[[package]] -name = "calloop" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" -dependencies = [ - "bitflags 2.13.2", - "log", - "polling", - "rustix 0.38.44", - "slab", - "thiserror 1.0.69", -] - -[[package]] -name = "calloop" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" -dependencies = [ - "bitflags 2.13.2", - "polling", - "rustix 1.1.6", - "tracing", -] - -[[package]] -name = "calloop-wayland-source" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" -dependencies = [ - "calloop 0.13.0", - "rustix 0.38.44", - "wayland-backend", - "wayland-client", -] - -[[package]] -name = "calloop-wayland-source" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" -dependencies = [ - "calloop 0.14.5", - "rustix 1.1.6", - "wayland-backend", - "wayland-client", -] - -[[package]] -name = "calm_io" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ea0608700fe42d90ec17ad0f86335cf229b67df2e34e7f463e8241ce7b8fa5f" -dependencies = [ - "calmio_filters", -] - -[[package]] -name = "calmio_filters" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "846501f4575cd66766a40bb7ab6d8e960adc7eb49f753c8232bd8e0e09cf6ca2" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "catppuccin-egui" -version = "5.6.0" -source = "git+https://github.com/LGUG2Z/catppuccin-egui?rev=b2f95cbf441d1dd99f3c955ef10dcb84ce23c20a#b2f95cbf441d1dd99f3c955ef10dcb84ce23c20a" -dependencies = [ - "egui", -] - -[[package]] -name = "cc" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" -dependencies = [ - "find-msvc-tools", - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" - -[[package]] -name = "cfg_aliases" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" - -[[package]] -name = "cgl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" -dependencies = [ - "libc", -] - -[[package]] -name = "chacha20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" -dependencies = [ - "cfg-if", - "cpufeatures", - "rand_core 0.10.1", -] - -[[package]] -name = "chrono" -version = "0.4.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-link 0.2.1", -] - -[[package]] -name = "chumsky" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eebd66744a15ded14960ab4ccdbfb51ad3b81f51f3f04a80adac98c985396c9" -dependencies = [ - "hashbrown 0.14.5", - "stacker", -] - -[[package]] -name = "clap" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", - "terminal_size", -] - -[[package]] -name = "clap_complete" -version = "4.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037e2a1a92236d0aff7e845093f64661d6df4c02c9fcc61a60e9e1d736fa392f" -dependencies = [ - "clap", -] - -[[package]] -name = "clap_derive" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "clap_lex" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" - -[[package]] -name = "clipboard-win" -version = "5.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" -dependencies = [ - "error-code", -] - -[[package]] -name = "codespan-reporting" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" -dependencies = [ - "serde", - "termcolor", - "unicode-width", -] - -[[package]] -name = "color-eyre" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d" -dependencies = [ - "backtrace", - "color-spantrace", - "eyre", - "indenter", - "once_cell", - "owo-colors", - "tracing-error", -] - -[[package]] -name = "color-spantrace" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427" -dependencies = [ - "once_cell", - "owo-colors", - "tracing-core", - "tracing-error", -] - -[[package]] -name = "color-thief" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6460d760cf38ce67c9e0318f896538820acc54f2d0a3bfc5b2c557211066c98" -dependencies = [ - "rgb", -] - -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - -[[package]] -name = "colorchoice" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" - -[[package]] -name = "combine" -version = "4.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "const_format" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3decb4d6965448659923544a634a0571ba44cede4e11ef15a5a317126840454" -dependencies = [ - "const_format_proc_macros", - "konst", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941b570269a642506f08cb5b688c04bfa6cfd41a26f8bcdc49db8fd00c0ab659" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "core-graphics" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "core-graphics-types 0.1.3", - "foreign-types", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" -dependencies = [ - "bitflags 2.13.2", - "core-foundation 0.10.1", - "libc", -] - -[[package]] -name = "cpufeatures" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" - -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "ctrlc" -version = "3.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162" -dependencies = [ - "dispatch2", - "nix", - "windows-sys 0.61.2", -] - -[[package]] -name = "cursor-icon" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" - -[[package]] -name = "darling" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" -dependencies = [ - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 3.0.9", -] - -[[package]] -name = "darling_macro" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" -dependencies = [ - "darling_core", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "deflate" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" -dependencies = [ - "adler32", - "byteorder", -] - -[[package]] -name = "defmt" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" -dependencies = [ - "bitflags 1.3.2", - "defmt-macros", -] - -[[package]] -name = "defmt-macros" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" -dependencies = [ - "defmt-parser", - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "defmt-parser" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "deranged" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" -dependencies = [ - "serde_core", -] - -[[package]] -name = "dirs" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" -dependencies = [ - "dirs-sys 0.3.7", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys 0.3.7", -] - -[[package]] -name = "dirs" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" -dependencies = [ - "dirs-sys 0.5.0", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users 0.4.6", - "winapi", -] - -[[package]] -name = "dirs-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" -dependencies = [ - "libc", - "option-ext", - "redox_users 0.5.3", - "windows-sys 0.61.2", -] - -[[package]] -name = "dispatch" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - -[[package]] -name = "dispatch2" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "libc", - "objc2 0.6.5", -] - -[[package]] -name = "displaydoc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "dlib" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" -dependencies = [ - "libloading", -] - -[[package]] -name = "document-features" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" -dependencies = [ - "litrs", -] - -[[package]] -name = "downcast-rs" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" - -[[package]] -name = "dpi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" - -[[package]] -name = "dyn-clone" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" - -[[package]] -name = "ecolor" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71ddb8ac7643d1dba1bb02110e804406dd459a838efcb14011ced10556711a8e" -dependencies = [ - "bytemuck", - "emath", -] - -[[package]] -name = "eframe" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "457481173e6db5ca9fa2be93a58df8f4c7be639587aeb4853b526c6cf87db4e6" -dependencies = [ - "ahash", - "bytemuck", - "document-features", - "egui", - "egui-wgpu", - "egui-winit", - "egui_glow", - "glow", - "glutin", - "glutin-winit", - "image 0.25.10", - "js-sys", - "log", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", - "parking_lot 0.12.5", - "percent-encoding", - "profiling", - "raw-window-handle", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "web-time", - "windows-sys 0.61.2", - "winit", -] - -[[package]] -name = "egui" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9b567d356674e9a5121ed3fedfb0a7c31e059fe71f6972b691bcd0bfc284e3" -dependencies = [ - "accesskit", - "ahash", - "bitflags 2.13.2", - "emath", - "epaint", - "log", - "nohash-hasher", - "profiling", - "smallvec", - "unicode-segmentation", -] - -[[package]] -name = "egui-wgpu" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4d209971c84b2352a06174abdba701af1e552ce56b144d96f2bd50a3c91236" -dependencies = [ - "ahash", - "bytemuck", - "document-features", - "egui", - "epaint", - "log", - "profiling", - "thiserror 2.0.21", - "type-map", - "web-time", - "wgpu", - "winit", -] - -[[package]] -name = "egui-winit" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec6687e5bb551702f4ad10ac428bab12acf9d53047ebb1082d4a0ed8c6251a29" -dependencies = [ - "accesskit_winit", - "arboard", - "bytemuck", - "egui", - "log", - "objc2 0.5.3", - "objc2-foundation 0.2.2", - "objc2-ui-kit", - "profiling", - "raw-window-handle", - "smithay-clipboard", - "web-time", - "webbrowser", - "winit", -] - -[[package]] -name = "egui_glow" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6420863ea1d90e750f75075231a260030ad8a9f30a7cef82cdc966492dc4c4eb" -dependencies = [ - "bytemuck", - "egui", - "glow", - "log", - "memoffset", - "profiling", - "wasm-bindgen", - "web-sys", - "winit", -] - -[[package]] -name = "either" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" - -[[package]] -name = "emath" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "491bdf728bf25ddd9ad60d4cf1c48588fa82c013a2440b91aa7fc43e34a07c32" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "endi" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" - -[[package]] -name = "enumflags2" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" -dependencies = [ - "enumflags2_derive", - "serde", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "epaint" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "009d0dd3c2163823a0abdb899451ecbc78798dec545ee91b43aff1fa790bab62" -dependencies = [ - "ab_glyph", - "ahash", - "bytemuck", - "ecolor", - "emath", - "epaint_default_fonts", - "log", - "nohash-hasher", - "parking_lot 0.12.5", - "profiling", -] - -[[package]] -name = "epaint_default_fonts" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4fbe202b6578d3d56428fa185cdf114a05e49da05f477b3c7f0fbb221f1862" - -[[package]] -name = "equivalent" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" - -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "error-code" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" - -[[package]] -name = "event-listener" -version = "5.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" -dependencies = [ - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" -dependencies = [ - "event-listener", - "pin-project-lite", -] - -[[package]] -name = "eyre" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08309dbcc659c5549a24ddb9b27027640641b282ef5768267c7e675558986a3" -dependencies = [ - "autocfg", - "indenter", - "once_cell", -] - -[[package]] -name = "fastrand" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" - -[[package]] -name = "fax" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" - -[[package]] -name = "fdeflate" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "file-id" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13be71e6ca82e91bc0cb862bebaac0b2d1924a5a1d970c822b2f98b63fda8c3" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "filetime" -version = "0.2.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" -dependencies = [ - "cfg-if", - "libc", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" - -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - -[[package]] -name = "flate2" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" -dependencies = [ - "crc32fast", - "miniz_oxide 0.9.1", - "zlib-rs", -] - -[[package]] -name = "flavours" -version = "0.7.2" -source = "git+https://github.com/LGUG2Z/flavours?rev=24518c129918fe3260aa559eded7657e50752cb1#24518c129918fe3260aa559eded7657e50752cb1" -dependencies = [ - "anyhow", - "base16_color_scheme", - "calm_io", - "color-thief", - "dirs 3.0.2", - "glob", - "hex", - "image 0.23.14", - "palette", - "rand 0.10.3", - "serde", - "serde_yaml 0.8.26", - "shell-words", - "shellexpand", - "toml", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foldhash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "fs-tail" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73c8ee8694b2ad6d79aa976ad8572ca376c0450290041e6e3ae75147356b6ad2" -dependencies = [ - "memchr", -] - -[[package]] -name = "fsevent-sys" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" -dependencies = [ - "libc", -] - -[[package]] -name = "futures-core" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" - -[[package]] -name = "futures-io" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" - -[[package]] -name = "futures-lite" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - -[[package]] -name = "futures-macro" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "futures-task" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" - -[[package]] -name = "futures-util" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" -dependencies = [ - "futures-core", - "futures-macro", - "futures-task", - "pin-project-lite", - "slab", -] - -[[package]] -name = "gethostname" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" -dependencies = [ - "rustix 1.1.6", - "windows-link 0.2.1", -] - -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi 5.3.0", - "wasip2", -] - -[[package]] -name = "getrandom" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" -dependencies = [ - "cfg-if", - "libc", - "r-efi 6.0.0", - "rand_core 0.10.1", -] - -[[package]] -name = "gif" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" -dependencies = [ - "color_quant", - "weezl", -] - -[[package]] -name = "gimli" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1033caf0b349c518623b5396bfb2cf0bddf44f0306d543a250e5743297aafd10" - -[[package]] -name = "git2" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b88256088d75a56f8ecfa070513a775dd9107f6530ef14919dac831af9cfe2b" -dependencies = [ - "bitflags 2.13.2", - "libc", - "libgit2-sys", - "log", - "url", -] - -[[package]] -name = "gl_generator" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" -dependencies = [ - "khronos_api", - "log", - "xml-rs", -] - -[[package]] -name = "glob" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" - -[[package]] -name = "glow" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08" -dependencies = [ - "js-sys", - "slotmap", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "glutin" -version = "0.32.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" -dependencies = [ - "bitflags 2.13.2", - "cfg_aliases", - "cgl", - "dispatch2", - "glutin_egl_sys", - "glutin_glx_sys", - "glutin_wgl_sys", - "libloading", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "once_cell", - "raw-window-handle", - "wayland-sys", - "windows-sys 0.52.0", - "x11-dl", -] - -[[package]] -name = "glutin-winit" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" -dependencies = [ - "cfg_aliases", - "glutin", - "raw-window-handle", - "winit", -] - -[[package]] -name = "glutin_egl_sys" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" -dependencies = [ - "gl_generator", - "windows-sys 0.52.0", -] - -[[package]] -name = "glutin_glx_sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" -dependencies = [ - "gl_generator", - "x11-dl", -] - -[[package]] -name = "glutin_wgl_sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" -dependencies = [ - "gl_generator", -] - -[[package]] -name = "gpu-alloc" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45cf04b2726f02df5508c6de726acdc90cdf97ac771a9a0ffd8ba10a6e696bf9" -dependencies = [ - "bitflags 2.13.2", - "gpu-alloc-types", -] - -[[package]] -name = "gpu-alloc-types" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2bbed164dd10ed526c2e4fe3e721ca4a71c61730e5aafac6844b417b3227058" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "gpu-allocator" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" -dependencies = [ - "log", - "presser", - "thiserror 1.0.69", - "windows 0.58.0", -] - -[[package]] -name = "gpu-descriptor" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" -dependencies = [ - "bitflags 2.13.2", - "gpu-descriptor-types", - "hashbrown 0.15.5", -] - -[[package]] -name = "gpu-descriptor-types" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "half" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" -dependencies = [ - "cfg-if", - "crunchy", - "num-traits", - "zerocopy", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "allocator-api2", -] - -[[package]] -name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "foldhash 0.1.5", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" -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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] - -[[package]] -name = "hex_color" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37f101bf4c633f7ca2e4b5e136050314503dd198e78e325ea602c327c484ef0" -dependencies = [ - "arrayvec", - "rand 0.8.8", - "serde", -] - -[[package]] -name = "hexf-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" - -[[package]] -name = "hotwatch" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9140219159163c92eb58c37955a0cc57c5814c3c44521955aae376064c668756" -dependencies = [ - "log", - "notify", - "notify-debouncer-full", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core 0.62.2", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "icu_collections" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" - -[[package]] -name = "icu_properties" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" - -[[package]] -name = "icu_provider" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "image" -version = "0.23.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "gif", - "jpeg-decoder", - "num-iter", - "num-rational", - "num-traits", - "png 0.16.8", - "scoped_threadpool", - "tiff 0.6.1", -] - -[[package]] -name = "image" -version = "0.25.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" -dependencies = [ - "bytemuck", - "byteorder-lite", - "moxcms", - "num-traits", - "png 0.18.1", - "tiff 0.11.3", -] - -[[package]] -name = "indenter" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" -dependencies = [ - "equivalent", - "hashbrown 0.17.1", - "serde", - "serde_core", -] - -[[package]] -name = "inotify" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c033f80b2c113cdf91ab7a33faa9cbc014726dcad99880c8609af2a370edf37d" -dependencies = [ - "libc", -] - -[[package]] -name = "is_debug" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fe266d2e243c931d8190177f20bf7f24eed45e96f39e87dc49a27b32d12d407" - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" - -[[package]] -name = "itoa" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" - -[[package]] -name = "jiff" -version = "0.2.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383" -dependencies = [ - "defmt", - "jiff-core", - "jiff-static", - "jiff-tzdb-platform", - "log", - "portable-atomic", - "portable-atomic-util", - "serde_core", - "windows-link 0.2.1", -] - -[[package]] -name = "jiff-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c" -dependencies = [ - "defmt", - "log", -] - -[[package]] -name = "jiff-static" -version = "0.2.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c" -dependencies = [ - "jiff-core", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "jiff-tzdb" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8377070c6bae868759445e5a77f66d84f0b72f3a054bfb00e6d038b8282da7" - -[[package]] -name = "jiff-tzdb-platform" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" -dependencies = [ - "jiff-tzdb", -] - -[[package]] -name = "jni" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" -dependencies = [ - "cfg-if", - "combine", - "jni-macros", - "jni-sys 0.4.1", - "log", - "simd_cesu8", - "thiserror 2.0.21", - "walkdir", - "windows-link 0.2.1", -] - -[[package]] -name = "jni-macros" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "simd_cesu8", - "syn 2.0.119", -] - -[[package]] -name = "jni-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" -dependencies = [ - "jni-sys 0.4.1", -] - -[[package]] -name = "jni-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" -dependencies = [ - "jni-sys-macros", -] - -[[package]] -name = "jni-sys-macros" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" -dependencies = [ - "quote", - "syn 2.0.119", -] - -[[package]] -name = "jobserver" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" -dependencies = [ - "getrandom 0.4.3", - "libc", -] - -[[package]] -name = "jpeg-decoder" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" -dependencies = [ - "rayon", -] - -[[package]] -name = "js-sys" -version = "0.3.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" -dependencies = [ - "cfg-if", - "futures-util", - "wasm-bindgen", -] - -[[package]] -name = "khronos-egl" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" -dependencies = [ - "libc", - "libloading", - "pkg-config", -] - -[[package]] -name = "khronos_api" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" - -[[package]] -name = "komorebi" -version = "0.1.0" -dependencies = [ - "clap", - "color-eyre", - "crossbeam-channel", - "crossbeam-utils", - "ctrlc", - "dirs 7.0.0", - "futures-util", - "hotwatch", - "komorebi-backend", - "komorebi-collections", - "komorebi-config", - "komorebi-core", - "komorebi-hotkeys", - "komorebi-layouts", - "komorebi-protocol", - "komorebi-scrolling", - "komorebi-themes", - "komorebi-transport", - "lazy_static", - "nanoid", - "parking_lot 0.13.0", - "pastey", - "regex", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "serde_with", - "strum", - "tokio", - "tracing", - "tracing-appender", - "tracing-subscriber", - "uuid", - "version", - "zbus 6.1.0", -] - -[[package]] -name = "komorebi-backend" -version = "0.1.42" -dependencies = [ - "komorebi-layouts", -] - -[[package]] -name = "komorebi-client" -version = "0.1.0" -dependencies = [ - "komorebi", - "komorebi-themes", - "parking_lot 0.13.0", - "serde_json_lenient", -] - -[[package]] -name = "komorebi-collections" -version = "0.1.42" -dependencies = [ - "pastey", - "schemars 1.2.3", - "serde", -] - -[[package]] -name = "komorebi-config" -version = "0.1.42" -dependencies = [ - "clap", - "color-eyre", - "komorebi-layouts", - "komorebi-protocol", - "komorebi-themes", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "serde_with", - "strum", -] - -[[package]] -name = "komorebi-core" -version = "0.1.42" -dependencies = [ - "color-eyre", - "komorebi-collections", - "komorebi-config", - "komorebi-layouts", - "komorebi-scrolling", - "nanoid", - "schemars 1.2.3", - "serde", - "tracing", -] - -[[package]] -name = "komorebi-hotkeys" -version = "0.1.0" -dependencies = [ - "whkd-parser", -] - -[[package]] -name = "komorebi-layouts" -version = "0.1.42" -dependencies = [ - "clap", - "color-eyre", - "komorebi-scrolling", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "serde_yaml 0.9.34+deprecated", - "strum", - "tracing", -] - -[[package]] -name = "komorebi-protocol" -version = "0.1.42" -dependencies = [ - "clap", - "color-eyre", - "komorebi-layouts", - "komorebi-themes", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "serde_with", - "strum", -] - -[[package]] -name = "komorebi-scrolling" -version = "0.1.42" - -[[package]] -name = "komorebi-themes" -version = "0.1.42" -dependencies = [ - "base16-egui-themes", - "catppuccin-egui", - "eframe", - "flavours", - "hex_color", - "schemars 1.2.3", - "serde", - "serde_variant", - "strum", -] - -[[package]] -name = "komorebi-transport" -version = "0.1.42" -dependencies = [ - "color-eyre", - "crossbeam-channel", - "komorebi-protocol", - "tracing", - "uds_windows", -] - -[[package]] -name = "komorebic" -version = "0.1.0" -dependencies = [ - "chrono", - "clap", - "clap_complete", - "color-eyre", - "dirs 7.0.0", - "fs-tail", - "komorebi", - "komorebi-client", - "komorebi-config", - "komorebi-hotkeys", - "komorebic-core", - "lazy_static", - "schemars 1.2.3", - "serde_json_lenient", - "sysinfo", - "version", -] - -[[package]] -name = "komorebic-core" -version = "0.1.42" -dependencies = [ - "clap", - "clap_complete", - "color-eyre", - "komorebi-layouts", - "komorebi-protocol", -] - -[[package]] -name = "konst" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128133ed7824fcd73d6e7b17957c5eb7bacb885649bd8c69708b2331a10bcefb" -dependencies = [ - "konst_macro_rules", -] - -[[package]] -name = "konst_macro_rules" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37" - -[[package]] -name = "kqueue" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d763e5b24120b4ddf50de6c92308156765aabfbbccebf401da7cff2d70a41ea" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087" -dependencies = [ - "bitflags 2.13.2", - "libc", -] - -[[package]] -name = "lazy_static" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" - -[[package]] -name = "libc" -version = "0.2.191" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" - -[[package]] -name = "libgit2-sys" -version = "0.18.8+1.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7c568b25d7489bc3fb2988ed69ab111d2944d2f5fec3d5c987fe545ea97b50" -dependencies = [ - "cc", - "libc", - "libz-sys", - "pkg-config", -] - -[[package]] -name = "libloading" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" -dependencies = [ - "cfg-if", - "windows-link 0.2.1", -] - -[[package]] -name = "libm" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" - -[[package]] -name = "libredox" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" -dependencies = [ - "bitflags 2.13.2", - "libc", - "plain", - "redox_syscall 0.9.5", -] - -[[package]] -name = "libz-sys" -version = "1.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff20308ecabd635a2dc1dd5834a86c462cca20efba1d5d3ddab1f8aea3455cb2" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - -[[package]] -name = "linux-raw-sys" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" - -[[package]] -name = "litemap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" - -[[package]] -name = "litrs" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" - -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "lock_api" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65d91b22da179613dcf4d6ec8349563f52a363f6849e03b00dd0a185ec4a59af" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" - -[[package]] -name = "logos" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7251356ef8cb7aec833ddf598c6cb24d17b689d20b993f9d11a3d764e34e6458" -dependencies = [ - "logos-derive", -] - -[[package]] -name = "logos-codegen" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f80069600c0d66734f5ff52cc42f2dabd6b29d205f333d61fd7832e9e9963f" -dependencies = [ - "beef", - "fnv", - "lazy_static", - "proc-macro2", - "quote", - "regex-syntax", - "syn 2.0.119", -] - -[[package]] -name = "logos-derive" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fb722b06a9dc12adb0963ed585f19fc61dc5413e6a9be9422ef92c091e731d" -dependencies = [ - "logos-codegen", -] - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - -[[package]] -name = "matchers" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "memchr" -version = "2.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" - -[[package]] -name = "memmap2" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - -[[package]] -name = "metal" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" -dependencies = [ - "bitflags 2.13.2", - "block", - "core-graphics-types 0.2.0", - "foreign-types", - "log", - "objc", - "paste", -] - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -dependencies = [ - "adler32", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "miniz_oxide" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - -[[package]] -name = "mio" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.61.2", -] - -[[package]] -name = "moxcms" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" -dependencies = [ - "num-traits", - "pxfm", -] - -[[package]] -name = "naga" -version = "27.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" -dependencies = [ - "arrayvec", - "bit-set", - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "codespan-reporting", - "half", - "hashbrown 0.16.1", - "hexf-parse", - "indexmap 2.14.2", - "libm", - "log", - "num-traits", - "once_cell", - "rustc-hash 1.1.0", - "spirv", - "thiserror 2.0.21", - "unicode-ident", -] - -[[package]] -name = "nanoid" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8628de41fe064cc3f0cf07f3d299ee3e73521adaff72278731d5c8cae3797873" -dependencies = [ - "rand 0.9.5", -] - -[[package]] -name = "ndk" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" -dependencies = [ - "bitflags 2.13.2", - "jni-sys 0.3.1", - "log", - "ndk-sys", - "num_enum", - "raw-window-handle", - "thiserror 1.0.69", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-sys" -version = "0.6.0+11769913" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" -dependencies = [ - "jni-sys 0.3.1", -] - -[[package]] -name = "nix" -version = "0.31.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" -dependencies = [ - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "notify" -version = "6.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" -dependencies = [ - "bitflags 2.13.2", - "crossbeam-channel", - "filetime", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "log", - "mio 0.8.11", - "walkdir", - "windows-sys 0.48.0", -] - -[[package]] -name = "notify-debouncer-full" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4812c1eb49be776fb8df4961623bdc01ec9dfdc1abe8211ceb09150a2e64219" -dependencies = [ - "crossbeam-channel", - "file-id", - "notify", - "parking_lot 0.12.5", - "walkdir", -] - -[[package]] -name = "ntapi" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" -dependencies = [ - "winapi", -] - -[[package]] -name = "nu-ansi-term" -version = "0.50.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "num-conv" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" - -[[package]] -name = "num-integer" -version = "0.1.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_enum" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" -dependencies = [ - "num_enum_derive", - "rustversion", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - -[[package]] -name = "objc-sys" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" - -[[package]] -name = "objc2" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" -dependencies = [ - "objc-sys", - "objc2-encode", -] - -[[package]] -name = "objc2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" -dependencies = [ - "objc2-encode", -] - -[[package]] -name = "objc2-app-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "libc", - "objc2 0.5.3", - "objc2-core-data", - "objc2-core-image", - "objc2-foundation 0.2.2", - "objc2-quartz-core", -] - -[[package]] -name = "objc2-app-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-cloud-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-core-location", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-contacts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-core-data" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-core-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" -dependencies = [ - "bitflags 2.13.2", - "dispatch2", - "objc2 0.6.5", -] - -[[package]] -name = "objc2-core-graphics" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" -dependencies = [ - "bitflags 2.13.2", - "dispatch2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-io-surface", -] - -[[package]] -name = "objc2-core-image" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", - "objc2-metal", -] - -[[package]] -name = "objc2-core-location" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-contacts", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-encode" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" - -[[package]] -name = "objc2-foundation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "dispatch", - "libc", - "objc2 0.5.3", -] - -[[package]] -name = "objc2-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-io-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" -dependencies = [ - "libc", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-io-surface" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-link-presentation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-metal" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-open-directory" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb82bed227edf5201dfedf072bba4015a33d3d4a98519837295a90f0a23f676d" -dependencies = [ - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-quartz-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", - "objc2-metal", -] - -[[package]] -name = "objc2-symbols" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" -dependencies = [ - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-ui-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-cloud-kit", - "objc2-core-data", - "objc2-core-image", - "objc2-core-location", - "objc2-foundation 0.2.2", - "objc2-link-presentation", - "objc2-quartz-core", - "objc2-symbols", - "objc2-uniform-type-identifiers", - "objc2-user-notifications", -] - -[[package]] -name = "objc2-uniform-type-identifiers" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-user-notifications" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-core-location", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "object" -version = "0.39.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" -dependencies = [ - "memchr", -] - -[[package]] -name = "object" -version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "once_cell_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - -[[package]] -name = "orbclient" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" -dependencies = [ - "libc", - "libredox", -] - -[[package]] -name = "ordered-float" -version = "5.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f59006ce1e204c30956638535b74d317bca99477b9356dfaec54c37f6f600ab" -dependencies = [ - "num-traits", -] - -[[package]] -name = "ordered-stream" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" -dependencies = [ - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "owned_ttf_parser" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" -dependencies = [ - "ttf-parser", -] - -[[package]] -name = "owo-colors" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c45bb4a6ae1280ec0803b1ef9d3455eb50f01efbbe1447ab020f1d54fba9d8" - -[[package]] -name = "palette" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddeed8580d347d2abf3dcf06a5f0b3dc020258338526b277847cd4248a70fc64" -dependencies = [ - "approx", - "palette_derive", - "palette_math", - "phf", -] - -[[package]] -name = "palette_derive" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88537020289b719d81be994ccf1bbf4990f477e2f69ee52fe3e45f43a02e56be" -dependencies = [ - "by_address", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "palette_math" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e6eb142958d64335fb0e345c5b9ead2ecd6fc438c307e9d7d3c4fd428dbaf12" - -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - -[[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api 0.4.14", - "parking_lot_core 0.9.12", -] - -[[package]] -name = "parking_lot" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9cf937ca4e1d0b7578784559063422fc39ae7c5a00f02471f2614d5486fd226" -dependencies = [ - "lock_api 0.5.0", - "parking_lot_core 0.10.0", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.5.18", - "smallvec", - "windows-link 0.2.1", -] - -[[package]] -name = "parking_lot_core" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cfff060068cc18aa7815010fcaf80c68c7fb9e85fc7f5c0f9bf142c21d19826" -dependencies = [ - "backtrace", - "libc", - "petgraph", - "redox_syscall 0.9.5", - "smallvec", - "windows-link 0.2.1", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pastey" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "petgraph" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" -dependencies = [ - "fixedbitset", - "hashbrown 0.15.5", - "indexmap 2.14.2", - "serde", -] - -[[package]] -name = "phf" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" -dependencies = [ - "phf_shared", -] - -[[package]] -name = "phf_shared" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" - -[[package]] -name = "piper" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - -[[package]] -name = "pkg-config" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" - -[[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" - -[[package]] -name = "png" -version = "0.16.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "deflate", - "miniz_oxide 0.3.7", -] - -[[package]] -name = "png" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" -dependencies = [ - "bitflags 2.13.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide 0.8.9", -] - -[[package]] -name = "polling" -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" -dependencies = [ - "cfg-if", - "concurrent-queue", - "hermit-abi", - "pin-project-lite", - "rustix 1.1.6", - "windows-sys 0.61.2", -] - -[[package]] -name = "portable-atomic" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" - -[[package]] -name = "portable-atomic-util" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "potential_utf" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" -dependencies = [ - "zerovec", -] - -[[package]] -name = "powerfmt" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "presser" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" - -[[package]] -name = "proc-macro-crate" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" -dependencies = [ - "toml_edit", -] - -[[package]] -name = "proc-macro2" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "profiling" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" - -[[package]] -name = "psm" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622" -dependencies = [ - "ar_archive_writer", - "cc", -] - -[[package]] -name = "pxfm" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" - -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - -[[package]] -name = "quick-xml" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" -dependencies = [ - "memchr", -] - -[[package]] -name = "quote" -version = "1.0.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -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 = "ramhorns" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d64e28e1069d26c22d4f085ca7f9e2e2eaee16f9d6f80e5fdce62cbf8670f" -dependencies = [ - "arrayvec", - "beef", - "fnv", - "logos", -] - -[[package]] -name = "rand" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" -dependencies = [ - "rand_chacha 0.9.0", - "rand_core 0.9.5", -] - -[[package]] -name = "rand" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" -dependencies = [ - "chacha20", - "getrandom 0.4.3", - "rand_core 0.10.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core 0.9.5", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] - -[[package]] -name = "rand_core" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" -dependencies = [ - "getrandom 0.3.4", -] - -[[package]] -name = "rand_core" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" - -[[package]] -name = "range-alloc" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" - -[[package]] -name = "raw-window-handle" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" - -[[package]] -name = "rayon" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "redox_syscall" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom 0.2.17", - "libredox", - "thiserror 1.0.69", -] - -[[package]] -name = "redox_users" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" -dependencies = [ - "libredox", - "thiserror 2.0.21", -] - -[[package]] -name = "ref-cast" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "regex" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" - -[[package]] -name = "renderdoc-sys" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" - -[[package]] -name = "rgb" -version = "0.8.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hash" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags 2.13.2", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustix" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" -dependencies = [ - "bitflags 2.13.2", - "errno", - "libc", - "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustversion" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" - -[[package]] -name = "ryu" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schemars" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" -dependencies = [ - "dyn-clone", - "ref-cast", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 3.0.9", -] - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sctk-adwaita" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" -dependencies = [ - "ab_glyph", - "log", - "memmap2", - "smithay-client-toolkit 0.19.2", - "tiny-skia", -] - -[[package]] -name = "semver" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" - -[[package]] -name = "serde" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_derive_internals" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_json" -version = "1.0.154" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "serde_json_lenient" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e033097bf0d2b59a62b42c18ebbb797503839b26afdda2c4e1415cb6c813540" -dependencies = [ - "indexmap 2.14.2", - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_repr" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_variant" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0068df419f9d9b6488fdded3f1c818522cdea328e02ce9d9f147380265a432" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_with" -version = "3.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9adc193c780ef8f159aee8b61e2d5801aaa555e6eb0947fe45530ec506296f" -dependencies = [ - "base64", - "bs58", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.14.2", - "jiff", - "schemars 0.9.0", - "schemars 1.2.3", - "serde_core", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17bbc68e28663bbbb90df47e058aa7eda4fb445b89fe70457bb94fbccf6e49" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_yaml" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" -dependencies = [ - "indexmap 1.9.3", - "ryu", - "serde", - "yaml-rust", -] - -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap 2.14.2", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "shadow-rs" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd39b4b2077bd36e60ca28c31d494046e747759cb9b507a7d177bb64787c39e" -dependencies = [ - "const_format", - "git2", - "is_debug", - "jiff", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shell-words" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" - -[[package]] -name = "shellexpand" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" -dependencies = [ - "dirs 4.0.0", -] - -[[package]] -name = "shlex" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] -name = "simd-adler32" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" - -[[package]] -name = "simd_cesu8" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" -dependencies = [ - "rustc_version", - "simdutf8", -] - -[[package]] -name = "simdutf8" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" - -[[package]] -name = "siphasher" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "slotmap" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" -dependencies = [ - "version_check", -] - -[[package]] -name = "smallvec" -version = "1.16.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" - -[[package]] -name = "smithay-client-toolkit" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" -dependencies = [ - "bitflags 2.13.2", - "calloop 0.13.0", - "calloop-wayland-source 0.3.0", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix 0.38.44", - "thiserror 1.0.69", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-wlr", - "wayland-scanner", - "xkeysym", -] - -[[package]] -name = "smithay-client-toolkit" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" -dependencies = [ - "bitflags 2.13.2", - "calloop 0.14.5", - "calloop-wayland-source 0.4.1", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix 1.1.6", - "thiserror 2.0.21", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-experimental", - "wayland-protocols-misc", - "wayland-protocols-wlr", - "wayland-scanner", - "xkeysym", -] - -[[package]] -name = "smithay-clipboard" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" -dependencies = [ - "libc", - "smithay-client-toolkit 0.20.0", - "wayland-backend", -] - -[[package]] -name = "smol_str" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" -dependencies = [ - "serde", -] - -[[package]] -name = "socket2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "spirv" -version = "0.3.0+sdk-1.3.268.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "stacker" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967" -dependencies = [ - "cc", - "cfg-if", - "libc", - "psm", - "windows-sys 0.61.2", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strict-num" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "strum" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" -dependencies = [ - "strum_macros", -] - -[[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.119", -] - -[[package]] -name = "symlink" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.119" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "3.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "sysinfo" -version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "110e37d98880fd804cd47509b90a8444f7aaaab655ae625e83cd442a8bc2ebf2" -dependencies = [ - "libc", - "memchr", - "ntapi", - "objc2-core-foundation", - "objc2-io-kit", - "objc2-open-directory", - "windows 0.62.2", -] - -[[package]] -name = "tempfile" -version = "3.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" -dependencies = [ - "fastrand", - "getrandom 0.4.3", - "once_cell", - "rustix 1.1.6", - "windows-sys 0.61.2", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "terminal_size" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" -dependencies = [ - "rustix 1.1.6", - "windows-sys 0.61.2", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" -dependencies = [ - "thiserror-impl 2.0.21", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "thread_local" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "tiff" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437" -dependencies = [ - "jpeg-decoder", - "miniz_oxide 0.4.4", - "weezl", -] - -[[package]] -name = "tiff" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" -dependencies = [ - "fax", - "flate2", - "half", - "quick-error", - "weezl", - "zune-jpeg", -] - -[[package]] -name = "time" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" -dependencies = [ - "deranged", - "num-conv", - "powerfmt", - "serde_core", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" - -[[package]] -name = "time-macros" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tiny-skia" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" -dependencies = [ - "arrayref", - "arrayvec", - "bytemuck", - "cfg-if", - "log", - "tiny-skia-path", -] - -[[package]] -name = "tiny-skia-path" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" -dependencies = [ - "arrayref", - "bytemuck", - "strict-num", -] - -[[package]] -name = "tinystr" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tinyvec" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" - -[[package]] -name = "tokio" -version = "1.54.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" -dependencies = [ - "bytes", - "libc", - "mio 1.2.4", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-macros" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_datetime" -version = "1.1.2+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_edit" -version = "0.25.17+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" -dependencies = [ - "indexmap 2.14.2", - "toml_datetime", - "toml_parser", - "winnow", -] - -[[package]] -name = "toml_parser" -version = "1.1.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" -dependencies = [ - "winnow", -] - -[[package]] -name = "tracing" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-appender" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "050686193eb999b4bb3bc2acfa891a13da00f79734704c4b8b4ef1a10b368a3c" -dependencies = [ - "crossbeam-channel", - "symlink", - "thiserror 2.0.21", - "time", - "tracing-subscriber", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-error" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" -dependencies = [ - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex-automata", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "ttf-parser" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" - -[[package]] -name = "type-map" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" -dependencies = [ - "rustc-hash 2.1.3", -] - -[[package]] -name = "uds_windows" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" -dependencies = [ - "memoffset", - "tempfile", - "windows-sys 0.61.2", -] - -[[package]] -name = "unicode-ident" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" - -[[package]] -name = "unicode-segmentation" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" - -[[package]] -name = "unicode-width" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "uuid" -version = "1.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" -dependencies = [ - "getrandom 0.4.3", - "js-sys", - "serde_core", - "wasm-bindgen", -] - -[[package]] -name = "valuable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version" -version = "0.1.0" -dependencies = [ - "shadow-rs", -] - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" -dependencies = [ - "js-sys", - "tokio", - "wasm-bindgen", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn 3.0.9", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wayland-backend" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" -dependencies = [ - "cc", - "downcast-rs", - "rustix 1.1.6", - "scoped-tls", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-client" -version = "0.31.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" -dependencies = [ - "bitflags 2.13.2", - "rustix 1.1.6", - "wayland-backend", - "wayland-scanner", -] - -[[package]] -name = "wayland-csd-frame" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" -dependencies = [ - "bitflags 2.13.2", - "cursor-icon", - "wayland-backend", -] - -[[package]] -name = "wayland-cursor" -version = "0.31.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" -dependencies = [ - "rustix 1.1.6", - "wayland-client", - "xcursor", -] - -[[package]] -name = "wayland-protocols" -version = "0.32.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-experimental" -version = "20250721.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-misc" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-plasma" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-wlr" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.31.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" -dependencies = [ - "proc-macro2", - "quick-xml", - "quote", -] - -[[package]] -name = "wayland-sys" -version = "0.31.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" -dependencies = [ - "dlib", - "log", - "once_cell", - "pkg-config", -] - -[[package]] -name = "web-sys" -version = "0.3.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webbrowser" -version = "1.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c8ddfbbf66e501434657400268cefe51b95140a0266236415cda7627732df7" -dependencies = [ - "jni", - "log", - "ndk-context", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", - "url", - "web-sys", -] - -[[package]] -name = "weezl" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" - -[[package]] -name = "wgpu" -version = "27.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" -dependencies = [ - "arrayvec", - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "document-features", - "hashbrown 0.16.1", - "js-sys", - "log", - "naga", - "parking_lot 0.12.5", - "portable-atomic", - "profiling", - "raw-window-handle", - "smallvec", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-core" -version = "27.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7" -dependencies = [ - "arrayvec", - "bit-set", - "bit-vec", - "bitflags 2.13.2", - "bytemuck", - "cfg_aliases", - "document-features", - "hashbrown 0.16.1", - "indexmap 2.14.2", - "log", - "naga", - "once_cell", - "parking_lot 0.12.5", - "portable-atomic", - "profiling", - "raw-window-handle", - "rustc-hash 1.1.0", - "smallvec", - "thiserror 2.0.21", - "wgpu-core-deps-apple", - "wgpu-core-deps-emscripten", - "wgpu-core-deps-windows-linux-android", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-core-deps-apple" -version = "27.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-emscripten" -version = "27.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06ac3444a95b0813ecfd81ddb2774b66220b264b3e2031152a4a29fda4da6b5" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-windows-linux-android" -version = "27.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-hal" -version = "27.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce" -dependencies = [ - "android_system_properties", - "arrayvec", - "ash", - "bit-set", - "bitflags 2.13.2", - "block", - "bytemuck", - "cfg-if", - "cfg_aliases", - "core-graphics-types 0.2.0", - "glow", - "glutin_wgl_sys", - "gpu-alloc", - "gpu-allocator", - "gpu-descriptor", - "hashbrown 0.16.1", - "js-sys", - "khronos-egl", - "libc", - "libloading", - "log", - "metal", - "naga", - "ndk-sys", - "objc", - "once_cell", - "ordered-float", - "parking_lot 0.12.5", - "portable-atomic", - "portable-atomic-util", - "profiling", - "range-alloc", - "raw-window-handle", - "renderdoc-sys", - "smallvec", - "thiserror 2.0.21", - "wasm-bindgen", - "web-sys", - "wgpu-types", - "windows 0.58.0", - "windows-core 0.58.0", -] - -[[package]] -name = "wgpu-types" -version = "27.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" -dependencies = [ - "bitflags 2.13.2", - "bytemuck", - "js-sys", - "log", - "thiserror 2.0.21", - "web-sys", -] - -[[package]] -name = "whkd-core" -version = "0.2.10" -source = "git+https://github.com/LGUG2Z/whkd?rev=v0.2.10#5d6a767f2ab7ac309686fe44ce59689546cf55fe" - -[[package]] -name = "whkd-parser" -version = "0.2.10" -source = "git+https://github.com/LGUG2Z/whkd?rev=v0.2.10#5d6a767f2ab7ac309686fe44ce59689546cf55fe" -dependencies = [ - "chumsky", - "thiserror 2.0.21", - "whkd-core", -] - -[[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.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" -dependencies = [ - "windows-core 0.58.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows" -version = "0.61.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" -dependencies = [ - "windows-collections 0.2.0", - "windows-core 0.61.2", - "windows-future 0.2.1", - "windows-link 0.1.3", - "windows-numerics 0.2.0", -] - -[[package]] -name = "windows" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" -dependencies = [ - "windows-collections 0.3.2", - "windows-core 0.62.2", - "windows-future 0.3.2", - "windows-numerics 0.3.1", -] - -[[package]] -name = "windows-collections" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" -dependencies = [ - "windows-core 0.61.2", -] - -[[package]] -name = "windows-collections" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" -dependencies = [ - "windows-core 0.62.2", -] - -[[package]] -name = "windows-core" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" -dependencies = [ - "windows-implement 0.58.0", - "windows-interface 0.58.0", - "windows-result 0.2.0", - "windows-strings 0.1.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement 0.60.2", - "windows-interface 0.59.3", - "windows-link 0.1.3", - "windows-result 0.3.4", - "windows-strings 0.4.2", -] - -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement 0.60.2", - "windows-interface 0.59.3", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - -[[package]] -name = "windows-future" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", - "windows-threading 0.1.0", -] - -[[package]] -name = "windows-future" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" -dependencies = [ - "windows-core 0.62.2", - "windows-link 0.2.1", - "windows-threading 0.2.1", -] - -[[package]] -name = "windows-implement" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-numerics" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", -] - -[[package]] -name = "windows-numerics" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" -dependencies = [ - "windows-core 0.62.2", - "windows-link 0.2.1", -] - -[[package]] -name = "windows-result" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-strings" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" -dependencies = [ - "windows-result 0.2.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-threading" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-threading" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winit" -version = "0.30.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" -dependencies = [ - "ahash", - "android-activity", - "atomic-waker", - "bitflags 2.13.2", - "block2 0.5.1", - "bytemuck", - "calloop 0.13.0", - "cfg_aliases", - "concurrent-queue", - "core-foundation 0.9.4", - "core-graphics", - "cursor-icon", - "dpi", - "js-sys", - "libc", - "memmap2", - "ndk", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", - "objc2-ui-kit", - "orbclient", - "percent-encoding", - "pin-project", - "raw-window-handle", - "redox_syscall 0.4.1", - "rustix 0.38.44", - "sctk-adwaita", - "smithay-client-toolkit 0.19.2", - "smol_str", - "tracing", - "unicode-segmentation", - "wasm-bindgen", - "wasm-bindgen-futures", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-plasma", - "web-sys", - "web-time", - "windows-sys 0.52.0", - "x11-dl", - "x11rb", - "xkbcommon-dl", -] - -[[package]] -name = "winnow" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" -dependencies = [ - "memchr", -] - -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - -[[package]] -name = "writeable" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" - -[[package]] -name = "x11-dl" -version = "2.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" -dependencies = [ - "libc", - "once_cell", - "pkg-config", -] - -[[package]] -name = "x11rb" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" -dependencies = [ - "as-raw-xcb-connection", - "gethostname", - "libc", - "libloading", - "once_cell", - "rustix 1.1.6", - "x11rb-protocol", -] - -[[package]] -name = "x11rb-protocol" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" - -[[package]] -name = "xcursor" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" - -[[package]] -name = "xkbcommon-dl" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" -dependencies = [ - "bitflags 2.13.2", - "dlib", - "log", - "once_cell", - "xkeysym", -] - -[[package]] -name = "xkeysym" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" - -[[package]] -name = "xml-rs" -version = "0.8.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "yoke" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", - "synstructure", -] - -[[package]] -name = "zbus" -version = "5.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" -dependencies = [ - "async-broadcast", - "async-executor", - "async-io", - "async-lock", - "async-process", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "enumflags2", - "event-listener", - "futures-core", - "futures-lite", - "hex", - "libc", - "ordered-stream", - "rustix 1.1.6", - "serde", - "serde_repr", - "tracing", - "uds_windows", - "uuid", - "windows-sys 0.61.2", - "winnow", - "zbus_macros 5.19.0", - "zbus_names", - "zvariant", -] - -[[package]] -name = "zbus" -version = "6.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcff5faa63a63d5b81051740f7382017f10b3440b3f401d97f0cf0b3b39c62d9" -dependencies = [ - "async-trait", - "bitflags 2.13.2", - "endi", - "futures-core", - "hex", - "libc", - "ordered-stream", - "rustix 1.1.6", - "serde", - "serde_repr", - "socket2", - "tokio", - "uds_windows", - "uuid", - "windows-sys 0.61.2", - "winnow", - "zbus_macros 6.1.0", - "zbus_utils", - "zcheapstr", - "zruntime", -] - -[[package]] -name = "zbus-lockstep" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" -dependencies = [ - "zbus_xml", - "zvariant", -] - -[[package]] -name = "zbus-lockstep-macros" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", - "zbus-lockstep", - "zbus_xml", - "zvariant", -] - -[[package]] -name = "zbus_macros" -version = "5.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.9", - "zbus_names", - "zvariant", - "zvariant_utils", -] - -[[package]] -name = "zbus_macros" -version = "6.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba6e2bfe19571dc81b3e0be9f8daec6e5422db3e2eea2e766a859553e7bd37" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", - "zbus_utils", -] - -[[package]] -name = "zbus_names" -version = "4.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" -dependencies = [ - "serde", - "winnow", - "zvariant", -] - -[[package]] -name = "zbus_utils" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27a055b114bd9fc3686e90f62bd1fe612d523fc5f620bac3b1d2f42d3f6cab8" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn 3.0.9", - "winnow", -] - -[[package]] -name = "zbus_xml" -version = "5.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" -dependencies = [ - "serde", - "winnow", - "zbus_names", - "zvariant", -] - -[[package]] -name = "zcheapstr" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" -dependencies = [ - "serde", -] - -[[package]] -name = "zerocopy" -version = "0.8.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "zerofrom" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", - "synstructure", -] - -[[package]] -name = "zerotrie" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "zlib-rs" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" - -[[package]] -name = "zmij" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" - -[[package]] -name = "zruntime" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc035df602243402949ddf3dcc5bcfad7edeb732dd49ec6e605431c4eca54ce" -dependencies = [ - "futures-core", - "futures-io", -] - -[[package]] -name = "zune-core" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" - -[[package]] -name = "zune-jpeg" -version = "0.5.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" -dependencies = [ - "zune-core", -] - -[[package]] -name = "zvariant" -version = "5.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" -dependencies = [ - "endi", - "enumflags2", - "serde", - "winnow", - "zcheapstr", - "zvariant_derive", - "zvariant_utils", -] - -[[package]] -name = "zvariant_derive" -version = "5.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.9", - "zvariant_utils", -] - -[[package]] -name = "zvariant_utils" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn 3.0.9", - "winnow", -] diff --git a/komorebi-for-kde/Cargo.toml b/komorebi-for-kde/Cargo.toml deleted file mode 100644 index 51da8441..00000000 --- a/komorebi-for-kde/Cargo.toml +++ /dev/null @@ -1,56 +0,0 @@ -[workspace] - -resolver = "2" -members = [ - "komorebi", - "komorebi-client", - "komorebi-hotkeys", - "komorebic", - "version", -] - -[workspace.package] -version = "0.1.0" - -[workspace.dependencies] -# the Backend trait every komorebi shares, and its in-memory fake -komorebi-backend = { path = "../crates/komorebi-backend" } -# upstream's layouts, at a revision of its `next` branch that has the fix for resizing a tile by -# dragging its edge (LGUG2Z/komorebi#1765), the placement helpers komorebi for KDE uses and the -# platform-free half of the rework of the Scrolling layout -komorebi-collections = { path = "../crates/komorebi-collections" } -# the model shared with the other komorebi daemons -komorebi-core = { path = "../crates/komorebi-core" } -komorebi-layouts = { path = "../komorebi-layouts", features = [ - "schemars", -] } -# the model of a strip of columns that the Scrolling layout is laid out with, from the same -# revision, whose layouts re-export it as `komorebi_layouts::scrolling::model` -komorebi-scrolling = { path = "../komorebi-scrolling" } -# the wire types shared with the other komorebi daemons -komorebi-config = { path = "../crates/komorebi-config", default-features = false, features = ["schemars"] } -komorebi-protocol = { path = "../crates/komorebi-protocol", default-features = false, features = ["schemars"] } -komorebi-transport = { path = "../crates/komorebi-transport" } -# the themes (and the palettes made from pictures), from the same upstream revision -komorebi-themes = { path = "../komorebi-themes" } - -chrono = "0.4" -clap = { version = "4", features = ["derive", "wrap_help"] } -color-eyre = "0.6" -crossbeam-channel = "0.5" -crossbeam-utils = "0.8" -dirs = "7" -hotwatch = "0.5" -lazy_static = "1" -pastey = "0.2" -schemars = "1.1" -serde = { version = "1", features = ["derive"] } -serde_json = { package = "serde_json_lenient", version = "0.2" } -shadow-rs = "2" -sysinfo = "0.40" -tracing = "0.1" -tracing-appender = "0.2" -tracing-subscriber = { version = "0.3", features = ["env-filter"] } - -[workspace.metadata.crane] -name = "komorebi-workspace" diff --git a/komorebi-for-kde/deny.toml b/komorebi-for-kde/deny.toml index 1ae68c4e..4439b6a0 100644 --- a/komorebi-for-kde/deny.toml +++ b/komorebi-for-kde/deny.toml @@ -39,12 +39,12 @@ allow = [ confidence-threshold = 0.8 [[licenses.clarify]] -crate = "komorebi" +crate = "komorebi-linux" expression = "LicenseRef-Komorebi-2.0" license-files = [] [[licenses.clarify]] -crate = "komorebi-client" +crate = "komorebi-client-linux" expression = "LicenseRef-Komorebi-2.0" license-files = [] @@ -64,7 +64,7 @@ expression = "LicenseRef-Komorebi-2.0" license-files = [] [[licenses.clarify]] -crate = "komorebic" +crate = "komorebic-linux" expression = "LicenseRef-Komorebi-2.0" license-files = [] @@ -74,7 +74,7 @@ expression = "LicenseRef-Komorebi-2.0" license-files = [] [[licenses.clarify]] -crate = "version" +crate = "version-linux" expression = "LicenseRef-Komorebi-2.0" license-files = [] diff --git a/komorebi-for-kde/flake.nix b/komorebi-for-kde/flake.nix index ea34b59a..f60290e3 100644 --- a/komorebi-for-kde/flake.nix +++ b/komorebi-for-kde/flake.nix @@ -36,12 +36,10 @@ crane rust-overlay ; - rootCrates = [ - "crates" - "komorebi-layouts" - "komorebi-scrolling" - "komorebi-themes" - ]; + # the crates of the root workspace that this workspace depends on, by path, directly or not. + # Only these are in the source, so that an edit of another crate (the bar's) changes nothing + # here. `tools/kde-closure-check` fails if this list and `cargo metadata` differ. + rootCrates = builtins.fromJSON (builtins.readFile ./nix/root-crates.json); mkPkgs = system: import nixpkgs { @@ -62,7 +60,7 @@ # the repository, cut down to this workspace and the crates of the root workspace it depends # on by path (komorebi-layouts and what they depend on, komorebi-themes), with the root # manifest those crates inherit their dependencies from - src = pkgs.lib.cleanSourceWith { + real = pkgs.lib.cleanSourceWith { src = repoRoot; filter = path: type: @@ -73,8 +71,34 @@ rootCrate = builtins.any ( crate: relative == crate || pkgs.lib.hasPrefix "${crate}/" relative ) rootCrates; + # the directory that holds the crates of crates/, to reach the listed ones + rootCrateParent = relative == "crates"; + # the unified komorebic package: its manifest, build script, main and the Linux module + # and tests; not the Windows and macOS files + komorebic = + builtins.elem relative [ + "komorebic" + "komorebic/Cargo.toml" + "komorebic/build.rs" + "komorebic/src" + "komorebic/src/main.rs" + "komorebic/tests" + ] + || pkgs.lib.hasPrefix "komorebic/src/linux" relative + || pkgs.lib.hasPrefix "komorebic/tests/linux_" relative; + # the unified komorebi-client package: its manifest, lib.rs, the Linux module and tests + komorebiClient = + builtins.elem relative [ + "komorebi-client" + "komorebi-client/Cargo.toml" + "komorebi-client/src" + "komorebi-client/src/lib.rs" + "komorebi-client/src/linux.rs" + "komorebi-client/tests" + ] + || pkgs.lib.hasPrefix "komorebi-client/tests/linux_" relative; in - (rootCrate && !(pkgs.lib.hasSuffix "/Cargo.lock" path) || relative == "Cargo.toml" || inTree) + ((rootCrate || rootCrateParent || komorebic || komorebiClient) && !(pkgs.lib.hasSuffix "/Cargo.lock" path) || relative == "Cargo.toml" || relative == "Cargo.lock" || inTree) && # the VM tests (their library, scripts and the states they keep) are not built, so # editing one does not change the source the daemon is built from @@ -98,17 +122,32 @@ ); }; - # the workspace is in a subdirectory of the source, next to the crates it depends on + # the platform is a part of the one workspace of the repository: cargo loads every member (the + # others are stubs, see nix/workspace-src.nix) and is told which packages are this platform's + src = import (repoRoot + "/nix/workspace-src.nix") { + inherit pkgs repoRoot real; + isReal = + member: + pkgs.lib.hasPrefix "${platformDir}/" member + || member == "komorebic" + || member == "komorebi-client" + || builtins.any (crate: member == crate || pkgs.lib.hasPrefix "${crate}/" member) rootCrates; + }; + packages = "-p komorebi-linux -p komorebic -p komorebi-client -p komorebi-hotkeys"; workspaceArgs = { - cargoLock = "${src}/${platformDir}/Cargo.lock"; - cargoToml = "${src}/${platformDir}/Cargo.toml"; - postUnpack = "cd $sourceRoot/${platformDir}; sourceRoot=$PWD"; + pname = "komorebi-workspace"; + version = (builtins.fromTOML (builtins.readFile ./komorebi/Cargo.toml)).package.version; + cargoLock = "${real}/Cargo.lock"; + cargoToml = "${real}/Cargo.toml"; + # vendored from the filtered source, not the stubbed one: no build is needed to evaluate + cargoVendorDir = craneLib.vendorCargoDeps { src = real; }; }; commonArgs = workspaceArgs // { + cargoExtraArgs = "--locked ${packages}"; inherit src; pname = "komorebi-workspace"; - version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version; + version = (builtins.fromTOML (builtins.readFile ./komorebi/Cargo.toml)).package.version; strictDeps = true; # The version crate wants a commit at compile time. It is a constant here, so that the # dependencies and every check are the same derivations for every commit; only the final @@ -148,7 +187,9 @@ craneLib craneLibFmt src + real workspaceArgs + packages commonArgs individualCrateArgs fullBuild @@ -277,20 +318,20 @@ checks = { komorebi-workspace-fmt = build.craneLibFmt.cargoFmt ( - build.workspaceArgs // { inherit (build) src; } + build.workspaceArgs // { inherit (build) src; cargoExtraArgs = build.packages; } ); komorebi-workspace-clippy = build.craneLib.cargoClippy ( build.individualCrateArgs // { - cargoClippyExtraArgs = "--workspace --all-targets -- -D warnings"; + cargoClippyExtraArgs = "--all-targets -- -D warnings"; } ); komorebi-workspace-doc = build.craneLib.cargoDoc ( build.individualCrateArgs // { - cargoDocExtraArgs = "--workspace --no-deps"; + cargoDocExtraArgs = "--no-deps"; env.RUSTDOCFLAGS = "-D warnings"; } ); @@ -298,12 +339,34 @@ komorebi-workspace-toml-fmt = build.craneLib.taploFmt ( build.workspaceArgs // { - src = lib.sources.sourceFilesBySuffices build.src [ ".toml" ]; + src = lib.sources.sourceFilesBySuffices build.real [ ".toml" ]; } ); + # cargo deny sees every member of the workspace: leave out the other platforms' packages + # and use this tree's policy komorebi-workspace-deny = build.craneLib.cargoDeny ( - build.workspaceArgs // { inherit (build) src; } + build.workspaceArgs + // { + inherit (build) src; + cargoDenyExtraArgs = + "--workspace " + + lib.concatMapStringsSep " " (p: "--exclude ${p}") [ + "komorebi-windows" + "komorebi-gui" + "komorebic-no-console" + "komorebi-bar" + "komorebi-shortcuts" + "komorebi-e2e-agent" + "komorebi-testwin" + "komorebi-macos" + "komorebic-macos" + "komorebi-client-macos" + "komorebi-bar-macos" + "version-macos" + ]; + cargoDenyChecks = "--config ${platformDir}/deny.toml bans licenses sources"; + } ); komorebi-workspace-nextest = build.craneLib.cargoNextest ( diff --git a/komorebi-for-kde/justfile b/komorebi-for-kde/justfile index bf906061..67ec2458 100644 --- a/komorebi-for-kde/justfile +++ b/komorebi-for-kde/justfile @@ -28,8 +28,8 @@ lint: # the JSON Schemas of komorebi.json and of applications.json, from the Rust types jsonschema: - cargo run --package komorebic --locked -- static-config-schema > schema.json - cargo run --package komorebic --locked -- application-specific-configuration-schema > schema.asc.json + cargo run --package komorebic-linux --locked -- static-config-schema > schema.json + cargo run --package komorebic-linux --locked -- application-specific-configuration-schema > schema.asc.json # the options of the module's `config`, from schema.json, with the hash of the schema they were # made from in the first line (written by schemars-nixgen; the check `schema-fresh` compares it); needs schemars-nixgen @@ -66,7 +66,7 @@ vm-all: # write the help of every komorebic subcommand to docs/cli, one page each docgen: rm -f docs/cli/*.md - cargo run --package komorebic --locked -- docgen --output docs/cli + cargo run --package komorebic-linux --locked -- docgen --output docs/cli # the demo guest in a virtual machine, with komorebi tiling a few windows (docs/trying-it.md); # `just run-kde --doctor` says what this machine is missing diff --git a/komorebi-for-kde/komorebi-client/Cargo.toml b/komorebi-for-kde/komorebi-client/Cargo.toml index 3c1a8911..bb88c56a 100644 --- a/komorebi-for-kde/komorebi-client/Cargo.toml +++ b/komorebi-for-kde/komorebi-client/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "komorebi-client" -version.workspace = true +name = "komorebi-client-linux" +version = "0.1.0" edition = "2024" [dependencies] -komorebi = { path = "../komorebi", default-features = false } -komorebi-themes = { workspace = true } +komorebi = { package = "komorebi-linux", path = "../komorebi", default-features = false } +komorebi-themes = { path = "../../komorebi-themes" } -serde_json = { workspace = true } +serde_json = { package = "serde_json_lenient", version = "0.2" } [dev-dependencies] parking_lot = "0.13" @@ -15,3 +15,6 @@ parking_lot = "0.13" [features] default = ["schemars"] schemars = ["komorebi/default"] + +[lib] +name = "komorebi_client" diff --git a/komorebi-for-kde/komorebi-client/src/lib.rs b/komorebi-for-kde/komorebi-client/src/lib.rs index 3b55f8bd..71f76223 100644 --- a/komorebi-for-kde/komorebi-client/src/lib.rs +++ b/komorebi-for-kde/komorebi-client/src/lib.rs @@ -1,394 +1,9 @@ -//! A client for the komorebi daemon: it writes [`SocketMessage`]s on the daemon's socket and reads -//! the daemon's answers. -//! -//! The daemon listens on `komorebi.sock` in [`struct@DATA_DIR`], which is -//! `$XDG_RUNTIME_DIR/komorebi` in a desktop session. Every function here opens a new connection -//! and writes each message as one line of JSON. [`send_message`] and [`send_batch`] give -//! orders and read nothing back; [`send_query`] asks a question and returns the answer, which the -//! daemon ends by closing the connection. A function fails with the error of the connection, so a -//! daemon that is not running is an [`std::io::ErrorKind::NotFound`] or a -//! [`std::io::ErrorKind::ConnectionRefused`]. -//! -//! [`subscribe`] and [`subscribe_with_options`] make the program a subscriber: they listen on a -//! socket of its own in [`struct@DATA_DIR`], and ask the daemon to send a [`Notification`] to it -//! after each event and each message the window manager handles. -//! -//! The crate also re-exports the types the messages and the answers are made of, so that a client -//! needs nothing else, and [`check`], the checks `komorebic check` runs. -//! -//! # Example -//! -//! The examples on this page answer for the daemon: each one listens on the socket itself, in a -//! runtime directory made for it, before it sends anything. -//! -//! ```rust -//! # use std::io::{BufRead, BufReader, Write}; -//! # let runtime = format!("/tmp/komorebi-client-doc-crate-{}", std::process::id()); -//! # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; -//! # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the socket is in it -//! # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); -//! # let listener = std::os::unix::net::UnixListener::bind(&socket)?; -//! # let daemon = std::thread::spawn(move || -> std::io::Result { -//! # let (mut stream, _) = listener.accept()?; -//! # let mut line = String::new(); -//! # BufReader::new(stream.try_clone()?).read_line(&mut line)?; -//! # stream.write_all(b"2")?; -//! # Ok(line) -//! # }); -//! use komorebi_client::SocketMessage; -//! use komorebi_client::StateQuery; -//! use komorebi_client::send_query; -//! -//! let workspace = send_query(&SocketMessage::Query(StateQuery::FocusedWorkspaceIndex))?; -//! assert_eq!(workspace, "2"); -//! -//! # assert_eq!( -//! # daemon.join().unwrap()?, -//! # r#"{"type":"Query","content":"FocusedWorkspaceIndex"}"# -//! # ); -//! # std::fs::remove_dir_all(&runtime)?; -//! # Ok::<(), Box>(()) -//! ``` -//! -//! `komorebi-client/tests/daemon.rs` sends the same messages to a window manager that listens the -//! way the daemon does, over an in-memory desktop. +//! `komorebi-client-linux`: the client of the unified `komorebi-client` package, kept under its old +//! package name until the cutover. The code is in `komorebi-client/src/linux.rs`. -pub use komorebi::DATA_DIR; -pub use komorebi::LOG_DIR; -pub use komorebi::Notification; -pub use komorebi::NotificationEvent; -pub use komorebi::animation::AnimationPrefix; -pub use komorebi::check; -pub use komorebi::container::Container; -pub use komorebi::core::ApplicationIdentifier; -pub use komorebi::core::Axis; -pub use komorebi::core::CycleDirection; -pub use komorebi::core::DefaultLayout; -pub use komorebi::core::FocusFollowsMouseImplementation; -pub use komorebi::core::Layout; -pub use komorebi::core::MonocleFocusBehaviour; -pub use komorebi::core::MoveBehaviour; -pub use komorebi::core::OperationBehaviour; -pub use komorebi::core::OperationDirection; -pub use komorebi::core::PanDirection; -pub use komorebi::core::Rect; -pub use komorebi::core::ScrollingCentering; -pub use komorebi::core::Sizing; -pub use komorebi::core::SocketMessage; -pub use komorebi::core::StateQuery; -pub use komorebi::core::SubscribeOptions; -pub use komorebi::core::WindowKind; -pub use komorebi::core::animation::AnimationStyle; -pub use komorebi::core::asc::ApplicationSpecificConfiguration; -pub use komorebi::core::pathext::PathExt; -pub use komorebi::core::pathext::replace_env_in_path; -pub use komorebi::monitor_reconciliator::MonitorNotification; -pub use komorebi::state::State; -pub use komorebi::static_config::StaticConfig; -pub use komorebi::window::Window; -pub use komorebi::workspace::Workspace; -pub use komorebi::workspace::WorkspaceLayer; -pub use komorebi_themes::KomorebiTheme; -pub use komorebi_themes::colour::Colour; -pub use komorebi_themes::colour::Rgb; -use std::borrow::Borrow; -use std::io::BufReader; -use std::io::Read; -use std::io::Write; -use std::net::Shutdown; -use std::os::unix::net::UnixListener; -use std::os::unix::net::UnixStream; -use std::time::Duration; +extern crate komorebi as komorebi_linux; -const KOMOREBI: &str = "komorebi.sock"; +#[path = "../../../komorebi-client/src/linux.rs"] +mod platform; -/// Sends one message to the daemon, and does not wait for it to be handled -/// -/// # Errors -/// -/// - The daemon's socket cannot be connected to, for example because the daemon is not running. -/// - The message cannot be written within a second. -/// -/// # Example -/// -/// ```rust -/// # use std::io::{BufRead, BufReader}; -/// # let runtime = format!("/tmp/komorebi-client-doc-message-{}", std::process::id()); -/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; -/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the socket is in it -/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); -/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; -/// # let daemon = std::thread::spawn(move || -> std::io::Result { -/// # let (stream, _) = listener.accept()?; -/// # let mut line = String::new(); -/// # BufReader::new(stream).read_line(&mut line)?; -/// # Ok(line) -/// # }); -/// use komorebi_client::SocketMessage; -/// use komorebi_client::send_message; -/// -/// send_message(&SocketMessage::Retile)?; -/// -/// # assert_eq!(daemon.join().unwrap()?, r#"{"type":"Retile"}"#); -/// # std::fs::remove_dir_all(&runtime)?; -/// # Ok::<(), Box>(()) -/// ``` -pub fn send_message(message: &SocketMessage) -> std::io::Result<()> { - let socket = DATA_DIR.join(KOMOREBI); - let mut stream = UnixStream::connect(socket)?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - stream.write_all(serde_json::to_string(message)?.as_bytes()) -} - -/// Sends several messages to the daemon on one connection, which handles them in order, and does -/// not wait for them to be handled -/// -/// # Errors -/// -/// The same as [`send_message`]. -/// -/// # Example -/// -/// ```rust -/// # use std::io::{BufRead, BufReader}; -/// # let runtime = format!("/tmp/komorebi-client-doc-batch-{}", std::process::id()); -/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; -/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the socket is in it -/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); -/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; -/// # let daemon = std::thread::spawn(move || -> std::io::Result> { -/// # let (stream, _) = listener.accept()?; -/// # BufReader::new(stream).lines().collect() -/// # }); -/// use komorebi_client::SocketMessage; -/// use komorebi_client::send_batch; -/// -/// send_batch([SocketMessage::Retile, SocketMessage::Stop])?; -/// -/// # assert_eq!(daemon.join().unwrap()?, [r#"{"type":"Retile"}"#, r#"{"type":"Stop"}"#]); -/// # std::fs::remove_dir_all(&runtime)?; -/// # Ok::<(), Box>(()) -/// ``` -pub fn send_batch(messages: impl IntoIterator) -> std::io::Result<()> -where - Q: Borrow, -{ - let socket = DATA_DIR.join(KOMOREBI); - let mut stream = UnixStream::connect(socket)?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - let msgs = messages.into_iter().fold(String::new(), |mut s, m| { - if let Ok(m_str) = serde_json::to_string(m.borrow()) { - s.push_str(&m_str); - s.push('\n'); - } - s - }); - stream.write_all(msgs.as_bytes()) -} - -/// Sends one message to the daemon and returns its answer: JSON for -/// [`SocketMessage::State`] and [`SocketMessage::MonitorInformation`], one value as text for -/// [`SocketMessage::Query`], and nothing for a message that is not a question -/// -/// # Errors -/// -/// - The daemon's socket cannot be connected to, for example because the daemon is not running. -/// - The message cannot be written within a second. -/// - The daemon sends nothing for a second before its answer is complete. -/// -/// # Example -/// -/// The answer to [`SocketMessage::State`] reads back as a [`State`]: -/// -/// ```rust -/// # use std::io::{BufRead, BufReader, Write}; -/// # let runtime = format!("/tmp/komorebi-client-doc-query-{}", std::process::id()); -/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; -/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the socket is in it -/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); -/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; -/// # let daemon = std::thread::spawn(move || -> std::io::Result<()> { -/// # let (mut stream, _) = listener.accept()?; -/// # BufReader::new(stream.try_clone()?).read_line(&mut String::new())?; -/// # let state = r#"{"monitors":{"elements":[],"focused":0},"monitor_usr_idx_map":{},"is_paused":false,"resize_delta":50,"new_window_behaviour":"Create","float_override":false,"cross_monitor_move_behaviour":"Swap","monocle_focus_behaviour":"NoOp","unmanaged_window_operation_behaviour":"Op","work_area_offset":null,"mouse_follows_focus":true}"#; -/// # stream.write_all(state.as_bytes()) -/// # }); -/// use komorebi_client::SocketMessage; -/// use komorebi_client::State; -/// use komorebi_client::send_query; -/// -/// let state: State = serde_json::from_str(&send_query(&SocketMessage::State)?)?; -/// assert!(state.mouse_follows_focus); -/// -/// # daemon.join().unwrap()?; -/// # std::fs::remove_dir_all(&runtime)?; -/// # Ok::<(), Box>(()) -/// ``` -pub fn send_query(message: &SocketMessage) -> std::io::Result { - let socket = DATA_DIR.join(KOMOREBI); - - let mut stream = UnixStream::connect(socket)?; - stream.set_read_timeout(Some(Duration::from_secs(1)))?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - stream.write_all(serde_json::to_string(message)?.as_bytes())?; - stream.shutdown(Shutdown::Write)?; - - let mut reader = BufReader::new(stream); - let mut response = String::new(); - reader.read_to_string(&mut response)?; - - Ok(response) -} - -/// Listens on the socket `name` in [`struct@DATA_DIR`], and asks the daemon to send a -/// [`Notification`] to it after each event and each message the window manager handles -/// -/// A socket file that is left over at that path is removed first. Each notification comes on a -/// new connection, as JSON, and ends when the daemon closes the connection; the first is the -/// notification of the subscription itself. When the daemon stops, it connects and closes the -/// connection without writing anything. -/// -/// A subscriber that the daemon cannot connect to, because its program has exited or its socket -/// was removed, is removed at the next notification, with its socket file. It has to subscribe -/// again: the daemon does not try it again, and does not keep its subscribers when it restarts. -/// -/// # Errors -/// -/// - The socket file left over at that path cannot be removed. -/// - The socket cannot be bound, for example because [`struct@DATA_DIR`] does not exist. -/// - The subscription cannot be sent, for one of the reasons [`send_message`] gives. -/// -/// # Example -/// -/// ```rust -/// # use std::io::{BufRead, BufReader, Write}; -/// # let runtime = format!("/tmp/komorebi-client-doc-subscribe-{}", std::process::id()); -/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; -/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the sockets are in it -/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); -/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; -/// # let daemon = std::thread::spawn(move || -> std::io::Result { -/// # let (stream, _) = listener.accept()?; -/// # let mut message = String::new(); -/// # BufReader::new(stream).read_line(&mut message)?; -/// # let subscriber = komorebi_client::DATA_DIR.join("bar.sock"); -/// # let state = r#"{"monitors":{"elements":[],"focused":0},"monitor_usr_idx_map":{},"is_paused":false,"resize_delta":50,"new_window_behaviour":"Create","float_override":false,"cross_monitor_move_behaviour":"Swap","monocle_focus_behaviour":"NoOp","unmanaged_window_operation_behaviour":"Op","work_area_offset":null,"mouse_follows_focus":true}"#; -/// # let notification = format!(r#"{{"event":{message},"state":{state}}}"#); -/// # std::os::unix::net::UnixStream::connect(subscriber)?.write_all(notification.as_bytes())?; -/// # Ok(message) -/// # }); -/// use std::io::Read; -/// -/// use komorebi_client::Notification; -/// use komorebi_client::NotificationEvent; -/// use komorebi_client::SocketMessage; -/// use komorebi_client::subscribe; -/// -/// let listener = subscribe("bar.sock")?; -/// -/// // the first notification is the one of the subscription -/// let (mut connection, _) = listener.accept()?; -/// let mut json = String::new(); -/// connection.read_to_string(&mut json)?; -/// let notification: Notification = serde_json::from_str(&json)?; -/// assert!(matches!( -/// notification.event, -/// NotificationEvent::Socket(SocketMessage::AddSubscriberSocket(name)) if name == "bar.sock" -/// )); -/// -/// # assert_eq!( -/// # daemon.join().unwrap()?, -/// # r#"{"type":"AddSubscriberSocket","content":"bar.sock"}"# -/// # ); -/// # std::fs::remove_dir_all(&runtime)?; -/// # Ok::<(), Box>(()) -/// ``` -pub fn subscribe(name: &str) -> std::io::Result { - let socket = DATA_DIR.join(name); - - match std::fs::remove_file(&socket) { - Ok(()) => {} - Err(error) => match error.kind() { - std::io::ErrorKind::NotFound => {} - _ => { - return Err(error); - } - }, - }; - - let listener = UnixListener::bind(&socket)?; - - send_message(&SocketMessage::AddSubscriberSocket(name.to_string()))?; - - Ok(listener) -} - -/// The same as [`subscribe`], with the [`SubscribeOptions`] the daemon applies to this subscriber -/// -/// With `filter_state_changes`, the daemon sends a notification only when the event or the message -/// changed the [`State`], and always when a window is shown, when a subscriber is added, when a -/// theme is set and when the configuration is reloaded. -/// -/// # Errors -/// -/// The same as [`subscribe`]. -/// -/// # Example -/// -/// ```rust -/// # use std::io::{BufRead, BufReader}; -/// # let runtime = format!("/tmp/komorebi-client-doc-options-{}", std::process::id()); -/// # std::fs::create_dir_all(format!("{runtime}/komorebi"))?; -/// # unsafe { std::env::set_var("XDG_RUNTIME_DIR", &runtime) }; // the sockets are in it -/// # let socket = komorebi_client::DATA_DIR.join("komorebi.sock"); -/// # let listener = std::os::unix::net::UnixListener::bind(&socket)?; -/// # let daemon = std::thread::spawn(move || -> std::io::Result { -/// # let (stream, _) = listener.accept()?; -/// # let mut message = String::new(); -/// # BufReader::new(stream).read_line(&mut message)?; -/// # Ok(message) -/// # }); -/// use komorebi_client::DATA_DIR; -/// use komorebi_client::SubscribeOptions; -/// use komorebi_client::subscribe_with_options; -/// -/// let options = SubscribeOptions { -/// filter_state_changes: true, -/// }; -/// let listener = subscribe_with_options("bar.sock", options)?; -/// -/// let socket = DATA_DIR.join("bar.sock"); -/// assert_eq!(listener.local_addr()?.as_pathname(), Some(socket.as_path())); -/// -/// # assert_eq!( -/// # daemon.join().unwrap()?, -/// # r#"{"type":"AddSubscriberSocketWithOptions","content":["bar.sock",{"filter_state_changes":true}]}"# -/// # ); -/// # std::fs::remove_dir_all(&runtime)?; -/// # Ok::<(), Box>(()) -/// ``` -pub fn subscribe_with_options( - name: &str, - options: SubscribeOptions, -) -> std::io::Result { - let socket = DATA_DIR.join(name); - - match std::fs::remove_file(&socket) { - Ok(()) => {} - Err(error) => match error.kind() { - std::io::ErrorKind::NotFound => {} - _ => { - return Err(error); - } - }, - }; - - let listener = UnixListener::bind(&socket)?; - - send_message(&SocketMessage::AddSubscriberSocketWithOptions( - name.to_string(), - options, - ))?; - - Ok(listener) -} +pub use platform::*; diff --git a/komorebi-for-kde/komorebi-hotkeys/Cargo.toml b/komorebi-for-kde/komorebi-hotkeys/Cargo.toml index c40054fb..5ea38c70 100644 --- a/komorebi-for-kde/komorebi-hotkeys/Cargo.toml +++ b/komorebi-for-kde/komorebi-hotkeys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "komorebi-hotkeys" -version.workspace = true +version = "0.1.0" description = "Reads skhd, whkd and sxhkd key binding files and plans them as KDE global shortcuts" edition = "2024" diff --git a/komorebi-for-kde/komorebi/Cargo.toml b/komorebi-for-kde/komorebi/Cargo.toml index af41b283..747623b3 100644 --- a/komorebi-for-kde/komorebi/Cargo.toml +++ b/komorebi-for-kde/komorebi/Cargo.toml @@ -1,37 +1,38 @@ [package] -name = "komorebi" -version.workspace = true +name = "komorebi-linux" +version = "0.1.0" description = "A tiling window manager for KDE Plasma" edition = "2024" [dependencies] komorebi-hotkeys = { path = "../komorebi-hotkeys" } -komorebi-themes = { workspace = true } -komorebi-backend = { workspace = true } -komorebi-collections = { workspace = true } -komorebi-core = { workspace = true } -komorebi-layouts = { workspace = true } -komorebi-scrolling = { workspace = true } -komorebi-config = { workspace = true } -komorebi-protocol = { workspace = true } -komorebi-transport = { workspace = true } -version = { path = "../version" } +komorebi-themes = { path = "../../komorebi-themes" } +komorebi-backend = { path = "../../crates/komorebi-backend" } +komorebi-collections = { path = "../../crates/komorebi-collections" } +komorebi-core = { path = "../../crates/komorebi-core" } +komorebi-layouts = { path = "../../komorebi-layouts", features = ["schemars"] } +komorebi-scrolling = { path = "../../komorebi-scrolling" } +komorebi-config = { path = "../../crates/komorebi-config", default-features = false, features = ["schemars"] } +komorebi-settings = { path = "../../crates/komorebi-settings" } +komorebi-protocol = { path = "../../crates/komorebi-protocol", default-features = false, features = ["schemars"] } +komorebi-transport = { path = "../../crates/komorebi-transport" } +version = { package = "version-linux", path = "../version" } -clap = { workspace = true } -color-eyre = { workspace = true } -crossbeam-channel = { workspace = true } -crossbeam-utils = { workspace = true } +clap = { version = "4", features = ["derive", "wrap_help"] } +color-eyre = { version = "0.6" } +crossbeam-channel = { version = "0.5" } +crossbeam-utils = { version = "0.8" } ctrlc = { version = "3", features = ["termination"] } -dirs = { workspace = true } -hotwatch = { workspace = true } -lazy_static = { workspace = true } +dirs = { version = "7" } +hotwatch = { version = "0.5" } +lazy_static = { version = "1" } nanoid = "0.5" parking_lot = "0.13" -pastey = { workspace = true } +pastey = { version = "0.2" } regex = "1" -schemars = { workspace = true, optional = true } -serde = { workspace = true } -serde_json = { workspace = true, features = ["preserve_order"] } +schemars = { version = "1.1", optional = true } +serde = { version = "1", features = ["derive"] } +serde_json = { package = "serde_json_lenient", version = "0.2", features = ["preserve_order"] } serde_with = { version = "3", features = ["schemars_1"] } strum = { version = "0.28", features = ["derive"] } tokio = { version = "1", features = [ @@ -40,9 +41,9 @@ tokio = { version = "1", features = [ "sync", "time", ] } -tracing = { workspace = true } -tracing-appender = { workspace = true } -tracing-subscriber = { workspace = true } +tracing = { version = "0.1" } +tracing-appender = { version = "0.2" } +tracing-subscriber = { version = "0.3", features = ["env-filter"] } zbus = { version = "6", default-features = false, features = [ "tokio", "proxy", @@ -57,3 +58,10 @@ uuid = { version = "1", features = ["v4"] } default = ["schemars"] deadlock_detection = ["parking_lot/deadlock_detection"] schemars = ["dep:schemars", "komorebi-collections/schemars", "komorebi-core/schemars"] + +[lib] +name = "komorebi" + +[[bin]] +name = "komorebi" +path = "src/main.rs" diff --git a/komorebi-for-kde/komorebi/src/lib.rs b/komorebi-for-kde/komorebi/src/lib.rs index 58da817a..570a2c7d 100644 --- a/komorebi-for-kde/komorebi/src/lib.rs +++ b/komorebi-for-kde/komorebi/src/lib.rs @@ -85,6 +85,7 @@ pub mod process_command; pub mod process_event; pub mod reconcile; pub mod scrolling; +pub mod settings; pub mod state; pub mod static_config; pub mod theme_manager; @@ -208,16 +209,18 @@ lazy_static! { /// The padding, in pixels, between the edge of a monitor's work area and the tiles of its /// workspaces, for a monitor that sets none of its own. The default for this is 5. -pub static DEFAULT_WORKSPACE_PADDING: AtomicI32 = AtomicI32::new(5); +pub static DEFAULT_WORKSPACE_PADDING: AtomicI32 = + AtomicI32::new(komorebi_settings::shared::PlatformDefaults::KDE.workspace_padding); /// The padding, in pixels, around each tile, for a monitor that sets none of its own. The default /// for this is 5. -pub static DEFAULT_CONTAINER_PADDING: AtomicI32 = AtomicI32::new(5); +pub static DEFAULT_CONTAINER_PADDING: AtomicI32 = + AtomicI32::new(komorebi_settings::shared::PlatformDefaults::KDE.container_padding); /// How many pixels `ResizeWindowEdge` and `ResizeWindowAxis` resize by, when `komorebi.json` does /// not say -pub static DEFAULT_RESIZE_DELTA: i32 = 50; +pub static DEFAULT_RESIZE_DELTA: i32 = komorebi_settings::shared::DEFAULT_RESIZE_DELTA; /// Whether the pointer goes to the window that is given the focus, when `komorebi.json` does not /// say -pub static DEFAULT_MOUSE_FOLLOWS_FOCUS: bool = true; +pub static DEFAULT_MOUSE_FOLLOWS_FOCUS: bool = komorebi_settings::shared::DEFAULT_MOUSE_FOLLOWS_FOCUS; /// The event, the message or the change of the monitors a [`Notification`] is about /// diff --git a/komorebi-for-kde/komorebi/src/main.rs b/komorebi-for-kde/komorebi/src/main.rs index 95db7759..d20b4692 100644 --- a/komorebi-for-kde/komorebi/src/main.rs +++ b/komorebi-for-kde/komorebi/src/main.rs @@ -218,7 +218,7 @@ impl From for PlanMode { /// A tiling window manager for KDE Plasma. #[derive(Parser)] -#[clap(author, about, version = version::LONG_VERSION)] +#[clap(name = "komorebi", author, about, version = version::LONG_VERSION)] struct Opts { /// Level of log output verbosity #[clap(long, value_enum, default_value_t=LogLevel::Info)] diff --git a/komorebi-for-kde/komorebi/src/settings.rs b/komorebi-for-kde/komorebi/src/settings.rs new file mode 100644 index 00000000..b7056427 --- /dev/null +++ b/komorebi-for-kde/komorebi/src/settings.rs @@ -0,0 +1,97 @@ +//! The settings of this daemon, as one snapshot (plan step 10, `docs/dev/settings.md`). +//! +//! Nothing reads this yet: the process-wide statics are still the source of truth, and each +//! migration step moves one group of them (writers and readers together) into +//! [`settings()`]. Until then the value is the starting values of those statics. + +use std::sync::LazyLock; + +use komorebi_settings::Handle; +use komorebi_settings::Shared; +use komorebi_settings::shared::PlatformDefaults; + +/// The part of the settings that only this platform has. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct KdeSettings {} + +pub type Settings = komorebi_settings::Settings; + +static SETTINGS: LazyLock> = LazyLock::new(|| { + Handle::new(Settings::new( + Shared::defaults_for(PlatformDefaults::KDE), + KdeSettings::default(), + )) +}); + +/// The settings of the running daemon: take a [`Handle::snapshot`] once per unit of work. +pub fn settings() -> &'static Handle { + &SETTINGS +} + +#[cfg(test)] +mod tests { + use std::sync::atomic::Ordering; + + use super::*; + use crate::border_manager; + + // The statics are still the source of truth. These pin that the starting values of the + // settings are the starting values of the statics, so that moving a group over changes nothing. + // (They read the statics without any test writing them first: no test here sets them.) + #[test] + fn the_starting_settings_are_the_starting_values_of_the_statics() { + let shared = &settings().snapshot().shared; + + assert_eq!( + shared.defaults.container_padding, + crate::DEFAULT_CONTAINER_PADDING.load(Ordering::SeqCst) + ); + assert_eq!( + shared.defaults.workspace_padding, + crate::DEFAULT_WORKSPACE_PADDING.load(Ordering::SeqCst) + ); + assert_eq!(shared.defaults.resize_delta, crate::DEFAULT_RESIZE_DELTA); + assert_eq!( + shared.defaults.mouse_follows_focus, + crate::DEFAULT_MOUSE_FOLLOWS_FOCUS + ); + assert_eq!( + shared.border.enabled, + border_manager::BORDER_ENABLED.load(Ordering::SeqCst) + ); + assert_eq!( + shared.border.width, + border_manager::BORDER_WIDTH.load(Ordering::SeqCst) + ); + assert_eq!( + shared.border.offset, + border_manager::BORDER_OFFSET.load(Ordering::SeqCst) + ); + assert_eq!( + shared.border.radius, + border_manager::BORDER_RADIUS.load(Ordering::SeqCst) + ); + let colours = shared.border.colours; + assert_eq!( + colours.single, + border_manager::FOCUSED.load(Ordering::SeqCst) + ); + assert_eq!(colours.stack, border_manager::STACK.load(Ordering::SeqCst)); + assert_eq!( + colours.monocle, + border_manager::MONOCLE.load(Ordering::SeqCst) + ); + assert_eq!( + colours.floating, + border_manager::FLOATING.load(Ordering::SeqCst) + ); + assert_eq!( + colours.unfocused, + border_manager::UNFOCUSED.load(Ordering::SeqCst) + ); + assert_eq!( + colours.unfocused_locked, + border_manager::UNFOCUSED_LOCKED.load(Ordering::SeqCst) + ); + } +} diff --git a/komorebi-for-kde/komorebi/src/static_config.rs b/komorebi-for-kde/komorebi/src/static_config.rs index a857b40d..fa995c17 100644 --- a/komorebi-for-kde/komorebi/src/static_config.rs +++ b/komorebi-for-kde/komorebi/src/static_config.rs @@ -88,6 +88,7 @@ use std::io::ErrorKind; use std::io::Write; use std::os::unix::net::UnixListener; use std::os::unix::net::UnixStream; +use std::path::Path; use std::path::PathBuf; use std::sync::Arc; use std::sync::atomic::Ordering; @@ -729,16 +730,16 @@ impl ApplyGlobals for StaticConfig { pub trait StaticConfigExt: Sized { /// Makes the window manager from the file at `path`, and starts watching the file fn preload( - path: &PathBuf, + path: &Path, incoming: Receiver, unix_listener: Option, ) -> eyre::Result; /// Gives the monitors of the window manager what the file says about them - fn postload(path: &PathBuf, wm: &Arc>) -> eyre::Result<()>; + fn postload(path: &Path, wm: &Arc>) -> eyre::Result<()>; /// Replaces the configuration of the window manager with the file at `path` - fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()>; + fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()>; } impl StaticConfigExt for StaticConfig { @@ -761,7 +762,7 @@ impl StaticConfigExt for StaticConfig { /// - The file cannot be watched. #[allow(clippy::too_many_lines)] fn preload( - path: &PathBuf, + path: &Path, incoming: Receiver, unix_listener: Option, ) -> eyre::Result { @@ -836,7 +837,7 @@ impl StaticConfigExt for StaticConfig { known_window_ids: HashMap::new(), }; - let bytes = SocketMessage::ReloadStaticConfiguration(path.clone()).as_bytes()?; + let bytes = SocketMessage::ReloadStaticConfiguration(path.to_path_buf()).as_bytes()?; wm.hotwatch.watch(path, move |event| match event.kind { // an editor either writes the file in place or replaces it with a new one, which is a @@ -866,7 +867,7 @@ impl StaticConfigExt for StaticConfig { /// # Errors /// /// The file cannot be read or is not a configuration ([`StaticConfig::read`]). - fn postload(path: &PathBuf, wm: &Arc>) -> eyre::Result<()> { + fn postload(path: &Path, wm: &Arc>) -> eyre::Result<()> { let mut value = Self::read(path)?; let mut wm = wm.lock(); @@ -1042,7 +1043,7 @@ impl StaticConfigExt for StaticConfig { /// - The file cannot be read or is not a configuration ([`StaticConfig::read`]); nothing has /// changed then. /// - A rule has a regular expression that is not valid; the settings before it have changed. - fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()> { + fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()> { let mut value = Self::read(path)?; value.apply_globals()?; diff --git a/komorebi-for-kde/komorebi/tests/asc.rs b/komorebi-for-kde/komorebi/tests/asc.rs index 0ef4e187..dd98bfae 100644 --- a/komorebi-for-kde/komorebi/tests/asc.rs +++ b/komorebi-for-kde/komorebi/tests/asc.rs @@ -215,7 +215,7 @@ fn the_kinds_of_rule_of_other_platforms_are_read_and_do_nothing() { #[test] fn the_applications_file_komorebic_ships_floats_the_programs_it_names() { - let shipped = Path::new(env!("CARGO_MANIFEST_DIR")).join("../komorebic/applications.json"); + let shipped = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../komorebic/src/linux/applications.json"); let mut desktop = Desktop::load(&applications(&shipped)).unwrap(); assert_eq!( diff --git a/komorebi-for-kde/komorebic/Cargo.toml b/komorebi-for-kde/komorebic/Cargo.toml index 11f30bd2..e4b52128 100644 --- a/komorebi-for-kde/komorebic/Cargo.toml +++ b/komorebi-for-kde/komorebic/Cargo.toml @@ -1,27 +1,27 @@ [package] -name = "komorebic" -version.workspace = true +name = "komorebic-linux" +version = "0.1.0" description = "The command-line interface for Komorebi, a tiling window manager for KDE Plasma" edition = "2024" [dependencies] -komorebi-config = { workspace = true } -komorebi = { path = "../komorebi", default-features = false } -komorebi-client = { path = "../komorebi-client", default-features = false } +komorebi-config = { path = "../../crates/komorebi-config", default-features = false, features = ["schemars"] } +komorebi = { package = "komorebi-linux", path = "../komorebi", default-features = false } +komorebi-client = { package = "komorebi-client-linux", path = "../komorebi-client", default-features = false } komorebi-hotkeys = { path = "../komorebi-hotkeys" } komorebic-core = { path = "../../crates/komorebic-core" } -version = { path = "../version" } +version = { package = "version-linux", path = "../version" } -clap = { workspace = true } +clap = { version = "4", features = ["derive", "wrap_help"] } clap_complete = "4" -chrono = { workspace = true } -color-eyre = { workspace = true } -dirs = { workspace = true } +chrono = { version = "0.4" } +color-eyre = { version = "0.6" } +dirs = { version = "7" } fs-tail = "0.1" -lazy_static = { workspace = true } -schemars = { workspace = true, optional = true } -serde_json = { workspace = true } -sysinfo = { workspace = true } +lazy_static = { version = "1" } +schemars = { version = "1.1", optional = true } +serde_json = { package = "serde_json_lenient", version = "0.2" } +sysinfo = { version = "0.40" } [features] default = ["schemars"] @@ -29,3 +29,7 @@ schemars = ["dep:schemars", "komorebi-client/default"] [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(FALSE)'] } + +[[bin]] +name = "komorebic" +path = "src/main.rs" diff --git a/komorebi-for-kde/komorebic/src/main.rs b/komorebi-for-kde/komorebic/src/main.rs index 6707afbf..fdd5e4be 100644 --- a/komorebi-for-kde/komorebic/src/main.rs +++ b/komorebi-for-kde/komorebic/src/main.rs @@ -1,789 +1,9 @@ -//! `komorebic`, the command line interface of komorebi for KDE Plasma. -//! -//! A subcommand that asks something of the daemon is one message on its socket: an order, such as -//! `stop` or `retile`, is written and `komorebic` exits; a question, such as `state` or `query`, -//! is written and the answer is printed. The messages are [`komorebi_client::SocketMessage`]s, -//! sent with [`komorebi_client::send_message`] and [`komorebi_client::send_query`]. -//! -//! The orders that change what the daemon tiles: -//! -//! - `focus` and `cycle-focus` give the focus to another window of the focused workspace, and -//! `mouse-follows-focus` and `toggle-mouse-follows-focus` set whether the pointer goes with it. -//! - `move` and `cycle-move` move the focused window to another tile. -//! - `change-layout`, `cycle-layout` and `flip-layout` change the layout of the focused -//! workspace, `scrolling-layout-columns` and `layout-ratios` tune it, `toggle-tiling` turns its -//! tiling off and on, and `preselect-direction` and `cancel-preselect` reserve the place of the -//! next window and give it up. -//! - `consume`, `expel` and `toggle-column-stack` put windows in the same column of the Scrolling -//! layout and take them out, `scrolling-layout-full-width`, `center-focus` and `expand` make the -//! focused column as wide as the screen, put it in the middle and fill the room that is left, -//! and `pan` moves the view along the strip without moving the focus. -//! - `stack` puts the focused window in one container with the window on one side of it, so that -//! they share a tile and only one is in sight, `unstack` takes it out again, and `stack-all` and -//! `unstack-all` do it for the whole workspace and for the focused stack. `cycle-stack` brings -//! the next or the previous window of the focused stack to the front, `cycle-stack-index` moves -//! the front window along the stack, and `focus-stack-window` brings the window at an index to -//! the front. `toggle-window-container-behaviour` and -//! `toggle-workspace-window-container-behaviour` make a window that opens join the focused -//! container instead of getting a tile, and `toggle-float-override` and -//! `toggle-workspace-float-override` make it float. -//! - `promote`, `promote-swap`, `promote-focus` and `promote-window` bring a window to the largest -//! tile, or the focus to it. -//! - `toggle-float` takes the focused window out of the layout, or puts it back, -//! `toggle-workspace-layer` switches the focused workspace between its tiled windows and its -//! floating ones, and `toggle-lock` locks the focused container at its index, or unlocks it. -//! - `toggle-monocle` gives the focused container the whole work area, or puts it back, and -//! `monocle-focus-behaviour` and `toggle-monocle-focus-behaviour` set what focusing in a -//! direction does meanwhile. `toggle-maximize` has KWin maximize the focused window, which -//! leaves the layout, and restores it. -//! - `focused-workspace-padding`, `focused-workspace-container-padding`, `workspace-padding`, -//! `container-padding` and the two `adjust-*-padding` set the padding around the tiles and -//! between them, and `global-work-area-offset`, `monitor-work-area-offset`, -//! `workspace-work-area-offset` and `toggle-window-based-work-area-offset` keep parts of the work -//! area free of tiles. -//! - `minimize` and `close` minimize and close the focused window, `unmanage` takes it out of -//! the layout until `manage` takes it back, `unmanaged-window-operation-behaviour` sets whether -//! the daemon carries out an order while the focused window is not one it tiles, and -//! `toggle-pause` pauses the daemon and resumes it. -//! - `resize-edge` and `resize-axis` resize the focused window by the `resize-delta`, and -//! `quick-save-resize`, `quick-load-resize`, `save-resize` and `load-resize` save the sizes of -//! the tiles of the focused workspace and load them back. -//! - `focus-workspace` shows another workspace of the focused monitor, `move-to-workspace` moves -//! the focused window to a workspace and shows it, and `send-to-workspace` moves it there and -//! stays. A workspace is KWin's virtual desktop of the same number, counted from 0. -//! `cycle-workspace`, `cycle-empty-workspace`, `cycle-move-to-workspace` and -//! `cycle-send-to-workspace` go to the next or the previous workspace, `focus-last-workspace`, -//! `move-to-last-workspace` and `send-to-last-workspace` to the one that was in front before, -//! `focus-workspaces` shows a workspace on every monitor, and `new-workspace` and -//! `close-workspace` add a workspace and remove an empty one. -//! - `focus-monitor`, `cycle-monitor` and `focus-monitor-at-cursor` focus another monitor, and -//! `focus-monitor-workspace` a workspace of another monitor; `move-to-monitor`, -//! `send-to-monitor`, their `cycle-` forms, `move-to-monitor-workspace`, -//! `send-to-monitor-workspace`, `move-to-named-workspace` and `send-to-named-workspace` take the -//! focused window to another monitor; `move-workspace-to-monitor`, -//! `cycle-move-workspace-to-monitor` and `swap-workspaces-with-monitor` take workspaces there; -//! `cross-monitor-move-behaviour` and `toggle-cross-monitor-move-behaviour` set what `move` does -//! at the edge of a monitor, and `display-index-preference` gives a monitor an index. -//! `eager-focus` focuses the first window of an executable, on any workspace of any monitor. -//! - `workspace-name` names a workspace, which `focus-named-workspace`, `named-workspace-layout`, -//! `named-workspace-tiling`, `named-workspace-padding` and `named-workspace-container-padding` -//! find by its name; `workspace-layout` and `workspace-tiling` set the layout and the tiling of -//! a workspace by its index, and `ensure-workspaces` and `ensure-named-workspaces` give a -//! monitor workspaces up to a number, or with names. -//! - `border` sets whether the compositor draws a border around each window, `border-colour` the -//! color of the border of a kind of window, and `border-width` and `border-offset` the room the -//! layout leaves for it. -//! - `focus-follows-mouse` and `toggle-focus-follows-mouse` set whether KWin gives the focus to the -//! window under the pointer, as the pointer moves. -//! - `transparency` and `toggle-transparency` set whether the windows that do not have the focus -//! are see-through, and `transparency-alpha` how opaque they are. -//! - `animation`, `animation-duration` and `animation-style` set whether windows are animated going -//! to their places, for how long and with what easing, and `animation-fps` the frame rate that -//! is stored and ignored. -//! -//! `ignore-rule` and `manage-rule` add a rule that keeps an application out of the layout or -//! always in it, `session-float-rule` floats the focused window and every window like it until the -//! daemon stops, `session-float-rules` shows those rules and `clear-session-float-rules` removes -//! them, and `global-state` shows the rules the daemon has. `visible-windows` shows the windows -//! that can be seen on the workspace each monitor shows. -//! -//! `initial-workspace-rule`, `initial-named-workspace-rule`, `workspace-rule` and -//! `named-workspace-rule` send the windows of an application to a workspace, when they open or -//! always, `clear-workspace-rules`, `clear-named-workspace-rules` and `clear-all-workspace-rules` -//! take those rules away, and `enforce-workspace-rules` applies them to the windows that are open. -//! -//! `workspace-layout-rule` and `named-workspace-layout-rule` make a workspace change layout once -//! it has so many windows, and `clear-workspace-layout-rules` and -//! `clear-named-workspace-layout-rules` take those rules away. `generate-static-config` prints the -//! settings of the daemon as a `komorebi.json`, and `replace-configuration` makes the daemon -//! start over with another one. -//! -//! `subscribe-socket` and `unsubscribe-socket` add and remove a subscriber: a program that listens -//! on a socket in the daemon's data directory, to which the daemon sends a notification after each -//! event and each message it handles. -//! -//! The others work without the daemon: `quickstart` writes an example `komorebi.json`, -//! `applications.json` and `skhdrc` in the config home, `enable-autostart` and `disable-autostart` write and -//! remove the entry that has Plasma start komorebi at login, `start` runs `komorebi` in the -//! background, with the `komorebi.json` it is given with `--config`, `check` reads the -//! `komorebi.json` the daemon would and the key binding file, looks at the desktop, and reports -//! what is wrong, exiting with status 1 if something is an error, `configuration` shows the path -//! of the `komorebi.json` the daemon reads, `log` follows its log, `data-directory` shows where its -//! socket is, `completions` prints a completion script for a shell, and `static-config-schema`, -//! `application-specific-configuration-schema`, `notification-schema` and `socket-schema` print -//! the JSON Schema of `komorebi.json`, of an `applications.json`, of a notification and of a -//! message. The hidden `docgen` writes the help of every subcommand as Markdown, wrapped -//! at 100 columns whatever the width of the terminal, which is how `docs/cli` is made. -//! -//! `export-kde-shortcuts` and `hotkeys compile` read a key binding file (an skhdrc, a whkdrc or an -//! sxhkdrc) and write the bindings KDE can run by itself as shortcut files. `hotkeys state`, -//! `hotkeys reload` and `hotkeys release` look after the keys the daemon registers with KDE; the -//! [`hotkeys`] module has the details. +//! `komorebic-linux`: the KDE command line of the unified `komorebic` package, kept under its old +//! package name until the cutover. The code is in `komorebic/src/linux`. -use chrono::Utc; -use clap::Parser; -use clap::Subcommand; -use color_eyre::eyre; -use fs_tail::TailedFile; -use komorebi_client::FocusFollowsMouseImplementation; -use komorebi_client::PanDirection; -use komorebi_client::PathExt; -use komorebi_client::SocketMessage; -use komorebi_client::WindowKind; -use komorebi_client::replace_env_in_path; -use komorebi_client::send_message; -use komorebi_client::send_query; -use komorebic_core::args::BooleanState; -use komorebic_core::args::OneEnum; -use komorebic_core::cli::Cmd; -use komorebic_core::cli::Meta; -use komorebic_core::cli::command; -use komorebic_core::docgen::DocFormat; -use komorebic_core::launcher; -use komorebic_core::launcher::Launcher; -use komorebic_core::messages::Messages; -use lazy_static::lazy_static; -use std::fs::File; -use std::io::BufRead; -use std::io::Write; -use std::num::NonZeroUsize; -use std::path::PathBuf; -use std::process::Command; -use std::process::Stdio; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::Ordering; -use sysinfo::ProcessesToUpdate; +#[path = "../../../komorebic/src/linux/mod.rs"] +mod linux; -mod hotkeys; - -lazy_static! { - static ref HAS_CUSTOM_CONFIG_HOME: AtomicBool = AtomicBool::new(false); - static ref HOME_DIR: PathBuf = { - std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( - |_| dirs::home_dir().expect("there is no home directory").join(".config").join("komorebi"), - |home_path| { - let home = home_path.replace_env(); - if home.as_path().is_dir() { - HAS_CUSTOM_CONFIG_HOME.store(true, Ordering::SeqCst); - home - } else { - panic!( - "$KOMOREBI_CONFIG_HOME is set to \"{home_path}\", which is not a valid directory", - ); - } - }, - ) - }; -} - -#[derive(Parser)] -struct MonocleFocusBehaviour { - /// Desired monocle focus behavior - #[clap(value_enum)] - behaviour: komorebi_client::MonocleFocusBehaviour, -} - -#[derive(Parser)] -#[allow(clippy::struct_excessive_bools)] -struct Start { - /// Path to a static configuration JSON file - #[clap(short, long)] - #[clap(value_parser = replace_env_in_path)] - config: Option, - /// Arguments to pass to komorebi, after a `--`: `komorebic start -- --log-level debug` - #[clap(last = true)] - komorebi_args: Vec, -} - -#[derive(Parser)] -struct Stop { - /// Do not restore windows after stopping komorebi - #[clap(long, hide = true)] - ignore_restore: bool, -} - -#[derive(Parser)] -struct EnableAutostart { - /// Path to a static configuration JSON file - #[clap(action, short, long)] - #[clap(value_parser = replace_env_in_path)] - config: Option, -} - -#[derive(Parser)] -struct EagerFocus { - /// Case-sensitive exe identifier - exe: String, -} - -#[derive(Parser)] -struct ScrollingLayoutColumns { - /// Desired number of visible columns - count: NonZeroUsize, -} - -#[derive(Parser)] -struct Pan { - /// The way that the view goes - #[clap(value_enum)] - direction: PanDirection, -} - -#[derive(Parser)] -struct LayoutRatios { - /// Column width ratios (space-separated values between 0.1 and 0.9) - #[clap(short, long, num_args = 1..)] - columns: Option>, - /// Row height ratios (space-separated values between 0.1 and 0.9) - #[clap(short, long, num_args = 1..)] - rows: Option>, -} - -#[derive(Parser)] -struct BorderColour { - #[clap(value_enum, short, long, default_value = "single")] - window_kind: WindowKind, - /// Red - r: u32, - /// Green - g: u32, - /// Blue - b: u32, -} - -#[derive(Parser)] -struct TransparencyAlpha { - /// Alpha - alpha: u8, -} - -#[derive(Parser)] -struct FocusFollowsMouse { - /// On KDE both are KWin's own focus policy - #[clap(value_enum, short, long, default_value = "windows")] - implementation: FocusFollowsMouseImplementation, - #[clap(value_enum)] - boolean_state: BooleanState, -} - -#[derive(Parser)] -struct ToggleFocusFollowsMouse { - /// On KDE both are KWin's own focus policy - #[clap(value_enum, short, long, default_value = "windows")] - implementation: FocusFollowsMouseImplementation, -} - -#[derive(Parser)] -struct Animation { - #[clap(value_enum)] - boolean_state: BooleanState, - /// Animation type to apply the state to. If not specified, sets global state - #[clap(value_enum, short, long)] - animation_type: Option, -} - -#[derive(Parser)] -struct AnimationDuration { - /// Desired animation durations in ms - duration: u64, - /// Animation type to apply the duration to. If not specified, sets global duration - #[clap(value_enum, short, long)] - animation_type: Option, -} - -#[derive(Parser)] -struct AnimationStyle { - /// Desired ease function for animation - #[clap(value_enum, short, long, default_value = "linear")] - style: komorebi_client::AnimationStyle, - /// Animation type to apply the style to. If not specified, sets global style - #[clap(value_enum, short, long)] - animation_type: Option, -} - -#[derive(Parser)] -struct Docgen { - /// Output directory for generated documentation files - #[clap(short, long)] - output: Option, -} - -#[derive(Parser)] -struct Check { - /// Path to a static configuration JSON file - #[clap(action, short, long)] - #[clap(value_parser = replace_env_in_path)] - komorebi_config: Option, - /// Look at the configuration and the key bindings only, not at the desktop - #[clap(long)] - configuration_only: bool, -} - -#[derive(Parser)] -struct Completions { - #[clap(value_enum)] - shell: clap_complete::Shell, -} - -#[derive(Subcommand)] -enum KdeCommands { - #[clap(hide = true)] - Docgen(Docgen), - /// Generate komorebic CLI completions for the target shell - #[clap(arg_required_else_help = true)] - Completions(Completions), - /// Gather example configurations for a new-user quickstart - Quickstart, - /// Turn an skhdrc into KDE global shortcuts (they work over RDP, unlike evdev hotkey daemons) - ExportKdeShortcuts(hotkeys::ExportKdeShortcuts), - /// Key bindings: KDE global shortcuts from a key binding file, and the keys of the daemon - #[clap(arg_required_else_help = true)] - Hotkeys(hotkeys::Hotkeys), - /// Start komorebi as a background process - Start(Start), - /// Stop the komorebi process - Stop(Stop), - /// Check komorebi configuration and the desktop it runs on for common errors - Check(Check), - /// Show the path to komorebi.json - #[clap(alias = "config")] - Configuration, - /// Show the path to komorebi's data directory, which has its socket - #[clap(alias = "datadir")] - DataDirectory, - // /// Subscribe to komorebi events using a Named Pipe - // #[clap(arg_required_else_help = true)] - // #[clap(alias = "subscribe")] - // SubscribePipe(SubscribePipe), - // /// Unsubscribe from komorebi events - // #[clap(arg_required_else_help = true)] - // #[clap(alias = "unsubscribe")] - // UnsubscribePipe(UnsubscribePipe), - /// Tail komorebi's process logs (cancel with Ctrl-C) - Log, - // /// Forcibly focus the window at the cursor with a left mouse click - // ForceFocus, - // /// Set the invisible border dimensions around each window - // #[clap(arg_required_else_help = true)] - // InvisibleBorders(InvisibleBorders), - /// Move the view of the Scrolling layout a column to the left or the right, which does - /// nothing in any other layout - #[clap(arg_required_else_help = true)] - Pan(Pan), - /// Set the layout column and row ratios for the focused workspace - LayoutRatios(LayoutRatios), - // /// Load a custom layout from file for the focused workspace - // #[clap(hide = true)] - // #[clap(arg_required_else_help = true)] - // LoadCustomLayout(LoadCustomLayout), - // /// Set the monitor index preference for a monitor identified using its size - // #[clap(arg_required_else_help = true)] - // MonitorIndexPreference(MonitorIndexPreference), - // /// Set a custom layout for the specified workspace - // #[clap(hide = true)] - // #[clap(arg_required_else_help = true)] - // WorkspaceCustomLayout(WorkspaceCustomLayout), - // /// Set a custom layout for the specified workspace - // #[clap(hide = true)] - // #[clap(arg_required_else_help = true)] - // NamedWorkspaceCustomLayout(NamedWorkspaceCustomLayout), - // /// Add a dynamic custom layout for the specified workspace - // #[clap(hide = true)] - // #[clap(arg_required_else_help = true)] - // WorkspaceCustomLayoutRule(WorkspaceCustomLayoutRule), - // /// Add a dynamic custom layout for the specified workspace - // #[clap(hide = true)] - // #[clap(arg_required_else_help = true)] - // NamedWorkspaceCustomLayoutRule(NamedWorkspaceCustomLayoutRule), - /// Toggle the compositor's maximization for the focused window - ToggleMaximize, - // /// Set the border style - // #[clap(arg_required_else_help = true)] - // BorderStyle(BorderStyle), - // /// Set the border implementation - // #[clap(arg_required_else_help = true)] - // BorderImplementation(BorderImplementation), - /// Enable or disable transparency for unfocused windows - #[clap(arg_required_else_help = true)] - Transparency(OneEnum), - /// Set the alpha value for unfocused window transparency - #[clap(arg_required_else_help = true)] - TransparencyAlpha(TransparencyAlpha), - /// Toggle transparency for unfocused windows - ToggleTransparency, - /// Enable or disable focus follows mouse (KWin's own focus policy) - #[clap(arg_required_else_help = true)] - FocusFollowsMouse(FocusFollowsMouse), - /// Toggle focus follows mouse (KWin's own focus policy) - ToggleFocusFollowsMouse(ToggleFocusFollowsMouse), - /// Generate a JSON Schema for applications.json - #[clap(alias = "asc-schema")] - ApplicationSpecificConfigurationSchema, - /// Generate a JSON Schema of subscription notifications - NotificationSchema, - /// Generate a JSON Schema of socket messages - SocketSchema, - /// Generate a JSON Schema of the static configuration file - StaticConfigSchema, - /// Generates a static configuration JSON file based on the current window manager state - GenerateStaticConfig, - /// Writes an XDG autostart entry so komorebi starts with the Plasma session - EnableAutostart(EnableAutostart), - /// Removes the XDG autostart entry - DisableAutostart, -} - -/// `~/.config/autostart/komorebi.desktop`, which Plasma runs at login -fn autostart_entry() -> PathBuf { - dirs::config_dir() - .expect("there is no config directory") - .join("autostart") - .join("komorebi.desktop") -} - -fn print_query(message: &SocketMessage) { - match send_query(message) { - Ok(response) => println!("{response}"), - Err(error) => panic!("{}", error), - } -} - -/// Starting `komorebi` for `komorebic start`: a `Command` for the daemon, found among the -/// processes by its exact name. -struct KdeLauncher<'a> { - args: &'a Start, - system: sysinfo::System, -} - -impl Launcher for KdeLauncher<'_> { - fn daemon_name(&self) -> &str { - "komorebi" - } - - fn spawn(&mut self) -> eyre::Result<()> { - let mut command = Command::new("komorebi"); - - if let Some(config) = &self.args.config { - command.args(["--config", &config.display().to_string()]); - } - - command - .args(&self.args.komorebi_args) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .stdin(Stdio::null()) - .spawn()?; - - Ok(()) - } - - fn is_running(&mut self) -> eyre::Result { - self.system.refresh_processes(ProcessesToUpdate::All, true); - - Ok(self - .system - .processes_by_exact_name("komorebi".as_ref()) - .next() - .is_some()) - } - - fn diagnose(&mut self) -> eyre::Result<()> { - let mut command = Command::new("komorebi"); - - if let Some(config) = &self.args.config { - command.args(["--config", &config.display().to_string()]); - } - - if let Ok(output) = command.args(&self.args.komorebi_args).output() { - println!("{}", String::from_utf8(output.stderr)?); - } - - Ok(()) - } -} - -/// What the top of the help and `--version` say. -const META: Meta = Meta { - name: "komorebic", - about: env!("CARGO_PKG_DESCRIPTION"), - author: env!("CARGO_PKG_AUTHORS"), - version: version::LONG_VERSION, -}; - -/// Write a message to the daemon's socket, or, if the daemon answers it, print the answer. -fn send_or_query(messages: Messages) -> eyre::Result<()> { - let query = messages.is_query(); - let message = SocketMessage::from(messages); - if query { - print_query(&message); - } else { - send_message(&message)?; - } - Ok(()) -} - -fn main() -> eyre::Result<()> { - let opts = komorebic_core::cli::parse::(&META); - - match opts.cmd { - Cmd::Messages(messages) => send_or_query(messages)?, - Cmd::Platform(platform) => match platform { - KdeCommands::Docgen(args) => { - let output_dir = args.output.unwrap_or_else(|| PathBuf::from("docs/cli")); - let pages = komorebic_core::docgen::write( - command::(&META), - &DocFormat::KDE, - &output_dir, - )?; - for page in pages { - println!("{}", page.display()); - } - } - KdeCommands::Completions(args) => { - let mut cli = command::(&META); - clap_complete::generate(args.shell, &mut cli, "komorebic", &mut std::io::stdout()); - } - KdeCommands::ExportKdeShortcuts(args) => hotkeys::export_kde_shortcuts(args)?, - KdeCommands::Hotkeys(args) => hotkeys::hotkeys(args)?, - KdeCommands::Quickstart => { - fn write_file_with_prompt( - path: &PathBuf, - content: &str, - created_files: &mut Vec, - ) -> eyre::Result<()> { - if path.exists() { - print!( - "{} will be overwritten, do you want to continue? (y/N): ", - path.display() - ); - std::io::stdout().flush()?; - let mut input = String::new(); - std::io::stdin().read_line(&mut input)?; - let trimmed = input.trim().to_lowercase(); - if trimmed == "y" || trimmed == "yes" { - std::fs::write(path, content)?; - created_files.push(path.display().to_string()); - } else { - println!("Skipping {}", path.display()); - } - } else { - std::fs::write(path, content)?; - created_files.push(path.display().to_string()); - } - Ok(()) - } - - std::fs::create_dir_all(&*HOME_DIR)?; - std::fs::create_dir_all(&*komorebi_client::DATA_DIR)?; - - let komorebi_json = include_str!("../../docs/komorebi.example.json").to_string(); - let komorebi_path = HOME_DIR.join("komorebi.json"); - let applications_path = HOME_DIR.join("applications.json"); - let skhdrc_path = HOME_DIR.join("skhdrc"); - - let mut written_files = Vec::new(); - - write_file_with_prompt(&komorebi_path, &komorebi_json, &mut written_files)?; - - let applications_json = include_str!("../applications.json"); - write_file_with_prompt(&applications_path, applications_json, &mut written_files)?; - - let skhdrc = include_str!("../../docs/skhdrc.sample"); - write_file_with_prompt(&skhdrc_path, skhdrc, &mut written_files)?; - if written_files.is_empty() { - println!("\nNo files were written.") - } else { - println!( - "\nThe following example files were written:\n{}", - written_files.join("\n") - ); - } - - println!("\nYou can now run: komorebic start"); - } - KdeCommands::EnableAutostart(args) => { - let exec = match args.config { - None => String::from("komorebi"), - Some(config) => format!("komorebi --config \"{}\"", config.display()), - }; - - let target = autostart_entry(); - if let Some(dir) = target.parent() { - std::fs::create_dir_all(dir)?; - } - - std::fs::write( - &target, - format!( - "[Desktop Entry]\nType=Application\nName=komorebi\nComment=A tiling window manager for KDE Plasma\nExec={exec}\nX-KDE-autostart-after=plasma-workspace\nTerminal=false\n" - ), - )?; - - println!("Wrote {}", target.display()); - } - KdeCommands::DisableAutostart => { - let target = autostart_entry(); - if target.exists() { - std::fs::remove_file(&target)?; - println!("Deleted {}", target.display()); - } else { - println!("There is no autostart entry at {}", target.display()); - } - } - KdeCommands::Check(args) => { - use komorebi_client::check::Finding; - use komorebi_client::check::Report; - - let mut report = Report::default(); - - // where komorebi looks - let mut place = vec![]; - if std::env::var_os("KOMOREBI_CONFIG_HOME").is_some() { - place.push(Finding::note(format!( - "KOMOREBI_CONFIG_HOME is set: looking in {}", - HOME_DIR.display() - ))); - } else { - place.push(Finding::note(format!( - "KOMOREBI_CONFIG_HOME is not set: looking in {}", - HOME_DIR.display() - ))); - } - - let static_config = match args.komorebi_config { - Some(path) => { - place.push(Finding::note(format!( - "using the configuration file given with --komorebi-config: {}", - path.display() - ))); - path - } - None => HOME_DIR.join("komorebi.json"), - }; - - let (findings, wants) = komorebi_client::check::check_configuration(&static_config); - place.extend(findings); - report.push("Configuration", place); - - report.push("Key bindings", hotkeys::check(&HOME_DIR)); - - if !args.configuration_only { - report.push( - "The desktop", - komorebi_client::check::check_environment(&wants), - ); - } - - print!("{}", report.render()); - - if report.has_errors() { - std::process::exit(1); - } - } - KdeCommands::Start(args) => { - launcher::start(&mut KdeLauncher { - args: &args, - system: sysinfo::System::new_all()?, - })?; - } - KdeCommands::Stop(args) => { - send_message(&launcher::stop_message(args.ignore_restore))?; - } - KdeCommands::Configuration => { - let static_config = HOME_DIR.join("komorebi.json"); - - if static_config.exists() { - println!("{}", static_config.display()); - } - } - KdeCommands::DataDirectory => { - let dir = &*komorebi_client::DATA_DIR; - if dir.exists() { - println!("{}", dir.display()); - } - } - KdeCommands::Log => { - let timestamp = Utc::now().format("%Y-%m-%d").to_string(); - let color_log = komorebi_client::LOG_DIR.join(format!("komorebi.log.{timestamp}")); - let file = TailedFile::new(File::open(color_log)?); - let locked = file.lock(); - #[allow(clippy::significant_drop_in_scrutinee, clippy::lines_filter_map_ok)] - for line in locked.lines().flatten() { - println!("{line}"); - } - } - KdeCommands::ToggleMaximize => { - send_message(&SocketMessage::ToggleMaximize)?; - } - KdeCommands::Pan(args) => { - send_message(&SocketMessage::Pan(args.direction))?; - } - KdeCommands::LayoutRatios(args) => { - if args.columns.is_none() && args.rows.is_none() { - println!( - "No ratios provided, nothing to change. Use --columns or --rows to specify ratios." - ); - } else { - send_message(&SocketMessage::LayoutRatios(args.columns, args.rows))?; - } - } - KdeCommands::ApplicationSpecificConfigurationSchema => { - #[cfg(feature = "schemars")] - { - let schema = komorebi_config::schema::view::< - komorebi_client::ApplicationSpecificConfiguration, - >(komorebi_config::schema::Platform::CURRENT); - print!("{schema}"); - } - } - KdeCommands::NotificationSchema => { - #[cfg(feature = "schemars")] - { - let notification = schemars::schema_for!(komorebi_client::Notification); - let schema = serde_json::to_string_pretty(¬ification)?; - println!("{schema}"); - } - } - KdeCommands::SocketSchema => { - #[cfg(feature = "schemars")] - { - let socket_message = schemars::schema_for!(SocketMessage); - let schema = serde_json::to_string_pretty(&socket_message)?; - println!("{schema}"); - } - } - KdeCommands::StaticConfigSchema => { - #[cfg(feature = "schemars")] - { - let schema = komorebi_config::schema::view::< - komorebi_config::static_config::StaticConfig, - >(komorebi_config::schema::Platform::CURRENT); - print!("{schema}"); - } - } - KdeCommands::GenerateStaticConfig => { - print_query(&SocketMessage::GenerateStaticConfig); - } - KdeCommands::Transparency(args) => { - send_message(&SocketMessage::Transparency(args.value.into()))?; - } - KdeCommands::TransparencyAlpha(args) => { - send_message(&SocketMessage::TransparencyAlpha(args.alpha))?; - } - KdeCommands::ToggleTransparency => { - send_message(&SocketMessage::ToggleTransparency)?; - } - KdeCommands::FocusFollowsMouse(args) => { - send_message(&SocketMessage::FocusFollowsMouse( - args.implementation, - args.boolean_state.into(), - ))?; - } - KdeCommands::ToggleFocusFollowsMouse(args) => { - send_message(&SocketMessage::ToggleFocusFollowsMouse(args.implementation))?; - } - }, - } - - Ok(()) +fn main() -> color_eyre::eyre::Result<()> { + linux::main() } diff --git a/komorebi-for-kde/nix/root-crates.json b/komorebi-for-kde/nix/root-crates.json new file mode 100644 index 00000000..2f8627ac --- /dev/null +++ b/komorebi-for-kde/nix/root-crates.json @@ -0,0 +1,13 @@ +[ + "crates/komorebi-backend", + "crates/komorebi-collections", + "crates/komorebi-config", + "crates/komorebi-core", + "crates/komorebi-protocol", + "crates/komorebi-settings", + "crates/komorebi-transport", + "crates/komorebic-core", + "komorebi-layouts", + "komorebi-scrolling", + "komorebi-themes" +] diff --git a/komorebi-for-kde/nix/tests/vm/default.nix b/komorebi-for-kde/nix/tests/vm/default.nix index 0f50c371..79a8b274 100644 --- a/komorebi-for-kde/nix/tests/vm/default.nix +++ b/komorebi-for-kde/nix/tests/vm/default.nix @@ -40,7 +40,9 @@ let pyproject = true; src = lib.fileset.toSource { root = ./lib; - fileset = ./lib; + # not the unit tests: the VM never runs them (setuptools does not package them), so + # editing one must not rebuild every suite; `libCheck` keeps them + fileset = lib.fileset.difference ./lib ./lib/tests; }; build-system = [ ps.setuptools ]; dependencies = [ ps.pillow ]; diff --git a/komorebi-for-kde/version/Cargo.toml b/komorebi-for-kde/version/Cargo.toml index ac610fad..c40ba83d 100644 --- a/komorebi-for-kde/version/Cargo.toml +++ b/komorebi-for-kde/version/Cargo.toml @@ -1,10 +1,13 @@ [package] -name = "version" +name = "version-linux" edition = "2024" -version.workspace = true +version = "0.1.0" [dependencies] -shadow-rs = { workspace = true } +shadow-rs = { version = "2" } [build-dependencies] -shadow-rs = { workspace = true } +shadow-rs = { version = "2" } + +[lib] +name = "version" diff --git a/komorebi-for-mac/.gitignore b/komorebi-for-mac/.gitignore index 7a2a220f..9c29e2ce 100644 --- a/komorebi-for-mac/.gitignore +++ b/komorebi-for-mac/.gitignore @@ -2,6 +2,5 @@ /result* /.idea /.direnv -/komorebic/applications.json /komorebi-schema /bar-schema diff --git a/komorebi-for-mac/Cargo.lock b/komorebi-for-mac/Cargo.lock deleted file mode 100644 index 2fc9e306..00000000 --- a/komorebi-for-mac/Cargo.lock +++ /dev/null @@ -1,8122 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "ab_glyph" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" -dependencies = [ - "ab_glyph_rasterizer", - "owned_ttf_parser", -] - -[[package]] -name = "ab_glyph_rasterizer" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" - -[[package]] -name = "accesskit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf203f9d3bd8f29f98833d1fbef628df18f759248a547e7e01cfbf63cda36a99" - -[[package]] -name = "accesskit_atspi_common" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "890d241cf51fc784f0ac5ac34dfc847421f8d39da6c7c91a0fcc987db62a8267" -dependencies = [ - "accesskit", - "accesskit_consumer", - "atspi-common", - "serde", - "thiserror 1.0.69", - "zvariant", -] - -[[package]] -name = "accesskit_consumer" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db81010a6895d8707f9072e6ce98070579b43b717193d2614014abd5cb17dd43" -dependencies = [ - "accesskit", - "hashbrown 0.15.5", -] - -[[package]] -name = "accesskit_macos" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0089e5c0ac0ca281e13ea374773898d9354cc28d15af9f0f7394d44a495b575" -dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.15.5", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "accesskit_unix" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301e55b39cfc15d9c48943ce5f572204a551646700d0e8efa424585f94fec528" -dependencies = [ - "accesskit", - "accesskit_atspi_common", - "async-channel", - "async-executor", - "async-task", - "atspi", - "futures-lite", - "futures-util", - "serde", - "zbus", -] - -[[package]] -name = "accesskit_windows" -version = "0.29.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d63dd5041e49c363d83f5419a896ecb074d309c414036f616dc0b04faca971" -dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.15.5", - "static_assertions", - "windows 0.61.3", - "windows-core 0.61.2", -] - -[[package]] -name = "accesskit_winit" -version = "0.29.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8cfabe59d0eaca7412bfb1f70198dd31e3b0496fee7e15b066f9c36a1a140a0" -dependencies = [ - "accesskit", - "accesskit_macos", - "accesskit_unix", - "accesskit_windows", - "raw-window-handle", - "winit", -] - -[[package]] -name = "addr2line" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e567177890eb1617b1f774005b66b26b2377afd138a2ca37aae7d8f0c81429d4" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - -[[package]] -name = "adler32" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" - -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "getrandom 0.3.4", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" -dependencies = [ - "memchr", -] - -[[package]] -name = "aligned" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685" -dependencies = [ - "as-slice", -] - -[[package]] -name = "aligned-vec" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" -dependencies = [ - "equator", -] - -[[package]] -name = "alloc-no-stdlib" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a" - -[[package]] -name = "alloc-stdlib" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "android-activity" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" -dependencies = [ - "android-properties", - "bitflags 2.13.2", - "cc", - "jni", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-sys", - "num_enum", - "thiserror 2.0.21", -] - -[[package]] -name = "android-properties" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" - -[[package]] -name = "android_system_properties" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" -dependencies = [ - "libc", -] - -[[package]] -name = "anstream" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" - -[[package]] -name = "anstyle-parse" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys 0.61.2", -] - -[[package]] -name = "anyhow" -version = "1.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" - -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - -[[package]] -name = "arbitrary" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" - -[[package]] -name = "arboard" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" -dependencies = [ - "clipboard-win", - "image 0.25.10", - "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", - "parking_lot", - "percent-encoding", - "windows-sys 0.61.2", - "x11rb", -] - -[[package]] -name = "arg_enum_proc_macro" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "arrayref" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" - -[[package]] -name = "arrayvec" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" - -[[package]] -name = "as-raw-xcb-connection" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" - -[[package]] -name = "as-slice" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "ash" -version = "0.38.0+1.3.281" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" -dependencies = [ - "libloading", -] - -[[package]] -name = "async-broadcast" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" -dependencies = [ - "event-listener", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-channel" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-executor" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "pin-project-lite", - "slab", -] - -[[package]] -name = "async-io" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" -dependencies = [ - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix 1.1.6", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-lock" -version = "3.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" -dependencies = [ - "event-listener", - "event-listener-strategy", - "pin-project-lite", -] - -[[package]] -name = "async-process" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" -dependencies = [ - "async-channel", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "rustix 1.1.6", -] - -[[package]] -name = "async-recursion" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "async-signal" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix 1.1.6", - "signal-hook-registry", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - -[[package]] -name = "async-trait" -version = "0.1.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "atspi" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83247582e7508838caf5f316c00791eee0e15c0bf743e6880585b867e16815c" -dependencies = [ - "atspi-common", - "atspi-connection", - "atspi-proxies", -] - -[[package]] -name = "atspi-common" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33dfc05e7cdf90988a197803bf24f5788f94f7c94a69efa95683e8ffe76cfdfb" -dependencies = [ - "enumflags2", - "serde", - "static_assertions", - "zbus", - "zbus-lockstep", - "zbus-lockstep-macros", - "zbus_names", - "zvariant", -] - -[[package]] -name = "atspi-connection" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4193d51303d8332304056ae0004714256b46b6635a5c556109b319c0d3784938" -dependencies = [ - "atspi-common", - "atspi-proxies", - "futures-lite", - "zbus", -] - -[[package]] -name = "atspi-proxies" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2eebcb9e7e76f26d0bcfd6f0295e1cd1e6f33bedbc5698a971db8dc43d7751c" -dependencies = [ - "atspi-common", - "serde", - "zbus", -] - -[[package]] -name = "autocfg" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" - -[[package]] -name = "av-scenechange" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394" -dependencies = [ - "aligned", - "anyhow", - "arg_enum_proc_macro", - "arrayvec", - "log", - "num-rational 0.4.2", - "num-traits", - "pastey 0.1.1", - "rayon", - "thiserror 2.0.21", - "v_frame", - "y4m", -] - -[[package]] -name = "av1-grain" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8" -dependencies = [ - "anyhow", - "arrayvec", - "log", - "nom 8.0.0", - "num-rational 0.4.2", - "v_frame", -] - -[[package]] -name = "avif-serialize" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38" -dependencies = [ - "arrayvec", -] - -[[package]] -name = "backtrace" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f4220217f3288537b83684130f42fad43320b1c3b805f1910d683d52ded24f" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide 0.9.1", - "object", - "rustc-demangle", - "windows-link 0.2.1", -] - -[[package]] -name = "base16-egui-themes" -version = "0.1.0" -source = "git+https://github.com/LGUG2Z/base16-egui-themes?rev=3f157904c641f0dc80f043449fe0214fc4182425#3f157904c641f0dc80f043449fe0214fc4182425" -dependencies = [ - "egui", - "schemars 1.2.3", - "serde", - "strum", - "strum_macros", -] - -[[package]] -name = "base16_color_scheme" -version = "0.3.2" -source = "git+https://github.com/LGUG2Z/base16_color_scheme#c32a9e290f0997eacba3e74bba2442667b5fc478" -dependencies = [ - "hex", - "nom 7.1.3", - "ramhorns", - "serde", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "base64" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" - -[[package]] -name = "base64ct" -version = "1.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" - -[[package]] -name = "beef" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" - -[[package]] -name = "bit-set" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" - -[[package]] -name = "bit_field" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" - -[[package]] -name = "bitstream-io" -version = "4.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f" -dependencies = [ - "no_std_io2", -] - -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block2" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" -dependencies = [ - "objc2 0.5.3", -] - -[[package]] -name = "block2" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" -dependencies = [ - "objc2 0.6.5", -] - -[[package]] -name = "blocking" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" -dependencies = [ - "async-channel", - "async-task", - "futures-io", - "futures-lite", - "piper", -] - -[[package]] -name = "brotli" -version = "9.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "627b7cfb0578f0eafce087a90fcd40add1231900b69e4d4de2d456260a4f5d81" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "6.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34c6783f42c21c952ad7112b354f0ba2f10760e9decea5b1b60523d6e270faaf" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bs58" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "built" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9" - -[[package]] -name = "bumpalo" -version = "3.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" - -[[package]] -name = "by_address" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" - -[[package]] -name = "bytemuck" -version = "1.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "byteorder-lite" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" - -[[package]] -name = "bytes" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" - -[[package]] -name = "calloop" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" -dependencies = [ - "bitflags 2.13.2", - "log", - "polling", - "rustix 0.38.44", - "slab", - "thiserror 1.0.69", -] - -[[package]] -name = "calloop" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" -dependencies = [ - "bitflags 2.13.2", - "polling", - "rustix 1.1.6", - "tracing", -] - -[[package]] -name = "calloop-wayland-source" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" -dependencies = [ - "calloop 0.13.0", - "rustix 0.38.44", - "wayland-backend", - "wayland-client", -] - -[[package]] -name = "calloop-wayland-source" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" -dependencies = [ - "calloop 0.14.5", - "rustix 1.1.6", - "wayland-backend", - "wayland-client", -] - -[[package]] -name = "calm_io" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ea0608700fe42d90ec17ad0f86335cf229b67df2e34e7f463e8241ce7b8fa5f" -dependencies = [ - "calmio_filters", -] - -[[package]] -name = "calmio_filters" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "846501f4575cd66766a40bb7ab6d8e960adc7eb49f753c8232bd8e0e09cf6ca2" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "catppuccin-egui" -version = "5.6.0" -source = "git+https://github.com/LGUG2Z/catppuccin-egui?rev=b2f95cbf441d1dd99f3c955ef10dcb84ce23c20a#b2f95cbf441d1dd99f3c955ef10dcb84ce23c20a" -dependencies = [ - "egui", -] - -[[package]] -name = "cc" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" -dependencies = [ - "find-msvc-tools", - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" - -[[package]] -name = "cfg_aliases" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" - -[[package]] -name = "cgl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" -dependencies = [ - "libc", -] - -[[package]] -name = "chacha20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" -dependencies = [ - "cfg-if", - "cpufeatures 0.3.1", - "rand_core 0.10.1", -] - -[[package]] -name = "chrono" -version = "0.4.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-link 0.2.1", -] - -[[package]] -name = "chrono-tz" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6139a8597ed92cf816dfb33f5dd6cf0bb93a6adc938f11039f371bc5bcd26c3" -dependencies = [ - "chrono", - "phf 0.12.1", -] - -[[package]] -name = "clap" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", - "terminal_size", -] - -[[package]] -name = "clap_complete" -version = "4.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037e2a1a92236d0aff7e845093f64661d6df4c02c9fcc61a60e9e1d736fa392f" -dependencies = [ - "clap", -] - -[[package]] -name = "clap_derive" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "clap_lex" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" - -[[package]] -name = "clipboard-win" -version = "5.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" -dependencies = [ - "error-code", -] - -[[package]] -name = "cmake" -version = "0.1.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" -dependencies = [ - "cc", -] - -[[package]] -name = "codespan-reporting" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" -dependencies = [ - "serde", - "termcolor", - "unicode-width", -] - -[[package]] -name = "color-eyre" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d" -dependencies = [ - "backtrace", - "color-spantrace", - "eyre", - "indenter", - "once_cell", - "owo-colors", - "tracing-error", -] - -[[package]] -name = "color-spantrace" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427" -dependencies = [ - "once_cell", - "owo-colors", - "tracing-core", - "tracing-error", -] - -[[package]] -name = "color-thief" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6460d760cf38ce67c9e0318f896538820acc54f2d0a3bfc5b2c557211066c98" -dependencies = [ - "rgb", -] - -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - -[[package]] -name = "colorchoice" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" - -[[package]] -name = "combine" -version = "4.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "const_format" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3decb4d6965448659923544a634a0571ba44cede4e11ef15a5a317126840454" -dependencies = [ - "const_format_proc_macros", - "konst", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941b570269a642506f08cb5b688c04bfa6cfd41a26f8bcdc49db8fd00c0ab659" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "core-graphics" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "core-graphics-types 0.1.3", - "foreign-types 0.3.2", - "libc", -] - -[[package]] -name = "core-graphics" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "core-graphics-types 0.1.3", - "foreign-types 0.5.0", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" -dependencies = [ - "bitflags 2.13.2", - "core-foundation 0.10.1", - "libc", -] - -[[package]] -name = "core-text" -version = "19.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" -dependencies = [ - "core-foundation 0.9.4", - "core-graphics 0.22.3", - "foreign-types 0.3.2", - "libc", -] - -[[package]] -name = "core_detect" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "cpufeatures" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" - -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "ctrlc" -version = "3.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162" -dependencies = [ - "dispatch2", - "nix", - "windows-sys 0.61.2", -] - -[[package]] -name = "cursor-icon" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" - -[[package]] -name = "curve25519-dalek" -version = "4.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "curve25519-dalek-derive", - "digest", - "fiat-crypto", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "darling" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" -dependencies = [ - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 3.0.9", -] - -[[package]] -name = "darling_macro" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" -dependencies = [ - "darling_core", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "deflate" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" -dependencies = [ - "adler32", - "byteorder", -] - -[[package]] -name = "defmt" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" -dependencies = [ - "bitflags 1.3.2", - "defmt-macros", -] - -[[package]] -name = "defmt-macros" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" -dependencies = [ - "defmt-parser", - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "defmt-parser" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "der" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "deranged" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" -dependencies = [ - "serde_core", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "dirs" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" -dependencies = [ - "dirs-sys 0.3.7", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys 0.3.7", -] - -[[package]] -name = "dirs" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" -dependencies = [ - "dirs-sys 0.5.0", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users 0.4.6", - "winapi", -] - -[[package]] -name = "dirs-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" -dependencies = [ - "libc", - "option-ext", - "redox_users 0.5.3", - "windows-sys 0.61.2", -] - -[[package]] -name = "dispatch" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - -[[package]] -name = "dispatch2" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "libc", - "objc2 0.6.5", -] - -[[package]] -name = "displaydoc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "dlib" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" -dependencies = [ - "libloading", -] - -[[package]] -name = "dlopen2" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b4f5f101177ff01b8ec4ecc81eead416a8aa42819a2869311b3420fa114ffa" -dependencies = [ - "libc", - "once_cell", - "winapi", -] - -[[package]] -name = "document-features" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" -dependencies = [ - "litrs", -] - -[[package]] -name = "downcast-rs" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" - -[[package]] -name = "dpi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" - -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - -[[package]] -name = "dyn-clone" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" - -[[package]] -name = "ecolor" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71ddb8ac7643d1dba1bb02110e804406dd459a838efcb14011ced10556711a8e" -dependencies = [ - "bytemuck", - "emath", -] - -[[package]] -name = "ed25519" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" -dependencies = [ - "pkcs8", - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" -dependencies = [ - "curve25519-dalek", - "ed25519", - "serde", - "sha2", - "subtle", - "zeroize", -] - -[[package]] -name = "eframe" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "457481173e6db5ca9fa2be93a58df8f4c7be639587aeb4853b526c6cf87db4e6" -dependencies = [ - "ahash", - "bytemuck", - "document-features", - "egui", - "egui-wgpu", - "egui-winit", - "egui_glow", - "glow", - "glutin", - "glutin-winit", - "image 0.25.10", - "js-sys", - "log", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", - "parking_lot", - "percent-encoding", - "profiling", - "raw-window-handle", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "web-time", - "windows-sys 0.61.2", - "winit", -] - -[[package]] -name = "egui" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9b567d356674e9a5121ed3fedfb0a7c31e059fe71f6972b691bcd0bfc284e3" -dependencies = [ - "accesskit", - "ahash", - "bitflags 2.13.2", - "emath", - "epaint", - "log", - "nohash-hasher", - "profiling", - "smallvec", - "unicode-segmentation", -] - -[[package]] -name = "egui-phosphor" -version = "0.10.0" -source = "git+https://github.com/amPerl/egui-phosphor?rev=d13688738478ecd12b426e3e74c59d6577a85b59#d13688738478ecd12b426e3e74c59d6577a85b59" -dependencies = [ - "egui", -] - -[[package]] -name = "egui-wgpu" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4d209971c84b2352a06174abdba701af1e552ce56b144d96f2bd50a3c91236" -dependencies = [ - "ahash", - "bytemuck", - "document-features", - "egui", - "epaint", - "log", - "profiling", - "thiserror 2.0.21", - "type-map", - "web-time", - "wgpu", - "winit", -] - -[[package]] -name = "egui-winit" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec6687e5bb551702f4ad10ac428bab12acf9d53047ebb1082d4a0ed8c6251a29" -dependencies = [ - "accesskit_winit", - "arboard", - "bytemuck", - "egui", - "log", - "objc2 0.5.3", - "objc2-foundation 0.2.2", - "objc2-ui-kit", - "profiling", - "raw-window-handle", - "smithay-clipboard", - "web-time", - "webbrowser", - "winit", -] - -[[package]] -name = "egui_glow" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6420863ea1d90e750f75075231a260030ad8a9f30a7cef82cdc966492dc4c4eb" -dependencies = [ - "bytemuck", - "egui", - "glow", - "log", - "memoffset", - "profiling", - "wasm-bindgen", - "web-sys", - "winit", -] - -[[package]] -name = "either" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" - -[[package]] -name = "emath" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "491bdf728bf25ddd9ad60d4cf1c48588fa82c013a2440b91aa7fc43e34a07c32" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "encoding_rs" -version = "0.8.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e985e0451871ad22fb8d2b6b076e2028a502a0d3950998c2c5c0a4f9b5d9679" -dependencies = [ - "cfg-if", - "core_detect", - "multiversion_no_op", - "rustversion", - "scopeguard", - "simdutf8", -] - -[[package]] -name = "endi" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" - -[[package]] -name = "enumflags2" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" -dependencies = [ - "enumflags2_derive", - "serde", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "epaint" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "009d0dd3c2163823a0abdb899451ecbc78798dec545ee91b43aff1fa790bab62" -dependencies = [ - "ab_glyph", - "ahash", - "bytemuck", - "ecolor", - "emath", - "epaint_default_fonts", - "log", - "nohash-hasher", - "parking_lot", - "profiling", -] - -[[package]] -name = "epaint_default_fonts" -version = "0.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4fbe202b6578d3d56428fa185cdf114a05e49da05f477b3c7f0fbb221f1862" - -[[package]] -name = "equator" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" -dependencies = [ - "equator-macro", -] - -[[package]] -name = "equator-macro" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "equivalent" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" - -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "error-code" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" - -[[package]] -name = "event-listener" -version = "5.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" -dependencies = [ - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" -dependencies = [ - "event-listener", - "pin-project-lite", -] - -[[package]] -name = "expat-sys" -version = "2.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" -dependencies = [ - "cmake", - "pkg-config", -] - -[[package]] -name = "exr" -version = "1.74.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711fe42c9964295e01ee3fba3f9fe0e1d24b98886950d68efe81b1c76e21adf3" -dependencies = [ - "bit_field", - "half", - "lebe", - "miniz_oxide 0.8.9", - "num-complex", - "pulp", - "rayon-core", - "smallvec", - "zune-inflate", -] - -[[package]] -name = "eyre" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08309dbcc659c5549a24ddb9b27027640641b282ef5768267c7e675558986a3" -dependencies = [ - "autocfg", - "indenter", - "once_cell", -] - -[[package]] -name = "fastrand" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" - -[[package]] -name = "fax" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" - -[[package]] -name = "fdeflate" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "fearless_simd" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" - -[[package]] -name = "fiat-crypto" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" - -[[package]] -name = "file-id" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13be71e6ca82e91bc0cb862bebaac0b2d1924a5a1d970c822b2f98b63fda8c3" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "filetime" -version = "0.2.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" -dependencies = [ - "cfg-if", - "libc", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" - -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - -[[package]] -name = "flate2" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" -dependencies = [ - "crc32fast", - "miniz_oxide 0.9.1", - "zlib-rs", -] - -[[package]] -name = "flavours" -version = "0.7.2" -source = "git+https://github.com/LGUG2Z/flavours?rev=24518c129918fe3260aa559eded7657e50752cb1#24518c129918fe3260aa559eded7657e50752cb1" -dependencies = [ - "anyhow", - "base16_color_scheme", - "calm_io", - "color-thief", - "dirs 3.0.2", - "glob", - "hex", - "image 0.23.14", - "palette", - "rand 0.10.3", - "serde", - "serde_yaml 0.8.26", - "shell-words", - "shellexpand", - "toml", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foldhash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" - -[[package]] -name = "font-loader" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c49d6b4c11dca1a1dd931a34a9f397e2da91abe3de4110505f3530a80e560b52" -dependencies = [ - "core-foundation 0.9.4", - "core-text", - "libc", - "servo-fontconfig", - "winapi", -] - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "freetype-sys" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" -dependencies = [ - "cmake", - "libc", - "pkg-config", -] - -[[package]] -name = "fs-tail" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73c8ee8694b2ad6d79aa976ad8572ca376c0450290041e6e3ae75147356b6ad2" -dependencies = [ - "memchr", -] - -[[package]] -name = "fsevent-sys" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" -dependencies = [ - "libc", -] - -[[package]] -name = "futures-channel" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" - -[[package]] -name = "futures-io" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" - -[[package]] -name = "futures-lite" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - -[[package]] -name = "futures-macro" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "futures-sink" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" - -[[package]] -name = "futures-task" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" - -[[package]] -name = "futures-util" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" -dependencies = [ - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "gethostname" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" -dependencies = [ - "rustix 1.1.6", - "windows-link 0.2.1", -] - -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi 5.3.0", - "wasip2", -] - -[[package]] -name = "getrandom" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" -dependencies = [ - "cfg-if", - "libc", - "r-efi 6.0.0", - "rand_core 0.10.1", -] - -[[package]] -name = "gif" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" -dependencies = [ - "color_quant", - "weezl", -] - -[[package]] -name = "gif" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" -dependencies = [ - "color_quant", - "weezl", -] - -[[package]] -name = "gimli" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1033caf0b349c518623b5396bfb2cf0bddf44f0306d543a250e5743297aafd10" - -[[package]] -name = "git2" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b88256088d75a56f8ecfa070513a775dd9107f6530ef14919dac831af9cfe2b" -dependencies = [ - "bitflags 2.13.2", - "libc", - "libgit2-sys", - "log", - "url", -] - -[[package]] -name = "gl_generator" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" -dependencies = [ - "khronos_api", - "log", - "xml-rs", -] - -[[package]] -name = "glob" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" - -[[package]] -name = "glow" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08" -dependencies = [ - "js-sys", - "slotmap", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "glutin" -version = "0.32.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" -dependencies = [ - "bitflags 2.13.2", - "cfg_aliases", - "cgl", - "dispatch2", - "glutin_egl_sys", - "glutin_glx_sys", - "glutin_wgl_sys", - "libloading", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "once_cell", - "raw-window-handle", - "wayland-sys", - "windows-sys 0.52.0", - "x11-dl", -] - -[[package]] -name = "glutin-winit" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" -dependencies = [ - "cfg_aliases", - "glutin", - "raw-window-handle", - "winit", -] - -[[package]] -name = "glutin_egl_sys" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" -dependencies = [ - "gl_generator", - "windows-sys 0.52.0", -] - -[[package]] -name = "glutin_glx_sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" -dependencies = [ - "gl_generator", - "x11-dl", -] - -[[package]] -name = "glutin_wgl_sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" -dependencies = [ - "gl_generator", -] - -[[package]] -name = "gpu-alloc" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45cf04b2726f02df5508c6de726acdc90cdf97ac771a9a0ffd8ba10a6e696bf9" -dependencies = [ - "bitflags 2.13.2", - "gpu-alloc-types", -] - -[[package]] -name = "gpu-alloc-types" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2bbed164dd10ed526c2e4fe3e721ca4a71c61730e5aafac6844b417b3227058" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "gpu-allocator" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" -dependencies = [ - "log", - "presser", - "thiserror 1.0.69", - "windows 0.58.0", -] - -[[package]] -name = "gpu-descriptor" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" -dependencies = [ - "bitflags 2.13.2", - "gpu-descriptor-types", - "hashbrown 0.15.5", -] - -[[package]] -name = "gpu-descriptor-types" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "h2" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap 2.14.2", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "half" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" -dependencies = [ - "cfg-if", - "crunchy", - "num-traits", - "zerocopy", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "foldhash 0.1.5", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" -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 = "hayro-jpeg2000" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" -dependencies = [ - "fearless_simd", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] - -[[package]] -name = "hex_color" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37f101bf4c633f7ca2e4b5e136050314503dd198e78e325ea602c327c484ef0" -dependencies = [ - "arrayvec", - "rand 0.8.8", - "serde", -] - -[[package]] -name = "hexf-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" - -[[package]] -name = "hotwatch" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9140219159163c92eb58c37955a0cc57c5814c3c44521955aae376064c668756" -dependencies = [ - "log", - "notify", - "notify-debouncer-full", -] - -[[package]] -name = "http" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" -dependencies = [ - "bytes", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "hyper" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" -dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" -dependencies = [ - "http", - "hyper", - "hyper-util", - "rustls", - "tokio", - "tokio-rustls", - "tower-service", -] - -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" -dependencies = [ - "base64 0.23.1", - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "httparse", - "hyper", - "ipnet", - "libc", - "percent-encoding", - "pin-project-lite", - "socket2", - "system-configuration", - "tokio", - "tower-service", - "tracing", - "windows-registry", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core 0.62.2", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "icns" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467efeb2c1e570cebb9863f9173447f8fe92303d66adc97cb89ac824b60e7a0f" -dependencies = [ - "byteorder", - "hayro-jpeg2000", - "png 0.18.1", -] - -[[package]] -name = "icu_collections" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" - -[[package]] -name = "icu_properties" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" - -[[package]] -name = "icu_provider" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "image" -version = "0.23.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "gif 0.11.4", - "jpeg-decoder", - "num-iter", - "num-rational 0.3.2", - "num-traits", - "png 0.16.8", - "scoped_threadpool", - "tiff 0.6.1", -] - -[[package]] -name = "image" -version = "0.25.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" -dependencies = [ - "bytemuck", - "byteorder-lite", - "color_quant", - "exr", - "gif 0.14.2", - "image-webp", - "moxcms", - "num-traits", - "png 0.18.1", - "qoi", - "ravif", - "rayon", - "rgb", - "tiff 0.11.3", - "zune-core", - "zune-jpeg", -] - -[[package]] -name = "image-webp" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" -dependencies = [ - "byteorder-lite", - "quick-error", -] - -[[package]] -name = "imgref" -version = "1.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f" - -[[package]] -name = "indenter" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" -dependencies = [ - "equivalent", - "hashbrown 0.17.1", - "serde", - "serde_core", -] - -[[package]] -name = "inotify" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c033f80b2c113cdf91ab7a33faa9cbc014726dcad99880c8609af2a370edf37d" -dependencies = [ - "libc", -] - -[[package]] -name = "interpolate_name" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "ipnet" -version = "2.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" - -[[package]] -name = "is_debug" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fe266d2e243c931d8190177f20bf7f24eed45e96f39e87dc49a27b32d12d407" - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" - -[[package]] -name = "jiff" -version = "0.2.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383" -dependencies = [ - "defmt", - "jiff-core", - "jiff-static", - "jiff-tzdb-platform", - "log", - "portable-atomic", - "portable-atomic-util", - "serde_core", - "windows-link 0.2.1", -] - -[[package]] -name = "jiff-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c" -dependencies = [ - "defmt", - "log", -] - -[[package]] -name = "jiff-static" -version = "0.2.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c" -dependencies = [ - "jiff-core", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "jiff-tzdb" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8377070c6bae868759445e5a77f66d84f0b72f3a054bfb00e6d038b8282da7" - -[[package]] -name = "jiff-tzdb-platform" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" -dependencies = [ - "jiff-tzdb", -] - -[[package]] -name = "jni" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" -dependencies = [ - "cfg-if", - "combine", - "jni-macros", - "jni-sys 0.4.1", - "log", - "simd_cesu8", - "thiserror 2.0.21", - "walkdir", - "windows-link 0.2.1", -] - -[[package]] -name = "jni-macros" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "simd_cesu8", - "syn 2.0.119", -] - -[[package]] -name = "jni-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" -dependencies = [ - "jni-sys 0.4.1", -] - -[[package]] -name = "jni-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" -dependencies = [ - "jni-sys-macros", -] - -[[package]] -name = "jni-sys-macros" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" -dependencies = [ - "quote", - "syn 2.0.119", -] - -[[package]] -name = "jobserver" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" -dependencies = [ - "getrandom 0.4.3", - "libc", -] - -[[package]] -name = "jpeg-decoder" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" -dependencies = [ - "rayon", -] - -[[package]] -name = "js-sys" -version = "0.3.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" -dependencies = [ - "cfg-if", - "futures-util", - "wasm-bindgen", -] - -[[package]] -name = "khronos-egl" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" -dependencies = [ - "libc", - "libloading", - "pkg-config", -] - -[[package]] -name = "khronos_api" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" - -[[package]] -name = "komorebi" -version = "0.1.1" -dependencies = [ - "base64 0.22.1", - "block2 0.6.2", - "chrono", - "clap", - "color-eyre", - "crossbeam-channel", - "crossbeam-utils", - "ctrlc", - "dirs 6.0.0", - "dispatch2", - "ed25519-dalek", - "hotwatch", - "komorebi-backend", - "komorebi-collections", - "komorebi-config", - "komorebi-layouts", - "komorebi-protocol", - "komorebi-themes", - "komorebi-transport", - "lazy_static", - "nanoid", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-application-services", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", - "objc2-quartz-core 0.3.2", - "parking_lot", - "pastey 0.2.3", - "quickxml_to_serde", - "regex", - "reqwest", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "serde_with", - "shadow-rs", - "strum", - "sysinfo 0.38.4", - "thiserror 2.0.21", - "tracing", - "tracing-appender", - "tracing-subscriber", - "uuid", - "version", -] - -[[package]] -name = "komorebi-backend" -version = "0.1.42" -dependencies = [ - "komorebi-layouts", -] - -[[package]] -name = "komorebi-bar" -version = "0.1.1" -dependencies = [ - "chrono", - "chrono-tz", - "clap", - "color-eyre", - "crossbeam-channel", - "dirs 6.0.0", - "dunce", - "eframe", - "egui-phosphor", - "font-loader", - "hotwatch", - "icns", - "image 0.25.10", - "komorebi-bar-core", - "komorebi-client", - "komorebi-themes", - "lazy_static", - "netdev", - "num", - "num-derive", - "num-traits", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "parking_lot", - "random_word", - "raw-window-handle", - "reqwest", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "sysinfo 0.38.4", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "komorebi-bar-core" -version = "0.1.42" -dependencies = [ - "chrono", - "chrono-tz", - "eframe", - "egui-phosphor", - "reqwest", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "starship-battery", - "sysinfo 0.39.6", -] - -[[package]] -name = "komorebi-client" -version = "0.1.1" -dependencies = [ - "komorebi", - "komorebi-themes", - "serde_json_lenient", -] - -[[package]] -name = "komorebi-collections" -version = "0.1.42" -dependencies = [ - "pastey 0.2.3", - "schemars 1.2.3", - "serde", -] - -[[package]] -name = "komorebi-config" -version = "0.1.42" -dependencies = [ - "clap", - "color-eyre", - "komorebi-layouts", - "komorebi-protocol", - "komorebi-themes", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "serde_with", - "strum", -] - -[[package]] -name = "komorebi-layouts" -version = "0.1.42" -dependencies = [ - "clap", - "color-eyre", - "komorebi-scrolling", - "objc2-core-foundation", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "serde_yaml 0.9.34+deprecated", - "strum", - "tracing", -] - -[[package]] -name = "komorebi-protocol" -version = "0.1.42" -dependencies = [ - "clap", - "color-eyre", - "komorebi-layouts", - "komorebi-themes", - "schemars 1.2.3", - "serde", - "serde_json_lenient", - "serde_with", - "strum", -] - -[[package]] -name = "komorebi-scrolling" -version = "0.1.42" - -[[package]] -name = "komorebi-themes" -version = "0.1.42" -dependencies = [ - "base16-egui-themes", - "catppuccin-egui", - "eframe", - "flavours", - "hex_color", - "schemars 1.2.3", - "serde", - "serde_variant", - "strum", -] - -[[package]] -name = "komorebi-transport" -version = "0.1.42" -dependencies = [ - "color-eyre", - "crossbeam-channel", - "komorebi-protocol", - "tracing", - "uds_windows", -] - -[[package]] -name = "komorebic" -version = "0.1.1" -dependencies = [ - "chrono", - "clap", - "clap_complete", - "color-eyre", - "dirs 6.0.0", - "fs-tail", - "komorebi-client", - "komorebi-config", - "komorebic-core", - "lazy_static", - "reqwest", - "schemars 1.2.3", - "serde_json_lenient", - "shadow-rs", - "sysinfo 0.38.4", - "version", -] - -[[package]] -name = "komorebic-core" -version = "0.1.42" -dependencies = [ - "clap", - "clap_complete", - "color-eyre", - "komorebi-layouts", - "komorebi-protocol", -] - -[[package]] -name = "konst" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128133ed7824fcd73d6e7b17957c5eb7bacb885649bd8c69708b2331a10bcefb" -dependencies = [ - "konst_macro_rules", -] - -[[package]] -name = "konst_macro_rules" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37" - -[[package]] -name = "kqueue" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d763e5b24120b4ddf50de6c92308156765aabfbbccebf401da7cff2d70a41ea" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087" -dependencies = [ - "bitflags 2.13.2", - "libc", -] - -[[package]] -name = "lazy_static" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "lebe" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8" - -[[package]] -name = "libc" -version = "0.2.191" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" - -[[package]] -name = "libfuzzer-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2" -dependencies = [ - "arbitrary", - "cc", -] - -[[package]] -name = "libgit2-sys" -version = "0.18.8+1.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7c568b25d7489bc3fb2988ed69ab111d2944d2f5fec3d5c987fe545ea97b50" -dependencies = [ - "cc", - "libc", - "libz-sys", - "pkg-config", -] - -[[package]] -name = "libloading" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" -dependencies = [ - "cfg-if", - "windows-link 0.2.1", -] - -[[package]] -name = "libm" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" - -[[package]] -name = "libredox" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" -dependencies = [ - "bitflags 2.13.2", - "libc", - "plain", - "redox_syscall 0.9.5", -] - -[[package]] -name = "libz-sys" -version = "1.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f710a23e6dbf193214fd46ca56a9d6864e550abe86202184532ae7275e46de19" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - -[[package]] -name = "linux-raw-sys" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" - -[[package]] -name = "litemap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" - -[[package]] -name = "litrs" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" - -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" - -[[package]] -name = "logos" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7251356ef8cb7aec833ddf598c6cb24d17b689d20b993f9d11a3d764e34e6458" -dependencies = [ - "logos-derive", -] - -[[package]] -name = "logos-codegen" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f80069600c0d66734f5ff52cc42f2dabd6b29d205f333d61fd7832e9e9963f" -dependencies = [ - "beef", - "fnv", - "lazy_static", - "proc-macro2", - "quote", - "regex-syntax", - "syn 2.0.119", -] - -[[package]] -name = "logos-derive" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fb722b06a9dc12adb0963ed585f19fc61dc5413e6a9be9422ef92c091e731d" -dependencies = [ - "logos-codegen", -] - -[[package]] -name = "loop9" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" -dependencies = [ - "imgref", -] - -[[package]] -name = "mac-addr" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3d25b0e0b648a86960ac23b7ad4abb9717601dec6f66c165f5b037f3f03065f" - -[[package]] -name = "mach2" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - -[[package]] -name = "matchers" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "maybe-rayon" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" -dependencies = [ - "cfg-if", - "rayon", -] - -[[package]] -name = "memchr" -version = "2.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" - -[[package]] -name = "memmap2" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - -[[package]] -name = "metal" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" -dependencies = [ - "bitflags 2.13.2", - "block", - "core-graphics-types 0.2.0", - "foreign-types 0.5.0", - "log", - "objc", - "paste", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "minidom" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe549115a674f5ec64c754d85e37d6f42664bd0ef4ffb62b619489ad99c6cb1a" -dependencies = [ - "quick-xml 0.17.2", -] - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -dependencies = [ - "adler32", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "miniz_oxide" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - -[[package]] -name = "mio" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.61.2", -] - -[[package]] -name = "moxcms" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" -dependencies = [ - "num-traits", - "pxfm", -] - -[[package]] -name = "multiversion_no_op" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" - -[[package]] -name = "naga" -version = "27.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" -dependencies = [ - "arrayvec", - "bit-set", - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "codespan-reporting", - "half", - "hashbrown 0.16.1", - "hexf-parse", - "indexmap 2.14.2", - "libm", - "log", - "num-traits", - "once_cell", - "rustc-hash 1.1.0", - "spirv", - "thiserror 2.0.21", - "unicode-ident", -] - -[[package]] -name = "nanoid" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8" -dependencies = [ - "rand 0.8.8", -] - -[[package]] -name = "native-tls" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "ndk" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" -dependencies = [ - "bitflags 2.13.2", - "jni-sys 0.3.1", - "log", - "ndk-sys", - "num_enum", - "raw-window-handle", - "thiserror 1.0.69", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-sys" -version = "0.6.0+11769913" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" -dependencies = [ - "jni-sys 0.3.1", -] - -[[package]] -name = "netdev" -version = "0.40.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b0a0096d9613ee878dba89bbe595f079d373e3f1960d882e4f2f78ff9c30a0a" -dependencies = [ - "block2 0.6.2", - "dispatch2", - "dlopen2", - "ipnet", - "libc", - "mac-addr", - "netlink-packet-core", - "netlink-packet-route", - "netlink-sys", - "objc2-core-foundation", - "objc2-system-configuration", - "once_cell", - "plist", - "windows-sys 0.59.0", -] - -[[package]] -name = "netlink-packet-core" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b897d7bd4f0af82e68d40d0344cf37e97f9c97ddf74a098de3e4da05e96ca395" -dependencies = [ - "paste", -] - -[[package]] -name = "netlink-packet-route" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9854ea6ad14e3f4698a7f03b65bce0833dd2d81d594a0e4a984170537146b6" -dependencies = [ - "bitflags 2.13.2", - "libc", - "log", - "netlink-packet-core", -] - -[[package]] -name = "netlink-sys" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd6c30ed10fa69cc491d491b85cc971f6bdeb8e7367b7cde2ee6cc878d583fae" -dependencies = [ - "bytes", - "libc", - "log", -] - -[[package]] -name = "new_debug_unreachable" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" - -[[package]] -name = "nix" -version = "0.31.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" -dependencies = [ - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "no_std_io2" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003" -dependencies = [ - "memchr", -] - -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "nom" -version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" -dependencies = [ - "memchr", -] - -[[package]] -name = "noop_proc_macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" - -[[package]] -name = "notify" -version = "6.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" -dependencies = [ - "bitflags 2.13.2", - "crossbeam-channel", - "filetime", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "log", - "mio 0.8.11", - "walkdir", - "windows-sys 0.48.0", -] - -[[package]] -name = "notify-debouncer-full" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4812c1eb49be776fb8df4961623bdc01ec9dfdc1abe8211ceb09150a2e64219" -dependencies = [ - "crossbeam-channel", - "file-id", - "notify", - "parking_lot", - "walkdir", -] - -[[package]] -name = "ntapi" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" -dependencies = [ - "winapi", -] - -[[package]] -name = "nu-ansi-term" -version = "0.50.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational 0.4.2", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "bytemuck", - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" - -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "num-integer" -version = "0.1.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_enum" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" -dependencies = [ - "num_enum_derive", - "rustversion", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "num_threads" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cabcc654086861f9e1bc5115258de62ef92c79b20f4615a1b0cc57c4e82027d4" -dependencies = [ - "libc", -] - -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - -[[package]] -name = "objc-sys" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" - -[[package]] -name = "objc2" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" -dependencies = [ - "objc-sys", - "objc2-encode", -] - -[[package]] -name = "objc2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" -dependencies = [ - "objc2-encode", -] - -[[package]] -name = "objc2-app-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "libc", - "objc2 0.5.3", - "objc2-core-data", - "objc2-core-image", - "objc2-foundation 0.2.2", - "objc2-quartz-core 0.2.2", -] - -[[package]] -name = "objc2-app-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" -dependencies = [ - "bitflags 2.13.2", - "libc", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", - "objc2-quartz-core 0.3.2", -] - -[[package]] -name = "objc2-application-services" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69282c2b5bc58fba07cb9de2113619532eb551e98efe3d8d695509ef45fbd53b" -dependencies = [ - "bitflags 2.13.2", - "libc", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-cloud-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-core-location", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-contacts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-core-data" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-core-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "dispatch2", - "libc", - "objc2 0.6.5", -] - -[[package]] -name = "objc2-core-graphics" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" -dependencies = [ - "bitflags 2.13.2", - "dispatch2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-io-surface", -] - -[[package]] -name = "objc2-core-image" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", - "objc2-metal", -] - -[[package]] -name = "objc2-core-location" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-contacts", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-encode" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" - -[[package]] -name = "objc2-foundation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "dispatch", - "libc", - "objc2 0.5.3", -] - -[[package]] -name = "objc2-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-io-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "dispatch2", - "libc", - "objc2 0.6.5", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-io-surface" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-link-presentation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-metal" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-open-directory" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb82bed227edf5201dfedf072bba4015a33d3d4a98519837295a90f0a23f676d" -dependencies = [ - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-quartz-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", - "objc2-metal", -] - -[[package]] -name = "objc2-quartz-core" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-security" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe137109bd1e8b5a99390f77a7d8b2961dafc1a1c5db8f2e60329ad6d895a" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-symbols" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" -dependencies = [ - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-system-configuration" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7216bd11cbda54ccabcab84d523dc93b858ec75ecfb3a7d89513fa22464da396" -dependencies = [ - "bitflags 2.13.2", - "dispatch2", - "libc", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-security", -] - -[[package]] -name = "objc2-ui-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-cloud-kit", - "objc2-core-data", - "objc2-core-image", - "objc2-core-location", - "objc2-foundation 0.2.2", - "objc2-link-presentation", - "objc2-quartz-core 0.2.2", - "objc2-symbols", - "objc2-uniform-type-identifiers", - "objc2-user-notifications", -] - -[[package]] -name = "objc2-uniform-type-identifiers" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-user-notifications" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-core-location", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "object" -version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "once_cell_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" - -[[package]] -name = "openssl" -version = "0.10.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" -dependencies = [ - "bitflags 2.13.2", - "cfg-if", - "foreign-types 0.3.2", - "libc", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "openssl-probe" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1" - -[[package]] -name = "openssl-sys" -version = "0.9.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - -[[package]] -name = "orbclient" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" -dependencies = [ - "libc", - "libredox", -] - -[[package]] -name = "ordered-float" -version = "5.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f59006ce1e204c30956638535b74d317bca99477b9356dfaec54c37f6f600ab" -dependencies = [ - "num-traits", -] - -[[package]] -name = "ordered-stream" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" -dependencies = [ - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "owned_ttf_parser" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" -dependencies = [ - "ttf-parser", -] - -[[package]] -name = "owo-colors" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c45bb4a6ae1280ec0803b1ef9d3455eb50f01efbbe1447ab020f1d54fba9d8" - -[[package]] -name = "palette" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddeed8580d347d2abf3dcf06a5f0b3dc020258338526b277847cd4248a70fc64" -dependencies = [ - "approx", - "palette_derive", - "palette_math", - "phf 0.13.1", -] - -[[package]] -name = "palette_derive" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88537020289b719d81be994ccf1bbf4990f477e2f69ee52fe3e45f43a02e56be" -dependencies = [ - "by_address", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "palette_math" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e6eb142958d64335fb0e345c5b9ead2ecd6fc438c307e9d7d3c4fd428dbaf12" - -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - -[[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "backtrace", - "cfg-if", - "libc", - "petgraph", - "redox_syscall 0.5.18", - "smallvec", - "windows-link 0.2.1", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pastey" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" - -[[package]] -name = "pastey" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "petgraph" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" -dependencies = [ - "fixedbitset", - "indexmap 2.14.2", -] - -[[package]] -name = "phf" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7" -dependencies = [ - "phf_shared 0.12.1", -] - -[[package]] -name = "phf" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" -dependencies = [ - "phf_shared 0.13.1", -] - -[[package]] -name = "phf_shared" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" - -[[package]] -name = "piper" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "pkg-config" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" - -[[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" - -[[package]] -name = "plist" -version = "1.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327a4cb2ad49dc48adfdc9da89e22c64d488b508c67a044d71ba729e4521a285" -dependencies = [ - "base64 0.23.1", - "indexmap 2.14.2", - "quick-xml 0.42.0", - "serde", - "time", -] - -[[package]] -name = "png" -version = "0.16.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "deflate", - "miniz_oxide 0.3.7", -] - -[[package]] -name = "png" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" -dependencies = [ - "bitflags 2.13.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide 0.8.9", -] - -[[package]] -name = "polling" -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" -dependencies = [ - "cfg-if", - "concurrent-queue", - "hermit-abi", - "pin-project-lite", - "rustix 1.1.6", - "windows-sys 0.61.2", -] - -[[package]] -name = "portable-atomic" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" - -[[package]] -name = "portable-atomic-util" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "potential_utf" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" -dependencies = [ - "zerovec", -] - -[[package]] -name = "powerfmt" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "presser" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" - -[[package]] -name = "proc-macro-crate" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" -dependencies = [ - "toml_edit", -] - -[[package]] -name = "proc-macro2" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "profiling" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" -dependencies = [ - "profiling-procmacros", -] - -[[package]] -name = "profiling-procmacros" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb" -dependencies = [ - "quote", - "syn 2.0.119", -] - -[[package]] -name = "pulp" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a" -dependencies = [ - "bytemuck", - "cfg-if", - "libm", - "num-complex", - "paste", - "pulp-wasm-simd-flag", - "raw-cpuid", - "reborrow", - "version_check", -] - -[[package]] -name = "pulp-wasm-simd-flag" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740" - -[[package]] -name = "pxfm" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" - -[[package]] -name = "qoi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - -[[package]] -name = "quick-xml" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe1e430bdcf30c9fdc25053b9c459bb1a4672af4617b6c783d7d91dc17c6bbb0" -dependencies = [ - "memchr", -] - -[[package]] -name = "quick-xml" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" -dependencies = [ - "memchr", -] - -[[package]] -name = "quick-xml" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" -dependencies = [ - "memchr", -] - -[[package]] -name = "quickxml_to_serde" -version = "0.6.1" -source = "git+https://github.com/LGUG2Z/quickxml_to_serde.git#312fabc913738c544dfcf299f5e73de4f6932236" -dependencies = [ - "minidom", - "regex", - "serde", - "serde_derive", - "serde_json_lenient", -] - -[[package]] -name = "quote" -version = "1.0.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -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 = "ramhorns" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d64e28e1069d26c22d4f085ca7f9e2e2eaee16f9d6f80e5fdce62cbf8670f" -dependencies = [ - "arrayvec", - "beef", - "fnv", - "logos", -] - -[[package]] -name = "rand" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" -dependencies = [ - "rand_chacha 0.9.0", - "rand_core 0.9.5", -] - -[[package]] -name = "rand" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" -dependencies = [ - "chacha20", - "getrandom 0.4.3", - "rand_core 0.10.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core 0.9.5", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] - -[[package]] -name = "rand_core" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" -dependencies = [ - "getrandom 0.3.4", -] - -[[package]] -name = "rand_core" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" - -[[package]] -name = "random_word" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a624195e0ebed209339a96296c5cee20400354f834b49cc5a7da4f4c38b14d88" -dependencies = [ - "ahash", - "brotli", - "rand 0.10.3", - "unicase", -] - -[[package]] -name = "range-alloc" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" - -[[package]] -name = "rav1e" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b" -dependencies = [ - "aligned-vec", - "arbitrary", - "arg_enum_proc_macro", - "arrayvec", - "av-scenechange", - "av1-grain", - "bitstream-io", - "built", - "cfg-if", - "interpolate_name", - "itertools", - "libc", - "libfuzzer-sys", - "log", - "maybe-rayon", - "new_debug_unreachable", - "noop_proc_macro", - "num-derive", - "num-traits", - "paste", - "profiling", - "rand 0.9.5", - "rand_chacha 0.9.0", - "simd_helpers", - "thiserror 2.0.21", - "v_frame", - "wasm-bindgen", -] - -[[package]] -name = "ravif" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45" -dependencies = [ - "avif-serialize", - "imgref", - "loop9", - "quick-error", - "rav1e", - "rayon", - "rgb", -] - -[[package]] -name = "raw-cpuid" -version = "11.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "raw-window-handle" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" - -[[package]] -name = "rayon" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "reborrow" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430" - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "redox_syscall" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom 0.2.17", - "libredox", - "thiserror 1.0.69", -] - -[[package]] -name = "redox_users" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" -dependencies = [ - "libredox", - "thiserror 2.0.21", -] - -[[package]] -name = "ref-cast" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "regex" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" - -[[package]] -name = "renderdoc-sys" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" - -[[package]] -name = "reqwest" -version = "0.12.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" -dependencies = [ - "base64 0.22.1", - "bytes", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-tls", - "hyper-util", - "js-sys", - "log", - "mime", - "native-tls", - "percent-encoding", - "pin-project-lite", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tokio-native-tls", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "rgb" -version = "0.8.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "ring" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.17", - "libc", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hash" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags 2.13.2", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustix" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" -dependencies = [ - "bitflags 2.13.2", - "errno", - "libc", - "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustls" -version = "0.23.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" -dependencies = [ - "once_cell", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-pki-types" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" -dependencies = [ - "zeroize", -] - -[[package]] -name = "rustls-webpki" -version = "0.103.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" - -[[package]] -name = "ryu" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schannel" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "schemars" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" -dependencies = [ - "dyn-clone", - "ref-cast", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 3.0.9", -] - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sctk-adwaita" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" -dependencies = [ - "ab_glyph", - "log", - "memmap2", - "smithay-client-toolkit 0.19.2", - "tiny-skia", -] - -[[package]] -name = "security-framework" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" -dependencies = [ - "bitflags 2.13.2", - "core-foundation 0.10.1", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" - -[[package]] -name = "serde" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_derive_internals" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_json" -version = "1.0.154" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "serde_json_lenient" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e033097bf0d2b59a62b42c18ebbb797503839b26afdda2c4e1415cb6c813540" -dependencies = [ - "indexmap 2.14.2", - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_repr" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_variant" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0068df419f9d9b6488fdded3f1c818522cdea328e02ce9d9f147380265a432" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_with" -version = "3.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9adc193c780ef8f159aee8b61e2d5801aaa555e6eb0947fe45530ec506296f" -dependencies = [ - "base64 0.23.1", - "bs58", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.14.2", - "jiff", - "schemars 0.9.0", - "schemars 1.2.3", - "serde_core", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17bbc68e28663bbbb90df47e058aa7eda4fb445b89fe70457bb94fbccf6e49" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_yaml" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" -dependencies = [ - "indexmap 1.9.3", - "ryu", - "serde", - "yaml-rust", -] - -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap 2.14.2", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "servo-fontconfig" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e3e22fe5fd73d04ebf0daa049d3efe3eae55369ce38ab16d07ddd9ac5c217c" -dependencies = [ - "libc", - "servo-fontconfig-sys", -] - -[[package]] -name = "servo-fontconfig-sys" -version = "5.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36b879db9892dfa40f95da1c38a835d41634b825fbd8c4c418093d53c24b388" -dependencies = [ - "expat-sys", - "freetype-sys", - "pkg-config", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest", -] - -[[package]] -name = "shadow-rs" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c798acfc78a69c7b038adde44084d8df875555b091da42c90ae46257cdcc41a" -dependencies = [ - "const_format", - "git2", - "is_debug", - "time", - "tzdb", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shell-words" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" - -[[package]] -name = "shellexpand" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" -dependencies = [ - "dirs 4.0.0", -] - -[[package]] -name = "shlex" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "rand_core 0.6.4", -] - -[[package]] -name = "simd-adler32" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" - -[[package]] -name = "simd_cesu8" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" -dependencies = [ - "rustc_version", - "simdutf8", -] - -[[package]] -name = "simd_helpers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" -dependencies = [ - "quote", -] - -[[package]] -name = "simdutf8" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" - -[[package]] -name = "siphasher" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "slotmap" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" -dependencies = [ - "version_check", -] - -[[package]] -name = "smallvec" -version = "1.16.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" - -[[package]] -name = "smithay-client-toolkit" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" -dependencies = [ - "bitflags 2.13.2", - "calloop 0.13.0", - "calloop-wayland-source 0.3.0", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix 0.38.44", - "thiserror 1.0.69", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-wlr", - "wayland-scanner", - "xkeysym", -] - -[[package]] -name = "smithay-client-toolkit" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" -dependencies = [ - "bitflags 2.13.2", - "calloop 0.14.5", - "calloop-wayland-source 0.4.1", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix 1.1.6", - "thiserror 2.0.21", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-experimental", - "wayland-protocols-misc", - "wayland-protocols-wlr", - "wayland-scanner", - "xkeysym", -] - -[[package]] -name = "smithay-clipboard" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" -dependencies = [ - "libc", - "smithay-client-toolkit 0.20.0", - "wayland-backend", -] - -[[package]] -name = "smol_str" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" -dependencies = [ - "serde", -] - -[[package]] -name = "socket2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "spirv" -version = "0.3.0+sdk-1.3.268.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "starship-battery" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e919b7ecd99f2d5ed9efdc8d242ae93d91684181a782dadcbcd72079930155f9" -dependencies = [ - "cfg-if", - "lazycell", - "libc", - "mach2", - "nix", - "num-traits", - "objc2-core-foundation", - "objc2-io-kit", - "plist", - "uom", - "windows-sys 0.61.2", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strict-num" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "strum" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" -dependencies = [ - "strum_macros", -] - -[[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.119", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "symlink" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.119" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "3.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -dependencies = [ - "futures-core", -] - -[[package]] -name = "synstructure" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "sysinfo" -version = "0.38.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ab6a2f8bfe508deb3c6406578252e491d299cbbf3bc0529ecc3313aee4a52f" -dependencies = [ - "libc", - "memchr", - "ntapi", - "objc2-core-foundation", - "objc2-io-kit", - "windows 0.62.2", -] - -[[package]] -name = "sysinfo" -version = "0.39.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2071df9448915b71c4fe6d25deaf1c22f12bd234f01540b77312bb8e41361e6" -dependencies = [ - "libc", - "memchr", - "ntapi", - "objc2-core-foundation", - "objc2-io-kit", - "objc2-open-directory", - "windows 0.62.2", -] - -[[package]] -name = "system-configuration" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" -dependencies = [ - "bitflags 2.13.2", - "core-foundation 0.9.4", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tempfile" -version = "3.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" -dependencies = [ - "fastrand", - "getrandom 0.4.3", - "once_cell", - "rustix 1.1.6", - "windows-sys 0.61.2", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "terminal_size" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" -dependencies = [ - "rustix 1.1.6", - "windows-sys 0.61.2", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" -dependencies = [ - "thiserror-impl 2.0.21", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "thread_local" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "tiff" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437" -dependencies = [ - "jpeg-decoder", - "miniz_oxide 0.4.4", - "weezl", -] - -[[package]] -name = "tiff" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" -dependencies = [ - "fax", - "flate2", - "half", - "quick-error", - "weezl", - "zune-jpeg", -] - -[[package]] -name = "time" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" -dependencies = [ - "deranged", - "libc", - "num-conv", - "num_threads", - "powerfmt", - "serde_core", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" - -[[package]] -name = "time-macros" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tiny-skia" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" -dependencies = [ - "arrayref", - "arrayvec", - "bytemuck", - "cfg-if", - "log", - "tiny-skia-path", -] - -[[package]] -name = "tiny-skia-path" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" -dependencies = [ - "arrayref", - "bytemuck", - "strict-num", -] - -[[package]] -name = "tinystr" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tinyvec" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" - -[[package]] -name = "tokio" -version = "1.54.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" -dependencies = [ - "bytes", - "libc", - "mio 1.2.4", - "pin-project-lite", - "socket2", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-rustls" -version = "0.26.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "libc", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_datetime" -version = "1.1.2+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_edit" -version = "0.25.17+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" -dependencies = [ - "indexmap 2.14.2", - "toml_datetime", - "toml_parser", - "winnow", -] - -[[package]] -name = "toml_parser" -version = "1.1.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" -dependencies = [ - "winnow", -] - -[[package]] -name = "tower" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-http" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" -dependencies = [ - "bitflags 2.13.2", - "bytes", - "futures-util", - "http", - "http-body", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", - "url", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-appender" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "050686193eb999b4bb3bc2acfa891a13da00f79734704c4b8b4ef1a10b368a3c" -dependencies = [ - "crossbeam-channel", - "symlink", - "thiserror 2.0.21", - "time", - "tracing-subscriber", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-error" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" -dependencies = [ - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex-automata", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "ttf-parser" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" - -[[package]] -name = "type-map" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" -dependencies = [ - "rustc-hash 2.1.3", -] - -[[package]] -name = "typenum" -version = "1.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" - -[[package]] -name = "tz-rs" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc6c929ffa10fb34f4a3c7e9a73620a83ef2e85e47f9ec3381b8289e6762f42" - -[[package]] -name = "tzdb" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d4e985b6dda743ae7fd4140c28105316ffd75bc58258ee6cc12934e3eb7a0c" -dependencies = [ - "iana-time-zone", - "tz-rs", - "tzdb_data", -] - -[[package]] -name = "tzdb_data" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "febaa995f6852367564e16c3369988b99d471d43ed12b1255b8d294661797f1c" -dependencies = [ - "tz-rs", -] - -[[package]] -name = "uds_windows" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" -dependencies = [ - "memoffset", - "tempfile", - "windows-sys 0.61.2", -] - -[[package]] -name = "unicase" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" - -[[package]] -name = "unicode-ident" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" - -[[package]] -name = "unicode-segmentation" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" - -[[package]] -name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "uom" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a739f83872836c82a4f2527d4e54b37007b3de68cafe7edde95fd695968bf4b9" -dependencies = [ - "num-traits", - "typenum", -] - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "uuid" -version = "1.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" -dependencies = [ - "getrandom 0.4.3", - "js-sys", - "serde_core", - "wasm-bindgen", -] - -[[package]] -name = "v_frame" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" -dependencies = [ - "aligned-vec", - "num-traits", - "wasm-bindgen", -] - -[[package]] -name = "valuable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version" -version = "0.1.0" -dependencies = [ - "shadow-rs", -] - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" -dependencies = [ - "js-sys", - "tokio", - "wasm-bindgen", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn 3.0.9", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wayland-backend" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" -dependencies = [ - "cc", - "downcast-rs", - "rustix 1.1.6", - "scoped-tls", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-client" -version = "0.31.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" -dependencies = [ - "bitflags 2.13.2", - "rustix 1.1.6", - "wayland-backend", - "wayland-scanner", -] - -[[package]] -name = "wayland-csd-frame" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" -dependencies = [ - "bitflags 2.13.2", - "cursor-icon", - "wayland-backend", -] - -[[package]] -name = "wayland-cursor" -version = "0.31.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" -dependencies = [ - "rustix 1.1.6", - "wayland-client", - "xcursor", -] - -[[package]] -name = "wayland-protocols" -version = "0.32.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-experimental" -version = "20250721.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-misc" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-plasma" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-wlr" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.31.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" -dependencies = [ - "proc-macro2", - "quick-xml 0.41.0", - "quote", -] - -[[package]] -name = "wayland-sys" -version = "0.31.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" -dependencies = [ - "dlib", - "log", - "once_cell", - "pkg-config", -] - -[[package]] -name = "web-sys" -version = "0.3.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webbrowser" -version = "1.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c8ddfbbf66e501434657400268cefe51b95140a0266236415cda7627732df7" -dependencies = [ - "jni", - "log", - "ndk-context", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", - "url", - "web-sys", -] - -[[package]] -name = "weezl" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" - -[[package]] -name = "wgpu" -version = "27.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" -dependencies = [ - "arrayvec", - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "document-features", - "hashbrown 0.16.1", - "js-sys", - "log", - "naga", - "parking_lot", - "portable-atomic", - "profiling", - "raw-window-handle", - "smallvec", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-core" -version = "27.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7" -dependencies = [ - "arrayvec", - "bit-set", - "bit-vec", - "bitflags 2.13.2", - "bytemuck", - "cfg_aliases", - "document-features", - "hashbrown 0.16.1", - "indexmap 2.14.2", - "log", - "naga", - "once_cell", - "parking_lot", - "portable-atomic", - "profiling", - "raw-window-handle", - "rustc-hash 1.1.0", - "smallvec", - "thiserror 2.0.21", - "wgpu-core-deps-apple", - "wgpu-core-deps-emscripten", - "wgpu-core-deps-windows-linux-android", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-core-deps-apple" -version = "27.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-emscripten" -version = "27.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06ac3444a95b0813ecfd81ddb2774b66220b264b3e2031152a4a29fda4da6b5" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-windows-linux-android" -version = "27.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-hal" -version = "27.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce" -dependencies = [ - "android_system_properties", - "arrayvec", - "ash", - "bit-set", - "bitflags 2.13.2", - "block", - "bytemuck", - "cfg-if", - "cfg_aliases", - "core-graphics-types 0.2.0", - "glow", - "glutin_wgl_sys", - "gpu-alloc", - "gpu-allocator", - "gpu-descriptor", - "hashbrown 0.16.1", - "js-sys", - "khronos-egl", - "libc", - "libloading", - "log", - "metal", - "naga", - "ndk-sys", - "objc", - "once_cell", - "ordered-float", - "parking_lot", - "portable-atomic", - "portable-atomic-util", - "profiling", - "range-alloc", - "raw-window-handle", - "renderdoc-sys", - "smallvec", - "thiserror 2.0.21", - "wasm-bindgen", - "web-sys", - "wgpu-types", - "windows 0.58.0", - "windows-core 0.58.0", -] - -[[package]] -name = "wgpu-types" -version = "27.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" -dependencies = [ - "bitflags 2.13.2", - "bytemuck", - "js-sys", - "log", - "thiserror 2.0.21", - "web-sys", -] - -[[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.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" -dependencies = [ - "windows-core 0.58.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows" -version = "0.61.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" -dependencies = [ - "windows-collections 0.2.0", - "windows-core 0.61.2", - "windows-future 0.2.1", - "windows-link 0.1.3", - "windows-numerics 0.2.0", -] - -[[package]] -name = "windows" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" -dependencies = [ - "windows-collections 0.3.2", - "windows-core 0.62.2", - "windows-future 0.3.2", - "windows-numerics 0.3.1", -] - -[[package]] -name = "windows-collections" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" -dependencies = [ - "windows-core 0.61.2", -] - -[[package]] -name = "windows-collections" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" -dependencies = [ - "windows-core 0.62.2", -] - -[[package]] -name = "windows-core" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" -dependencies = [ - "windows-implement 0.58.0", - "windows-interface 0.58.0", - "windows-result 0.2.0", - "windows-strings 0.1.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement 0.60.2", - "windows-interface 0.59.3", - "windows-link 0.1.3", - "windows-result 0.3.4", - "windows-strings 0.4.2", -] - -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement 0.60.2", - "windows-interface 0.59.3", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - -[[package]] -name = "windows-future" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", - "windows-threading 0.1.0", -] - -[[package]] -name = "windows-future" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" -dependencies = [ - "windows-core 0.62.2", - "windows-link 0.2.1", - "windows-threading 0.2.1", -] - -[[package]] -name = "windows-implement" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-numerics" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", -] - -[[package]] -name = "windows-numerics" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" -dependencies = [ - "windows-core 0.62.2", - "windows-link 0.2.1", -] - -[[package]] -name = "windows-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" -dependencies = [ - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - -[[package]] -name = "windows-result" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-strings" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" -dependencies = [ - "windows-result 0.2.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-threading" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-threading" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winit" -version = "0.30.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" -dependencies = [ - "ahash", - "android-activity", - "atomic-waker", - "bitflags 2.13.2", - "block2 0.5.1", - "bytemuck", - "calloop 0.13.0", - "cfg_aliases", - "concurrent-queue", - "core-foundation 0.9.4", - "core-graphics 0.23.2", - "cursor-icon", - "dpi", - "js-sys", - "libc", - "memmap2", - "ndk", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", - "objc2-ui-kit", - "orbclient", - "percent-encoding", - "pin-project", - "raw-window-handle", - "redox_syscall 0.4.1", - "rustix 0.38.44", - "sctk-adwaita", - "smithay-client-toolkit 0.19.2", - "smol_str", - "tracing", - "unicode-segmentation", - "wasm-bindgen", - "wasm-bindgen-futures", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-plasma", - "web-sys", - "web-time", - "windows-sys 0.52.0", - "x11-dl", - "x11rb", - "xkbcommon-dl", -] - -[[package]] -name = "winnow" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" -dependencies = [ - "memchr", -] - -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - -[[package]] -name = "writeable" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" - -[[package]] -name = "x11-dl" -version = "2.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" -dependencies = [ - "libc", - "once_cell", - "pkg-config", -] - -[[package]] -name = "x11rb" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" -dependencies = [ - "as-raw-xcb-connection", - "gethostname", - "libc", - "libloading", - "once_cell", - "rustix 1.1.6", - "x11rb-protocol", -] - -[[package]] -name = "x11rb-protocol" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" - -[[package]] -name = "xcursor" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" - -[[package]] -name = "xkbcommon-dl" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" -dependencies = [ - "bitflags 2.13.2", - "dlib", - "log", - "once_cell", - "xkeysym", -] - -[[package]] -name = "xkeysym" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" - -[[package]] -name = "xml-rs" -version = "0.8.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" - -[[package]] -name = "y4m" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "yoke" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", - "synstructure", -] - -[[package]] -name = "zbus" -version = "5.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" -dependencies = [ - "async-broadcast", - "async-executor", - "async-io", - "async-lock", - "async-process", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "enumflags2", - "event-listener", - "futures-core", - "futures-lite", - "hex", - "libc", - "ordered-stream", - "rustix 1.1.6", - "serde", - "serde_repr", - "tracing", - "uds_windows", - "uuid", - "windows-sys 0.61.2", - "winnow", - "zbus_macros", - "zbus_names", - "zvariant", -] - -[[package]] -name = "zbus-lockstep" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" -dependencies = [ - "zbus_xml", - "zvariant", -] - -[[package]] -name = "zbus-lockstep-macros" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", - "zbus-lockstep", - "zbus_xml", - "zvariant", -] - -[[package]] -name = "zbus_macros" -version = "5.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.9", - "zbus_names", - "zvariant", - "zvariant_utils", -] - -[[package]] -name = "zbus_names" -version = "4.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" -dependencies = [ - "serde", - "winnow", - "zvariant", -] - -[[package]] -name = "zbus_xml" -version = "5.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" -dependencies = [ - "serde", - "winnow", - "zbus_names", - "zvariant", -] - -[[package]] -name = "zcheapstr" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" -dependencies = [ - "serde", -] - -[[package]] -name = "zerocopy" -version = "0.8.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "zerofrom" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" - -[[package]] -name = "zerotrie" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "zlib-rs" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" - -[[package]] -name = "zmij" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" - -[[package]] -name = "zune-core" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" - -[[package]] -name = "zune-inflate" -version = "0.2.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "zune-jpeg" -version = "0.5.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" -dependencies = [ - "zune-core", -] - -[[package]] -name = "zvariant" -version = "5.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" -dependencies = [ - "endi", - "enumflags2", - "serde", - "winnow", - "zcheapstr", - "zvariant_derive", - "zvariant_utils", -] - -[[package]] -name = "zvariant_derive" -version = "5.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.9", - "zvariant_utils", -] - -[[package]] -name = "zvariant_utils" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn 3.0.9", - "winnow", -] diff --git a/komorebi-for-mac/Cargo.toml b/komorebi-for-mac/Cargo.toml deleted file mode 100644 index a18ec567..00000000 --- a/komorebi-for-mac/Cargo.toml +++ /dev/null @@ -1,53 +0,0 @@ -[workspace] - -resolver = "2" -members = [ - "komorebi", - "komorebi-bar", - "komorebi-client", - "komorebic", - "version", -] - -[workspace.package] -version = "0.1.0" - -[workspace.dependencies] -komorebi-themes = { path = "../komorebi-themes" } -komorebi-backend = { path = "../crates/komorebi-backend" } -komorebi-collections = { path = "../crates/komorebi-collections" } -komorebi-config = { path = "../crates/komorebi-config", default-features = false, features = ["schemars"] } -komorebi-protocol = { path = "../crates/komorebi-protocol", default-features = false, features = ["schemars"] } -komorebi-transport = { path = "../crates/komorebi-transport" } -komorebi-layouts = { path = "../komorebi-layouts", features = [ - "darwin", - "schemars", -] } - -chrono = "0.4" -chrono-tz = "0.10" -clap = { version = "4", features = ["derive", "wrap_help"] } -color-eyre = "0.6" -crossbeam-channel = "0.5" -crossbeam-utils = "0.8" -dirs = "6" -dunce = "1" -eframe = "0.33" -egui_extras = "0.33" -hotwatch = "0.5" -lazy_static = "1" -parking_lot = "0.12" -pastey = "0.2" -schemars = "1.1" -serde = { version = "1", features = ["derive"] } -serde_json = { package = "serde_json_lenient", version = "0.2" } -shadow-rs = "1" -sysinfo = "0.38" -thiserror = "2" -tracing = "0.1" -tracing-appender = "0.2" -tracing-subscriber = { version = "0.3", features = ["env-filter"] } -which = "8" - -[workspace.metadata.crane] -name = "komorebi-workspace" diff --git a/komorebi-for-mac/deny.toml b/komorebi-for-mac/deny.toml index c4f7d090..8377debc 100644 --- a/komorebi-for-mac/deny.toml +++ b/komorebi-for-mac/deny.toml @@ -44,12 +44,12 @@ allow = [ confidence-threshold = 0.8 [[licenses.clarify]] -crate = "komorebi" +crate = "komorebi-macos" expression = "LicenseRef-Komorebi-2.0" license-files = [] [[licenses.clarify]] -crate = "komorebi-client" +crate = "komorebi-client-macos" expression = "LicenseRef-Komorebi-2.0" license-files = [] @@ -64,12 +64,12 @@ expression = "LicenseRef-Komorebi-2.0" license-files = [] [[licenses.clarify]] -crate = "komorebic" +crate = "komorebic-macos" expression = "LicenseRef-Komorebi-2.0" license-files = [] [[licenses.clarify]] -crate = "komorebi-bar" +crate = "komorebi-bar-macos" expression = "LicenseRef-Komorebi-2.0" license-files = [] @@ -79,7 +79,7 @@ expression = "LicenseRef-Komorebi-2.0" license-files = [] [[licenses.clarify]] -crate = "version" +crate = "version-macos" expression = "LicenseRef-Komorebi-2.0" license-files = [] diff --git a/komorebi-for-mac/flake.nix b/komorebi-for-mac/flake.nix index 2ad5a903..92054bcc 100644 --- a/komorebi-for-mac/flake.nix +++ b/komorebi-for-mac/flake.nix @@ -51,7 +51,7 @@ # the repository, cut down to this workspace and the crates of the root workspace it depends # on by path, with the root manifest those crates inherit their dependencies from - src = pkgs.lib.cleanSourceWith { + real = pkgs.lib.cleanSourceWith { src = repoRoot; filter = path: type: @@ -62,23 +62,72 @@ rootCrate = builtins.any ( crate: relative == crate || pkgs.lib.hasPrefix "${crate}/" relative ) rootCrates; + # the unified komorebic package: its manifest, build script, main and the macOS module + komorebic = + builtins.elem relative [ + "komorebic" + "komorebic/Cargo.toml" + "komorebic/build.rs" + "komorebic/src" + "komorebic/src/main.rs" + ] + || pkgs.lib.hasPrefix "komorebic/src/macos" relative; + + # the unified komorebi-client package: its manifest, lib.rs and the module of this platform + komorebiClient = + builtins.elem relative [ + "komorebi-client" + "komorebi-client/Cargo.toml" + "komorebi-client/src" + "komorebi-client/src/lib.rs" + "komorebi-client/src/macos.rs" + "komorebi-client/tests" + ]; + + # the unified komorebi-bar package: its manifest, main.rs and the macOS module + komorebiBar = + builtins.elem relative [ + "komorebi-bar" + "komorebi-bar/Cargo.toml" + "komorebi-bar/src" + "komorebi-bar/src/main.rs" + ] + || pkgs.lib.hasPrefix "komorebi-bar/src/macos" relative; in - (rootCrate && !(pkgs.lib.hasSuffix "/Cargo.lock" path) || relative == "Cargo.toml" || inTree) + ((rootCrate || komorebic || komorebiClient || komorebiBar) && !(pkgs.lib.hasSuffix "/Cargo.lock" path) || relative == "Cargo.toml" || relative == "Cargo.lock" || inTree) && ( (craneLib.filterCargoSources path type) || (pkgs.lib.hasInfix "/docs/" path) || (builtins.match ".*/docs/.*" path != null) + # embedded by include_str! in komorebic + || (pkgs.lib.hasSuffix "/komorebic/src/macos/applications.json" path) ); }; - # the workspace is in a subdirectory of the source, next to the crates it depends on + # the platform is a part of the one workspace of the repository: cargo loads every member (the + # others are stubs, see nix/workspace-src.nix) and is told which packages are this platform's + src = import (repoRoot + "/nix/workspace-src.nix") { + inherit pkgs repoRoot real; + isReal = + member: + pkgs.lib.hasPrefix "${platformDir}/" member + || member == "komorebic" + || member == "komorebi-client" + || member == "komorebi-bar" + || builtins.any (crate: member == crate || pkgs.lib.hasPrefix "${crate}/" member) rootCrates; + }; + packages = "-p komorebi-macos -p komorebic -p komorebi-client -p komorebi-bar"; workspaceArgs = { - cargoLock = "${src}/${platformDir}/Cargo.lock"; - cargoToml = "${src}/${platformDir}/Cargo.toml"; - postUnpack = "cd $sourceRoot/${platformDir}; sourceRoot=$PWD"; + pname = "komorebi-workspace"; + inherit version; + cargoLock = "${real}/Cargo.lock"; + cargoToml = "${real}/Cargo.toml"; + # vendored from the filtered source, not the stubbed one: no build is needed to evaluate + cargoVendorDir = craneLib.vendorCargoDeps { src = real; }; }; commonArgs = workspaceArgs // { + cargoExtraArgs = "--locked ${packages}"; inherit src version; strictDeps = true; COMMIT_HASH = self.rev or (pkgs.lib.removeSuffix "-dirty" (self.dirtyRev or "unknown")); @@ -127,7 +176,9 @@ inherit craneLib src + real workspaceArgs + packages individualCrateArgs fullBuild ; @@ -192,17 +243,38 @@ checks = { komorebi-workspace-clippy = build.craneLib.cargoClippy build.individualCrateArgs; - komorebi-workspace-fmt = build.craneLib.cargoFmt (build.workspaceArgs // { inherit (build) src; }); + komorebi-workspace-fmt = build.craneLib.cargoFmt (build.workspaceArgs // { inherit (build) src; cargoExtraArgs = build.packages; }); komorebi-workspace-toml-fmt = build.craneLib.taploFmt ( build.workspaceArgs // { - src = pkgs.lib.sources.sourceFilesBySuffices build.src [ ".toml" ]; + src = pkgs.lib.sources.sourceFilesBySuffices build.real [ ".toml" ]; } ); + # cargo deny sees every member of the workspace: leave out the other platforms' packages + # and use this tree's policy komorebi-workspace-deny = build.craneLib.cargoDeny ( - build.workspaceArgs // { inherit (build) src; } + build.workspaceArgs + // { + inherit (build) src; + cargoDenyExtraArgs = + "--workspace " + + pkgs.lib.concatMapStringsSep " " (p: "--exclude ${p}") [ + "komorebi-windows" + "komorebi-gui" + "komorebic-no-console" + "komorebi-shortcuts" + "komorebi-e2e-agent" + "komorebi-testwin" + "komorebi-linux" + "komorebic-linux" + "komorebi-client-linux" + "komorebi-hotkeys" + "version-linux" + ]; + cargoDenyChecks = "--config ${platformDir}/deny.toml bans licenses sources"; + } ); komorebi-workspace-nextest = build.craneLib.cargoNextest build.individualCrateArgs; diff --git a/komorebi-for-mac/justfile b/komorebi-for-mac/justfile index 1675ba26..f31bf0e9 100644 --- a/komorebi-for-mac/justfile +++ b/komorebi-for-mac/justfile @@ -64,14 +64,14 @@ deadlock $RUST_LOG="trace": docgen starlight: rm {{ starlight }}/src/data/cli/macos/*.md - cargo run --package komorebic -- docgen --output {{ starlight }}/src/data/cli/macos + cargo run --package komorebic-macos -- docgen --output {{ starlight }}/src/data/cli/macos schemars-docgen ./schema.json --output {{ starlight }}/src/content/docs/reference/komorebi-macos.mdx --title "komorebi.json (macOS)" --description "komorebi for Mac configuration schema reference" schemars-docgen ./schema.bar.json --output {{ starlight }}/src/content/docs/reference/bar-macos.mdx --title "komorebi.bar.json (macOS)" --description "komorebi-bar for Mac configuration schema reference" jsonschema: - cargo run --package komorebic -- static-config-schema > schema.json - cargo run --package komorebic -- application-specific-configuration-schema > schema.asc.json - cargo run --package komorebi-bar -- --schema > schema.bar.json + cargo run --package komorebic-macos -- static-config-schema > schema.json + cargo run --package komorebic-macos -- application-specific-configuration-schema > schema.asc.json + cargo run --package komorebi-bar-macos -- --schema > schema.bar.json nixgen: schemars-nixgen schema.json -o nix/komorebi-options.nix --name komorebi --description "komorebi for Mac configuration" @@ -79,7 +79,7 @@ nixgen: nix fmt nix/ nix build -f nix/tests/default.nix -version := `cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "komorebi") | .version'` +version := `cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "komorebi-macos") | .version'` schemapub: rm -rf komorebi-schema diff --git a/komorebi-for-mac/komorebi-bar/Cargo.toml b/komorebi-for-mac/komorebi-bar/Cargo.toml index 1aaa97d5..e06bdf88 100644 --- a/komorebi-for-mac/komorebi-bar/Cargo.toml +++ b/komorebi-for-mac/komorebi-bar/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "komorebi-bar" +name = "komorebi-bar-macos" version = "0.1.1" edition = "2024" @@ -7,23 +7,23 @@ edition = "2024" [dependencies] komorebi-bar-core = { path = "../../crates/komorebi-bar-core", default-features = false } -komorebi-client = { path = "../komorebi-client", default-features = false } -komorebi-themes = { workspace = true } +komorebi-client = { path = "../../komorebi-client", default-features = false } +komorebi-themes = { path = "../../komorebi-themes" } -chrono = { workspace = true } -chrono-tz = { workspace = true } -clap = { workspace = true } -color-eyre = { workspace = true } -crossbeam-channel = { workspace = true } -dirs = { workspace = true } -dunce = { workspace = true } -eframe = { workspace = true } +chrono = { version = "0.4" } +chrono-tz = { version = "0.10" } +clap = { version = "4", features = ["derive", "wrap_help"] } +color-eyre = { version = "0.6" } +crossbeam-channel = { version = "0.5" } +dirs = { version = "6" } +dunce = { version = "1" } +eframe = { version = "0.33" } egui-phosphor = { git = "https://github.com/amPerl/egui-phosphor", rev = "d13688738478ecd12b426e3e74c59d6577a85b59" } font-loader = "0.11" -hotwatch = { workspace = true } +hotwatch = { version = "0.5" } icns = "0.4" image = "0.25" -lazy_static = { workspace = true } +lazy_static = { version = "1" } netdev = "0.40" num = "0.4" num-derive = "0.4" @@ -37,15 +37,15 @@ objc2-app-kit = { version = "0.3", default-features = false, features = [ "NSWindow", ] } raw-window-handle = "0.6" -parking_lot = { workspace = true } +parking_lot = { version = "0.12" } random_word = { version = "0.5", features = ["en"] } reqwest = { version = "0.12", features = ["blocking"] } -schemars = { workspace = true, optional = true } -serde = { workspace = true } -serde_json = { workspace = true } -sysinfo = { workspace = true } -tracing = { workspace = true } -tracing-subscriber = { workspace = true } +schemars = { version = "1.1", optional = true } +serde = { version = "1", features = ["derive"] } +serde_json = { package = "serde_json_lenient", version = "0.2" } +sysinfo = { version = "0.38" } +tracing = { version = "0.1" } +tracing-subscriber = { version = "0.3", features = ["env-filter"] } [features] default = ["schemars"] @@ -55,3 +55,7 @@ schemars = [ "komorebi-client/default", "komorebi-themes/default", ] + +[[bin]] +name = "komorebi-bar" +path = "src/main.rs" diff --git a/komorebi-for-mac/komorebi-bar/src/config.rs b/komorebi-for-mac/komorebi-bar/src/config.rs deleted file mode 100644 index b913baa5..00000000 --- a/komorebi-for-mac/komorebi-bar/src/config.rs +++ /dev/null @@ -1,582 +0,0 @@ -use crate::AUTO_SELECT_FILL_COLOUR; -use crate::AUTO_SELECT_TEXT_COLOUR; -use crate::DEFAULT_PADDING; -use crate::render::RenderConfig; -use crate::render::RenderExt; -use eframe::egui::Color32; -use eframe::egui::Context; -use eframe::egui::FontId; -use eframe::egui::TextStyle; -use komorebi_themes::colour::Colour; -use komorebi_themes::colour::Rgb; -use std::num::NonZeroU32; -use std::sync::atomic::Ordering; -// use crate::bar::exec_powershell; -use crate::render::Grouping; -use crate::widgets::widget::WidgetConfig; -use color_eyre::eyre; -use eframe::egui::TextBuffer; -use komorebi_client::Rect; -use komorebi_themes::KomobarTheme; -use serde::Deserialize; -use serde::Serialize; -use std::collections::HashMap; -use std::path::PathBuf; - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// The `komorebi.bar.json` static configuration file reference for komorebi for Mac `v0.1.0` -/// -/// `"$schema": "https://komorebi-for-mac.lgug2z.com/komorebi.bar.0.1.0.schema.json"` -pub struct KomobarConfig { - /// Bar height - #[cfg_attr(feature = "schemars", schemars(extend("default" = 50.0)))] - pub height: Option, - /// Bar padding. Use one value for all sides or use a grouped padding for horizontal and/or - /// vertical definition which can each take a single value for a symmetric padding or two - /// values for each side, i.e.: - /// ```json - /// "padding": { - /// "horizontal": 10.0 - /// } - /// ``` - /// or: - /// ```json - /// "padding": { - /// "horizontal": [left, right] - /// } - /// ``` - /// You can also set individual padding on each side like this: - /// ```json - /// "padding": { - /// "top": 10.0, - /// "bottom": 10.0, - /// "left": 10.0, - /// "right": 10.0 - /// } - /// ``` - pub padding: Option, - /// Bar margin. Use one value for all sides or use a grouped margin for horizontal and/or - /// vertical definition which can each take a single value for a symmetric margin or two - /// values for each side, i.e.: - /// ```json - /// "margin": { - /// "horizontal": 10.0 - /// } - /// ``` - /// or: - /// ```json - /// "margin": { - /// "vertical": [top, bottom] - /// } - /// ``` - /// You can also set individual margin on each side like this: - /// ```json - /// "margin": { - /// "top": 10.0, - /// "bottom": 10.0, - /// "left": 10.0, - /// "right": 10.0 - /// } - /// ``` - pub margin: Option, - /// Bar positioning options - #[serde(alias = "viewport")] - pub position: Option, - /// Frame options (see: https://docs.rs/egui/latest/egui/containers/frame/struct.Frame.html) - pub frame: Option, - /// The monitor index or the full monitor options - #[cfg_attr(feature = "schemars", schemars(extend("default" = MonitorConfigOrIndex::Index(0))))] - pub monitor: Option, - /// Font family - pub font_family: Option, - /// Font size - #[cfg_attr(feature = "schemars", schemars(extend("default" = 12.5)))] - pub font_size: Option, - /// Scale of the icons relative to the font_size [[1.0-2.0]] - #[cfg_attr(feature = "schemars", schemars(extend("default" = 1.4)))] - pub icon_scale: Option, - /// Max label width before text truncation - #[cfg_attr(feature = "schemars", schemars(extend("default" = 400.0)))] - pub max_label_width: Option, - /// Theme - pub theme: Option, - /// Alpha value for the color transparency [[0-255]] - #[cfg_attr(feature = "schemars", schemars(extend("default" = 200)))] - pub transparency_alpha: Option, - /// Spacing between widgets - #[cfg_attr(feature = "schemars", schemars(extend("default" = 10.0)))] - pub widget_spacing: Option, - /// Visual grouping for widgets - pub grouping: Option, - // /// Options for mouse interaction on the bar - // pub mouse: Option, - /// Left side widgets (ordered left-to-right) - pub left_widgets: Vec, - /// Center widgets (ordered left-to-right) - pub center_widgets: Option>, - /// Right side widgets (ordered left-to-right) - pub right_widgets: Vec, -} - -impl KomobarConfig { - pub fn aliases(raw: &str) { - let mut map = HashMap::new(); - map.insert("position", ["viewport"]); - map.insert("end", ["inner_frame"]); - - let mut display = false; - - for aliases in map.values() { - for a in aliases { - if raw.contains(a) { - display = true; - } - } - } - - if display { - println!( - "\nYour bar configuration file contains some options that have been renamed or deprecated:\n" - ); - for (canonical, aliases) in map { - for alias in aliases { - if raw.contains(alias) { - println!(r#""{alias}" is now "{canonical}""#); - } - } - } - } - } - - pub fn show_all_icons_on_komorebi_workspace(widgets: &[WidgetConfig]) -> bool { - widgets - .iter() - .any(|w| matches!(w, WidgetConfig::Komorebi(config) if config.workspaces.is_some_and(|w| w.enable && w.display.is_some_and(|s| matches!(s, - WorkspacesDisplayFormat::AllIcons - | WorkspacesDisplayFormat::AllIconsAndText - | WorkspacesDisplayFormat::AllIconsAndTextOnSelected))))) - } -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Position configuration -pub struct PositionConfig { - /// The desired starting position of the bar (0,0 = top left of the screen) - #[serde(alias = "position")] - pub start: Option, - /// The desired size of the bar from the starting position (usually monitor width x desired height) - #[serde(alias = "inner_size")] - pub end: Option, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Frame configuration -pub struct FrameConfig { - /// Margin inside the painted frame - pub inner_margin: Position, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(untagged)] -/// Monitor configuration or monitor index -pub enum MonitorConfigOrIndex { - /// The monitor index where you want the bar to show - Index(usize), - /// The full monitor options with the index and an optional work_area_offset - MonitorConfig(MonitorConfig), -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Monitor configuration -pub struct MonitorConfig { - /// Komorebi monitor index of the monitor on which to render the bar - pub index: usize, - /// Automatically apply a work area offset for this monitor to accommodate the bar - pub work_area_offset: Option, -} - -pub type Padding = SpacingKind; -pub type Margin = SpacingKind; - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(untagged)] -// WARNING: To any developer messing with this code in the future: The order here matters! -// `Grouped` needs to come last, otherwise serde might mistaken an `IndividualSpacingConfig` for a -// `GroupedSpacingConfig` with both `vertical` and `horizontal` set to `None` ignoring the -// individual values. -/// Spacing kind -pub enum SpacingKind { - /// Spacing applied to all sides - All(f32), - /// Individual spacing applied to each side - Individual(IndividualSpacingConfig), - /// Grouped vertical and horizontal spacing - Grouped(GroupedSpacingConfig), -} - -impl SpacingKind { - pub fn to_individual(&self, default: f32) -> IndividualSpacingConfig { - match self { - SpacingKind::All(m) => IndividualSpacingConfig::all(*m), - SpacingKind::Grouped(grouped_spacing_config) => { - let vm = grouped_spacing_config.vertical.as_ref().map_or( - IndividualSpacingConfig::vertical(default), - |vm| match vm { - GroupedSpacingOptions::Symmetrical(m) => { - IndividualSpacingConfig::vertical(*m) - } - GroupedSpacingOptions::Split(tm, bm) => { - IndividualSpacingConfig::vertical(*tm).bottom(*bm) - } - }, - ); - let hm = grouped_spacing_config.horizontal.as_ref().map_or( - IndividualSpacingConfig::horizontal(default), - |hm| match hm { - GroupedSpacingOptions::Symmetrical(m) => { - IndividualSpacingConfig::horizontal(*m) - } - GroupedSpacingOptions::Split(lm, rm) => { - IndividualSpacingConfig::horizontal(*lm).right(*rm) - } - }, - ); - IndividualSpacingConfig { - top: vm.top, - bottom: vm.bottom, - left: hm.left, - right: hm.right, - } - } - SpacingKind::Individual(m) => *m, - } - } -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Grouped vertical and horizontal spacing -pub struct GroupedSpacingConfig { - /// Vertical grouped spacing - pub vertical: Option, - /// Horizontal grouped spacing - pub horizontal: Option, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(untagged)] -/// Grouped spacing options -pub enum GroupedSpacingOptions { - /// Symmetrical grouped spacing - Symmetrical(f32), - /// Split grouped spacing - Split(f32, f32), -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Individual spacing configuration -pub struct IndividualSpacingConfig { - /// Spacing for the top - pub top: f32, - /// Spacing for the bottom - pub bottom: f32, - /// Spacing for the left - pub left: f32, - /// Spacing for the right - pub right: f32, -} - -#[allow(dead_code)] -impl IndividualSpacingConfig { - pub const ZERO: Self = IndividualSpacingConfig { - top: 0.0, - bottom: 0.0, - left: 0.0, - right: 0.0, - }; - - pub fn all(value: f32) -> Self { - IndividualSpacingConfig { - top: value, - bottom: value, - left: value, - right: value, - } - } - - pub fn horizontal(value: f32) -> Self { - IndividualSpacingConfig { - top: 0.0, - bottom: 0.0, - left: value, - right: value, - } - } - - pub fn vertical(value: f32) -> Self { - IndividualSpacingConfig { - top: value, - bottom: value, - left: 0.0, - right: 0.0, - } - } - - pub fn top(self, value: f32) -> Self { - IndividualSpacingConfig { top: value, ..self } - } - - pub fn bottom(self, value: f32) -> Self { - IndividualSpacingConfig { - bottom: value, - ..self - } - } - - pub fn left(self, value: f32) -> Self { - IndividualSpacingConfig { - left: value, - ..self - } - } - - pub fn right(self, value: f32) -> Self { - IndividualSpacingConfig { - right: value, - ..self - } - } -} - -pub fn get_individual_spacing( - default: f32, - spacing: &Option, -) -> IndividualSpacingConfig { - spacing - .as_ref() - .map_or(IndividualSpacingConfig::all(default), |s| { - s.to_individual(default) - }) -} - -// #[derive(Clone, Debug, Serialize, Deserialize)] -// #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -// #[serde(untagged)] -// pub enum MouseMessage { -// /// Send a message to the komorebi client. -// /// By default, a batch of messages are sent in the following order: -// /// FocusMonitorAtCursor => -// /// MouseFollowsFocus(false) => -// /// {message} => -// /// MouseFollowsFocus({original.value}) -// /// -// /// Example: -// /// ```json -// /// "on_extra2_click": { -// /// "message": { -// /// "type": "NewWorkspace" -// /// } -// /// }, -// /// ``` -// /// or: -// /// ```json -// /// "on_middle_click": { -// /// "focus_monitor_at_cursor": false, -// /// "ignore_mouse_follows_focus": false, -// /// "message": { -// /// "type": "TogglePause" -// /// } -// /// } -// /// ``` -// /// or: -// /// ```json -// /// "on_scroll_up": { -// /// "message": { -// /// "type": "CycleFocusWorkspace", -// /// "content": "Previous" -// /// } -// /// } -// /// ``` -// Komorebi(KomorebiMouseMessage), -// /// Execute a custom command. -// /// CMD (%variable%), Bash ($variable) and PowerShell ($Env:variable) variables will be resolved. -// /// Example: `komorebic toggle-pause` -// Command(String), -// } -// -// #[derive(Clone, Debug, Serialize, Deserialize)] -// #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -// pub struct KomorebiMouseMessage { -// /// Send the FocusMonitorAtCursor message (default:true) -// pub focus_monitor_at_cursor: Option, -// /// Wrap the {message} with a MouseFollowsFocus(false) and MouseFollowsFocus({original.value}) message (default:true) -// pub ignore_mouse_follows_focus: Option, -// /// The message to send to the komorebi client -// pub message: komorebi_client::SocketMessage, -// } -// -// #[derive(Clone, Debug, Serialize, Deserialize)] -// #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -// pub struct MouseConfig { -// /// Command to send on primary/left double button click -// pub on_primary_double_click: Option, -// /// Command to send on secondary/right button click -// pub on_secondary_click: Option, -// /// Command to send on middle button click -// pub on_middle_click: Option, -// /// Command to send on extra1/back button click -// pub on_extra1_click: Option, -// /// Command to send on extra2/forward button click -// pub on_extra2_click: Option, -// -// /// Defines how many points a user needs to scroll vertically to make a "tick" on a mouse/touchpad/touchscreen (default: 30) -// pub vertical_scroll_threshold: Option, -// /// Command to send on scrolling up (every tick) -// pub on_scroll_up: Option, -// /// Command to send on scrolling down (every tick) -// pub on_scroll_down: Option, -// -// /// Defines how many points a user needs to scroll horizontally to make a "tick" on a mouse/touchpad/touchscreen (default: 30) -// pub horizontal_scroll_threshold: Option, -// /// Command to send on scrolling left (every tick) -// pub on_scroll_left: Option, -// /// Command to send on scrolling right (every tick) -// pub on_scroll_right: Option, -// } -// -// impl MouseConfig { -// pub fn has_command(&self) -> bool { -// [ -// &self.on_primary_double_click, -// &self.on_secondary_click, -// &self.on_middle_click, -// &self.on_extra1_click, -// &self.on_extra2_click, -// &self.on_scroll_up, -// &self.on_scroll_down, -// &self.on_scroll_left, -// &self.on_scroll_right, -// ] -// .iter() -// .any(|opt| matches!(opt, Some(MouseMessage::Command(_)))) -// } -// } -// -// impl MouseMessage { -// pub fn execute(&self, mouse_follows_focus: bool) { -// match self { -// MouseMessage::Komorebi(config) => { -// let mut messages = Vec::new(); -// -// if config.focus_monitor_at_cursor.unwrap_or(true) { -// messages.push(SocketMessage::FocusMonitorAtCursor); -// } -// -// if config.ignore_mouse_follows_focus.unwrap_or(true) { -// messages.push(SocketMessage::MouseFollowsFocus(false)); -// messages.push(config.message.clone()); -// messages.push(SocketMessage::MouseFollowsFocus(mouse_follows_focus)); -// } else { -// messages.push(config.message.clone()); -// } -// -// tracing::debug!("Sending messages: {messages:?}"); -// -// if komorebi_client::send_batch(messages).is_err() { -// tracing::error!("could not send commands"); -// } -// } -// MouseMessage::Command(cmd) => { -// tracing::debug!("Executing command: {}", cmd); -// -// let cmd_no_env = cmd.replace_env(); -// -// if exec_powershell(cmd_no_env.to_str().expect("Invalid command")).is_err() { -// tracing::error!("Failed to execute '{}'", cmd); -// } -// } -// }; -// } -// } - -impl KomobarConfig { - pub fn read(path: &PathBuf) -> eyre::Result { - let content = std::fs::read_to_string(path)?; - let mut value: Self = match path.extension().unwrap().to_string_lossy().as_str() { - "json" => serde_json::from_str(&content)?, - _ => panic!("unsupported format"), - }; - - if value.frame.is_none() { - value.frame = Some(FrameConfig { - inner_margin: Position { - x: DEFAULT_PADDING, - y: DEFAULT_PADDING, - }, - }); - } - - Ok(value) - } -} - -impl RenderExt for &KomobarConfig { - fn new_renderconfig( - &self, - ctx: &Context, - background_color: Color32, - icon_scale: Option, - ) -> RenderConfig { - let text_font_id = ctx - .style() - .text_styles - .get(&TextStyle::Body) - .cloned() - .unwrap_or_else(FontId::default); - - let mut icon_font_id = text_font_id.clone(); - icon_font_id.size *= icon_scale.unwrap_or(1.4).clamp(1.0, 2.0); - - let monitor_idx = match &self.monitor { - Some(MonitorConfigOrIndex::MonitorConfig(monitor_config)) => monitor_config.index, - Some(MonitorConfigOrIndex::Index(idx)) => *idx, - None => 0, - }; - - // check if any of the alignments have a komorebi widget with the workspace set to show all icons - let show_all_icons = - KomobarConfig::show_all_icons_on_komorebi_workspace(&self.left_widgets) - || self - .center_widgets - .as_ref() - .is_some_and(|list| KomobarConfig::show_all_icons_on_komorebi_workspace(list)) - || KomobarConfig::show_all_icons_on_komorebi_workspace(&self.right_widgets); - - RenderConfig { - monitor_idx, - spacing: self.widget_spacing.unwrap_or(10.0), - grouping: self.grouping.unwrap_or(Grouping::None), - background_color, - alignment: None, - more_inner_margin: false, - applied_on_widget: false, - text_font_id, - icon_font_id, - show_all_icons, - auto_select_fill: NonZeroU32::new(AUTO_SELECT_FILL_COLOUR.load(Ordering::SeqCst)) - .map(|c| Colour::Rgb(Rgb::from(c.get())).into()), - auto_select_text: NonZeroU32::new(AUTO_SELECT_TEXT_COLOUR.load(Ordering::SeqCst)) - .map(|c| Colour::Rgb(Rgb::from(c.get())).into()), - } - } -} - -pub use komorebi_bar_core::config::types::*; diff --git a/komorebi-for-mac/komorebi-bar/src/main.rs b/komorebi-for-mac/komorebi-bar/src/main.rs index c08f444c..c8fe1a9a 100644 --- a/komorebi-for-mac/komorebi-bar/src/main.rs +++ b/komorebi-for-mac/komorebi-bar/src/main.rs @@ -1,386 +1,9 @@ -mod bar; -mod config; -mod os; -pub use komorebi_bar_core::platform; -pub use komorebi_bar_core::render; -pub use komorebi_bar_core::selected_frame; -pub use komorebi_bar_core::ui; -mod widgets; +//! `komorebi-bar-macos`: the macOS bar of the unified `komorebi-bar` package, kept under its old package +//! name until the cutover. The code is in `komorebi-bar/src/macos`. -use crate::bar::Komobar; -use crate::config::KomobarConfig; -use crate::config::Position; -use crate::config::PositionConfig; -use clap::Parser; -use color_eyre::eyre; -use config::MonitorConfigOrIndex; -use eframe::egui::ViewportBuilder; -use font_loader::system_fonts; -use hotwatch::EventKind; -use hotwatch::Hotwatch; -use komorebi_client::PathExt; -use komorebi_client::SocketMessage; -use komorebi_client::SubscribeOptions; -use komorebi_client::replace_env_in_path; -use objc2::MainThreadMarker; -use objc2_app_kit::NSApplication; -use objc2_app_kit::NSApplicationActivationPolicy; -use objc2_app_kit::NSView; -use raw_window_handle::HasWindowHandle; -use raw_window_handle::RawWindowHandle; -use std::io::BufReader; -use std::io::Read; -use std::path::PathBuf; -use std::sync::atomic::Ordering; -use std::time::Duration; -use tracing_subscriber::EnvFilter; +#[path = "../../../komorebi-bar/src/macos/mod.rs"] +mod macos; -pub use komorebi_bar_core::statics::*; - -#[derive(Parser)] -#[clap(author, about, version)] -struct Opts { - /// Print the JSON schema of the configuration file and exit - #[clap(long)] - schema: bool, - /// Print a list of fonts available on this system and exit - #[clap(long)] - fonts: bool, - /// Path to a JSON or YAML configuration file - #[clap(short, long)] - #[clap(value_parser = replace_env_in_path)] - config: Option, - /// Write an example komorebi.bar.json to disk - #[clap(long)] - quickstart: bool, - /// Print a list of aliases that can be renamed to canonical variants - #[clap(long)] - #[clap(hide = true)] - aliases: bool, -} - -pub enum KomorebiEvent { - Notification(komorebi_client::Notification), - Reconnect, -} - -fn main() -> eyre::Result<()> { - komorebi_bar_core::platform::install(&os::MacBar); - - let opts: Opts = Opts::parse(); - - #[cfg(feature = "schemars")] - if opts.schema { - let bar_config = schemars::schema_for!(KomobarConfig); - let schema = serde_json::to_string_pretty(&bar_config)?; - - println!("{schema}"); - std::process::exit(0); - } - - if opts.fonts { - for font in system_fonts::query_all() { - println!("{font}"); - } - - std::process::exit(0); - } - - if std::env::var("RUST_LIB_BACKTRACE").is_err() { - unsafe { - std::env::set_var("RUST_LIB_BACKTRACE", "1"); - } - } - - color_eyre::install()?; - - if std::env::var("RUST_LOG").is_err() { - unsafe { - std::env::set_var("RUST_LOG", "info"); - } - } - - tracing::subscriber::set_global_default( - tracing_subscriber::fmt::Subscriber::builder() - .with_env_filter(EnvFilter::from_default_env()) - .finish(), - )?; - - let home_dir: PathBuf = std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( - |_| { - dirs::home_dir() - .expect("there is no home directory") - .join(".config") - .join("komorebi") - }, - |home_path| { - let home = home_path.replace_env(); - - assert!( - home.is_dir(), - "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory" - ); - - home - }, - ); - - if opts.quickstart { - let komorebi_bar_json = include_str!("../../docs/komorebi.bar.example.json").to_string(); - std::fs::write(home_dir.join("komorebi.bar.json"), komorebi_bar_json)?; - println!( - "Example komorebi.bar.json file written to {}", - home_dir.display() - ); - - std::process::exit(0); - } - - let default_config_path = home_dir.join("komorebi.bar.json"); - - let config_path = opts.config.or_else(|| { - default_config_path - .is_file() - .then_some(default_config_path.clone()) - }); - - let mut config = match config_path { - None => { - let komorebi_bar_json = - include_str!("../../docs/komorebi.bar.example.json").to_string(); - - std::fs::write(&default_config_path, komorebi_bar_json)?; - tracing::info!( - "created example configuration file: {}", - default_config_path.display() - ); - - KomobarConfig::read(&default_config_path)? - } - Some(ref config) => { - if !opts.aliases { - tracing::info!("found configuration file: {}", config.display()); - } - - KomobarConfig::read(config)? - } - }; - - let config_path = config_path.unwrap_or(default_config_path); - - if opts.aliases { - KomobarConfig::aliases(&std::fs::read_to_string(&config_path)?); - std::process::exit(0); - } - - let state = serde_json::from_str::(&komorebi_client::send_query( - &SocketMessage::State, - )?)?; - - let (usr_monitor_index, work_area_offset) = match &config.monitor { - Some(MonitorConfigOrIndex::MonitorConfig(monitor_config)) => { - (monitor_config.index, monitor_config.work_area_offset) - } - Some(MonitorConfigOrIndex::Index(idx)) => (*idx, None), - None => (0, None), - }; - let monitor_index = state - .monitor_usr_idx_map - .get(&usr_monitor_index) - .map_or(usr_monitor_index, |i| *i); - - MONITOR_RIGHT.store( - state.monitors.elements()[monitor_index].size.right, - Ordering::SeqCst, - ); - - MONITOR_TOP.store( - state.monitors.elements()[monitor_index].size.top, - Ordering::SeqCst, - ); - - MONITOR_LEFT.store( - state.monitors.elements()[monitor_index].size.left, - Ordering::SeqCst, - ); - - MONITOR_INDEX.store(monitor_index, Ordering::SeqCst); - - // use monitor.size for the actual monitor bounds (top-left origin in global coordinates) - // the window level kCGBackstopMenuLevel positions the bar behind the menu bar - match config.position { - None => { - config.position = Some(PositionConfig { - start: Some(Position { - x: state.monitors.elements()[monitor_index].size.left as f32, - y: state.monitors.elements()[monitor_index].size.top as f32, - }), - end: Some(Position { - x: state.monitors.elements()[monitor_index].size.right as f32, - y: 50.0, - }), - }) - } - Some(ref mut position) => { - if position.start.is_none() { - position.start = Some(Position { - x: state.monitors.elements()[monitor_index].size.left as f32, - y: state.monitors.elements()[monitor_index].size.top as f32, - }); - } - - if position.end.is_none() { - position.end = Some(Position { - x: state.monitors.elements()[monitor_index].size.right as f32, - y: 50.0, - }) - } - } - } - - let viewport_builder = ViewportBuilder::default() - .with_decorations(false) - .with_transparent(true) - .with_has_shadow(false) - .with_taskbar(false); - - let native_options = eframe::NativeOptions { - viewport: viewport_builder, - ..Default::default() - }; - - if let Some(rect) = &work_area_offset { - komorebi_client::send_message(&SocketMessage::MonitorWorkAreaOffset(monitor_index, *rect))?; - tracing::info!("work area offset applied to monitor: {}", monitor_index); - } - - let (tx_gui, rx_gui) = crossbeam_channel::unbounded(); - let (tx_config, rx_config) = crossbeam_channel::unbounded(); - - let mut hotwatch = Hotwatch::new()?; - let config_path_cl = config_path.clone(); - - hotwatch.watch(config_path, move |event| match event.kind { - EventKind::Modify(_) | EventKind::Remove(_) => match KomobarConfig::read(&config_path_cl) { - Ok(updated) => { - tracing::info!("configuration file updated: {}", config_path_cl.display()); - - if let Err(error) = tx_config.send(updated) { - tracing::error!("could not send configuration update to gui: {error}") - } - } - Err(error) => { - tracing::error!("{error}"); - } - }, - _ => {} - })?; - - tracing::info!("watching configuration file for changes"); - - eframe::run_native( - "komorebi-bar", - native_options, - Box::new(|cc| { - unsafe { - let app = NSApplication::sharedApplication(MainThreadMarker::new_unchecked()); - app.setActivationPolicy(NSApplicationActivationPolicy::Accessory); - } - - if let Ok(handle) = cc.window_handle() - && let RawWindowHandle::AppKit(appkit_handle) = handle.as_raw() { - // kCGBackstopMenuLevel = -20 (behind menu bar, at notch level) - const K_CG_BACKSTOP_MENU_LEVEL: isize = -20; - - unsafe { - let ns_view: &NSView = appkit_handle.ns_view.cast().as_ref(); - if let Some(ns_window) = ns_view.window() { - ns_window.setLevel(K_CG_BACKSTOP_MENU_LEVEL); - } - } - } - - let ctx_repainter = cc.egui_ctx.clone(); - std::thread::spawn(move || loop { - std::thread::sleep(Duration::from_secs(1)); - ctx_repainter.request_repaint(); - }); - - let ctx_komorebi = cc.egui_ctx.clone(); - std::thread::spawn(move || { - let subscriber_name = format!("komorebi-bar-{}", random_word::get(random_word::Lang::En)); - - let listener = komorebi_client::subscribe_with_options(&subscriber_name, SubscribeOptions { - filter_state_changes: true, - }) - .expect("could not subscribe to komorebi notifications"); - - tracing::info!("subscribed to komorebi notifications: \"{}\"", subscriber_name); - - for client in listener.incoming() { - match client { - Ok(subscription) => { - let mut buffer = Vec::new(); - let mut reader = BufReader::new(subscription); - - // this is when we know a shutdown has been sent - if matches!(reader.read_to_end(&mut buffer), Ok(0)) { - tracing::info!("disconnected from komorebi"); - - // keep trying to reconnect to komorebi - while komorebi_client::send_message( - &SocketMessage::AddSubscriberSocket(subscriber_name.clone()), - ) - .is_err() - { - std::thread::sleep(Duration::from_secs(1)); - } - - tracing::info!("reconnected to komorebi"); - - if let Err(error) = tx_gui.send(KomorebiEvent::Reconnect) { - tracing::error!("could not send komorebi reconnect event to gui thread: {error}") - } - - ctx_komorebi.request_repaint(); - continue; - } - - match String::from_utf8(buffer) { - Ok(notification_string) => { - match serde_json::from_str::( - ¬ification_string, - ) { - Ok(notification) => { - tracing::debug!("received notification from komorebi"); - - if let Err(error) = tx_gui.send(KomorebiEvent::Notification(notification)) { - tracing::error!("could not send komorebi notification update to gui thread: {error}") - } - - ctx_komorebi.request_repaint(); - } - Err(error) => { - tracing::error!("could not deserialize komorebi notification: {error}"); - } - } - } - Err(error) => { - tracing::error!( - "komorebi notification string was invalid utf8: {error}" - ) - } - } - } - Err(error) => { - tracing::error!("{error}"); - } - } - } - }); - - Ok(Box::new(Komobar::new(cc, rx_gui, rx_config, config))) - }), - ) - .map_err(|error| color_eyre::eyre::Error::msg(error.to_string())) +fn main() -> color_eyre::Result<()> { + macos::main() } diff --git a/komorebi-for-mac/komorebi-bar/src/widgets/applications.rs b/komorebi-for-mac/komorebi-bar/src/widgets/applications.rs deleted file mode 100644 index e2d75250..00000000 --- a/komorebi-for-mac/komorebi-bar/src/widgets/applications.rs +++ /dev/null @@ -1,407 +0,0 @@ -use super::ImageIcon; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::widgets::widget::BarWidget; -use eframe::egui::Color32; -use eframe::egui::Context; -use eframe::egui::CornerRadius; -use eframe::egui::FontId; -use eframe::egui::Frame; -use eframe::egui::Image; -use eframe::egui::Label; -use eframe::egui::Margin; -use eframe::egui::RichText; -use eframe::egui::Sense; -use eframe::egui::Stroke; -use eframe::egui::StrokeKind; -use eframe::egui::Ui; -use eframe::egui::Vec2; -use eframe::egui::vec2; -use komorebi_client::PathExt; -use serde::Deserialize; -use serde::Serialize; -use std::process::Command; -use std::sync::Arc; -use std::time::Duration; -use std::time::Instant; -use tracing; - -/// Minimum interval between consecutive application launches to prevent accidental spamming. -const MIN_LAUNCH_INTERVAL: Duration = Duration::from_millis(800); - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Applications widget configuration -pub struct ApplicationsConfig { - /// Enables or disables the applications widget. - pub enable: bool, - /// Whether to show the launch command on hover (optional). - /// Could be overridden per application. Defaults to `false` if not set. - pub show_command_on_hover: Option, - /// Horizontal spacing between application buttons. - pub spacing: Option, - /// Default display format for all applications (optional). - /// Could be overridden per application. Defaults to `Icon`. - pub display: Option, - /// List of configured applications to display. - pub items: Vec, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Application button configuration -pub struct AppConfig { - /// Whether to enable this application button (optional). - /// Inherits from the global `Applications` setting if omitted. - pub enable: Option, - /// Whether to show the launch command on hover (optional). - /// Inherits from the global `Applications` setting if omitted. - pub show_command_on_hover: Option, - /// Display name of the application. - pub name: String, - /// Optional icon: a path to an image or a text-based glyph (e.g., from Nerd Fonts). - /// If not set, and if the `command` is a path to an executable, an icon might be extracted from it. - /// Note: glyphs require a compatible `font_family`. - pub icon: Option, - /// Command to execute (e.g. path to the application or shell command). - pub command: String, - /// Display format for this application button (optional). Overrides global format if set. - pub display: Option, -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Default)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Applications widget display format -pub enum ApplicationsDisplayFormat { - /// Show only the application icon. - #[default] - Icon, - /// Show only the application name as text. - Text, - /// Show both the application icon and name. - IconAndText, -} - -#[derive(Clone, Debug)] -pub struct Applications { - /// Whether the applications widget is enabled. - pub enable: bool, - /// Horizontal spacing between application buttons. - pub spacing: Option, - /// Applications to be rendered in the UI. - pub items: Vec, -} - -impl BarWidget for Applications { - fn render(&mut self, ctx: &Context, ui: &mut Ui, config: &mut RenderConfig) { - if !self.enable { - return; - } - - let icon_config = IconConfig { - font_id: config.icon_font_id.clone(), - size: config.icon_font_id.size, - color: ctx.style().visuals.selection.stroke.color, - }; - - if let Some(spacing) = self.spacing { - ui.spacing_mut().item_spacing.x = spacing; - } - - config.apply_on_widget(false, ui, |ui| { - for app in &mut self.items { - app.render(ctx, ui, &icon_config); - } - }); - } -} - -impl From<&ApplicationsConfig> for Applications { - fn from(applications_config: &ApplicationsConfig) -> Self { - let items = applications_config - .items - .iter() - .enumerate() - .map(|(index, config)| { - let command = UserCommand::new(&config.command); - - App { - enable: config.enable.unwrap_or(applications_config.enable), - #[allow(clippy::obfuscated_if_else)] - name: config - .name - .is_empty() - .then(|| format!("App {}", index + 1)) - .unwrap_or_else(|| config.name.clone()), - icon: Icon::try_from_path(config.icon.as_deref()) - .or_else(|| Icon::try_from_command(&command)), - command, - display: config - .display - .or(applications_config.display) - .unwrap_or_default(), - show_command_on_hover: config - .show_command_on_hover - .or(applications_config.show_command_on_hover) - .unwrap_or(false), - } - }) - .collect(); - - Self { - enable: applications_config.enable, - items, - spacing: applications_config.spacing, - } - } -} - -/// A single resolved application entry used at runtime. -#[derive(Clone, Debug)] -pub struct App { - /// Whether this application is enabled. - pub enable: bool, - /// Display name of the application. Defaults to "App N" if not set. - pub name: String, - /// Icon to display for this application, if available. - pub icon: Option, - /// Command to execute when the application is launched. - pub command: UserCommand, - /// Display format (icon, text, or both). - pub display: ApplicationsDisplayFormat, - /// Whether to show the launch command on hover. - pub show_command_on_hover: bool, -} - -impl App { - /// Renders the application button in the provided `Ui` context with a given icon size. - #[inline] - pub fn render(&mut self, ctx: &Context, ui: &mut Ui, icon_config: &IconConfig) { - if self.enable - && SelectableFrame::new(false) - .show(ui, |ui| { - ui.spacing_mut().item_spacing = Vec2::splat(4.0); - - match self.display { - ApplicationsDisplayFormat::Icon => self.draw_icon(ctx, ui, icon_config), - ApplicationsDisplayFormat::Text => self.draw_name(ui), - ApplicationsDisplayFormat::IconAndText => { - self.draw_icon(ctx, ui, icon_config); - self.draw_name(ui); - } - } - - // Add hover text with command information - let response = ui.response(); - if self.show_command_on_hover { - response.on_hover_text(format!("Launch: {}", self.command.as_ref())); - } - }) - .clicked() - { - // Launch the application when clicked - self.command.launch_if_ready(); - } - } - - /// Draws the application's icon within the UI if available, - /// or falls back to a default placeholder icon. - #[inline] - fn draw_icon(&self, ctx: &Context, ui: &mut Ui, icon_config: &IconConfig) { - if let Some(icon) = &self.icon { - icon.draw(ctx, ui, icon_config); - } else { - Icon::draw_fallback(ui, Vec2::splat(icon_config.size)); - } - } - - /// Displays the application's name as a non-selectable label within the UI. - #[inline] - fn draw_name(&self, ui: &mut Ui) { - ui.add(Label::new(&self.name).selectable(false)); - } -} - -/// Holds image/text data to be used as an icon in the UI. -/// This represents source icon data before rendering. -#[derive(Clone, Debug)] -pub enum Icon { - /// RGBA image used for rendering the icon. - Image(ImageIcon), - /// Text-based icon, e.g. from a font like Nerd Fonts. - Text(String), -} - -impl Icon { - /// Attempts to create an [`Icon`] from a string path or text glyph/glyphs. - /// - /// - Environment variables in the path are resolved using [`PathExt::replace_env`]. - /// - Uses [`ImageIcon::try_load`] to load and cache the icon image based on the resolved path. - /// - If the path is invalid but the string is non-empty, it is interpreted as a text-based icon and - /// returned as [`Icon::Text`]. - /// - Returns `None` if the input is empty, `None`, or image loading fails. - #[inline] - pub fn try_from_path(icon: Option<&str>) -> Option { - let icon = icon.map(str::trim)?; - if icon.is_empty() { - return None; - } - - let path = icon.replace_env(); - if !path.is_file() { - return Some(Icon::Text(icon.to_owned())); - } - - let image_icon = ImageIcon::try_load(path.as_ref(), || match image::open(&path) { - Ok(img) => Some(img), - Err(err) => { - tracing::error!("Failed to load icon from {:?}, error: {}", path, err); - None - } - })?; - - Some(Icon::Image(image_icon)) - } - - /// Attempts to create an [`Icon`] by extracting an image from the executable path of a [`UserCommand`]. - /// - /// - Uses [`ImageIcon::try_load`] to load and cache the icon image based on the resolved executable path. - /// - Returns [`Icon::Image`] if an icon is successfully extracted. - /// - Returns `None` if the executable path is unavailable or icon extraction fails. - #[inline] - pub fn try_from_command(_command: &UserCommand) -> Option { - // let path = command.get_executable()?; - // let image_icon = ImageIcon::try_load(path.as_ref(), || { - // let path_str = path.to_str()?; - // windows_icons::get_icon_by_path(path_str) - // .or_else(|| windows_icons_fallback::get_icon_by_path(path_str)) - // })?; - // Some(Icon::Image(image_icon)) - None - } - - /// Renders the icon in the given [`Ui`] using the provided [`IconConfig`]. - #[inline] - pub fn draw(&self, ctx: &Context, ui: &mut Ui, icon_config: &IconConfig) { - match self { - Icon::Image(image_icon) => { - Frame::NONE - .inner_margin(Margin::same(ui.style().spacing.button_padding.y as i8)) - .show(ui, |ui| { - ui.add( - Image::from_texture(&image_icon.texture(ctx)) - .maintain_aspect_ratio(true) - .fit_to_exact_size(Vec2::splat(icon_config.size)), - ); - }); - } - Icon::Text(icon) => { - let rich_text = RichText::new(icon) - .font(icon_config.font_id.clone()) - .size(icon_config.size) - .color(icon_config.color); - ui.add(Label::new(rich_text).selectable(false)); - } - } - } - - /// Draws a fallback icon when the specified icon cannot be loaded. - /// Displays a simple crossed-out rectangle as a placeholder. - #[inline] - pub fn draw_fallback(ui: &mut Ui, icon_size: Vec2) { - let (response, painter) = ui.allocate_painter(icon_size, Sense::hover()); - let stroke = Stroke::new(1.0, ui.style().visuals.text_color()); - let mut rect = response.rect; - let rounding = CornerRadius::same((rect.width() * 0.1) as u8); - rect = rect.shrink(stroke.width); - let c = rect.center(); - let r = rect.width() / 2.0; - painter.rect_stroke(rect, rounding, stroke, StrokeKind::Outside); - painter.line_segment([c - vec2(r, r), c + vec2(r, r)], stroke); - } -} - -/// Configuration structure for icon rendering -#[derive(Clone, Debug)] -pub struct IconConfig { - /// Font used for text-based icons - pub font_id: FontId, - /// Size of the icon - pub size: f32, - /// Color of the icon used for text-based icons - pub color: Color32, -} - -/// A structure to manage command execution with cooldown prevention. -#[derive(Clone, Debug)] -pub struct UserCommand { - /// The command string to execute - pub command: Arc, - /// Last time this command was executed (used for cooldown control) - pub last_launch: Instant, -} - -impl AsRef for UserCommand { - #[inline] - fn as_ref(&self) -> &str { - &self.command - } -} - -impl UserCommand { - /// Creates a new [`UserCommand`] with environment variables in the command path - /// resolved using [`PathExt::replace_env`]. - #[inline] - pub fn new(command: &str) -> Self { - // Allow immediate launch by initializing last_launch in the past - let last_launch = Instant::now() - 2 * MIN_LAUNCH_INTERVAL; - - Self { - command: Arc::from(command.replace_env().to_str().unwrap_or_default()), - last_launch, - } - } - - // /// Attempts to resolve the executable path from the command string. - // /// - // /// Resolution logic: - // /// - Splits the command by ".exe" and checks if the first part is an existing file. - // /// - If not, attempts to locate the binary using [`which`] on this name. - // /// - If still unresolved, takes the first word (separated by whitespace) and attempts - // /// to find it in the system `PATH` using [`which`]. - // /// - // /// Returns `None` if no executable path can be determined. - // #[inline] - // pub fn get_executable(&self) -> Option> { - // if let Some(binary) = self.command.split(".exe").next().map(Path::new) { - // if binary.is_file() { - // return Some(Cow::Borrowed(binary)); - // } else if let Ok(binary) = which(binary) { - // return Some(Cow::Owned(binary)); - // } - // } - // - // which(self.command.split(' ').next()?).ok().map(Cow::Owned) - // } - - /// Attempts to launch the specified command in a separate thread if enough time has passed - /// since the last launch. This prevents repeated launches from rapid consecutive clicks. - /// - /// Errors during launch are logged using the `tracing` crate. - pub fn launch_if_ready(&mut self) { - let now = Instant::now(); - // Check if enough time has passed since the last launch - if now.duration_since(self.last_launch) < MIN_LAUNCH_INTERVAL { - return; - } - - self.last_launch = now; - let command_string = self.command.clone(); - // Launch the application in a separate thread to avoid blocking the UI - std::thread::spawn(move || { - if let Err(e) = Command::new("cmd").args(["/C", &command_string]).spawn() { - tracing::error!("Failed to launch command '{}': {}", command_string, e); - } - }); - } -} diff --git a/komorebi-for-mac/komorebi-bar/src/widgets/komorebi_layout.rs b/komorebi-for-mac/komorebi-bar/src/widgets/komorebi_layout.rs deleted file mode 100644 index c6b1c6a8..00000000 --- a/komorebi-for-mac/komorebi-bar/src/widgets/komorebi_layout.rs +++ /dev/null @@ -1,329 +0,0 @@ -use crate::config::DisplayFormat; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::widgets::komorebi::KomorebiLayoutConfig; -use eframe::egui::Context; -use eframe::egui::CornerRadius; -use eframe::egui::FontId; -use eframe::egui::Frame; -use eframe::egui::Label; -use eframe::egui::Sense; -use eframe::egui::Stroke; -use eframe::egui::StrokeKind; -use eframe::egui::Ui; -use eframe::egui::Vec2; -use eframe::egui::vec2; -use komorebi_client::SocketMessage; -use serde::Deserialize; -use serde::Deserializer; -use serde::Serialize; -use serde::de::Error; -use serde_json::from_str; -use std::fmt::Display; -use std::fmt::Formatter; - -#[derive(Copy, Clone, Debug, Serialize, PartialEq)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Komorebi layout kind -pub enum KomorebiLayout { - /// Predefined layout - #[cfg_attr(feature = "schemars", schemars(title = "Default"))] - Default(komorebi_client::DefaultLayout), - /// Monocle mode - Monocle, - /// Floating layer - Floating, - /// Paused - Paused, - /// Custom layout - Custom, -} - -impl<'de> Deserialize<'de> for KomorebiLayout { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - - // Attempt to deserialize the string as a DefaultLayout - if let Ok(default_layout) = from_str::(&format!("\"{s}\"")) - { - return Ok(KomorebiLayout::Default(default_layout)); - } - - // Handle other cases - match s.as_str() { - "Monocle" => Ok(KomorebiLayout::Monocle), - "Floating" => Ok(KomorebiLayout::Floating), - "Paused" => Ok(KomorebiLayout::Paused), - "Custom" => Ok(KomorebiLayout::Custom), - _ => Err(Error::custom(format!("Invalid layout: {s}"))), - } - } -} - -impl Display for KomorebiLayout { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - match self { - KomorebiLayout::Default(layout) => write!(f, "{layout}"), - KomorebiLayout::Monocle => write!(f, "Monocle"), - KomorebiLayout::Floating => write!(f, "Floating"), - KomorebiLayout::Paused => write!(f, "Paused"), - KomorebiLayout::Custom => write!(f, "Custom"), - } - } -} - -impl KomorebiLayout { - fn is_default(&mut self) -> bool { - matches!(self, KomorebiLayout::Default(_)) - } - - fn on_click( - &mut self, - show_options: &bool, - monitor_idx: usize, - workspace_idx: Option, - ) -> bool { - if self.is_default() { - !show_options - } else { - self.on_click_option(monitor_idx, workspace_idx); - false - } - } - - fn on_click_option(&mut self, monitor_idx: usize, workspace_idx: Option) { - match self { - KomorebiLayout::Default(option) => { - if let Some(ws_idx) = workspace_idx - && komorebi_client::send_message(&SocketMessage::WorkspaceLayout( - monitor_idx, - ws_idx, - *option, - )) - .is_err() - { - tracing::error!("could not send message to komorebi: WorkspaceLayout"); - } - } - KomorebiLayout::Monocle => { - if komorebi_client::send_batch([ - SocketMessage::FocusMonitorAtCursor, - SocketMessage::ToggleMonocle, - ]) - .is_err() - { - tracing::error!("could not send message to komorebi: ToggleMonocle"); - } - } - KomorebiLayout::Floating => { - if komorebi_client::send_batch([ - SocketMessage::FocusMonitorAtCursor, - SocketMessage::ToggleTiling, - ]) - .is_err() - { - tracing::error!("could not send message to komorebi: ToggleTiling"); - } - } - KomorebiLayout::Paused => { - if komorebi_client::send_message(&SocketMessage::TogglePause).is_err() { - tracing::error!("could not send message to komorebi: TogglePause"); - } - } - KomorebiLayout::Custom => {} - } - } - - fn show_icon(&mut self, is_selected: bool, font_id: FontId, ctx: &Context, ui: &mut Ui) { - // paint custom icons for the layout - let size = Vec2::splat(font_id.size); - let (response, painter) = ui.allocate_painter(size, Sense::hover()); - let color = if is_selected { - ctx.style().visuals.selection.stroke.color - } else { - ui.style().visuals.text_color() - }; - let stroke = Stroke::new(1.0, color); - let mut rect = response.rect; - let rounding = CornerRadius::same((rect.width() * 0.1) as u8); - rect = rect.shrink(stroke.width); - let c = rect.center(); - let r = rect.width() / 2.0; - painter.rect_stroke(rect, rounding, stroke, StrokeKind::Outside); - - match self { - KomorebiLayout::Default(layout) => match layout { - komorebi_client::DefaultLayout::BSP => { - painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); - painter.line_segment([c, c + vec2(r, 0.0)], stroke); - painter.line_segment([c + vec2(r / 2.0, 0.0), c + vec2(r / 2.0, r)], stroke); - } - komorebi_client::DefaultLayout::Columns => { - painter.line_segment([c - vec2(r / 2.0, r), c + vec2(-r / 2.0, r)], stroke); - painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); - painter.line_segment([c - vec2(-r / 2.0, r), c + vec2(r / 2.0, r)], stroke); - } - komorebi_client::DefaultLayout::Rows => { - painter.line_segment([c - vec2(r, r / 2.0), c + vec2(r, -r / 2.0)], stroke); - painter.line_segment([c - vec2(r, 0.0), c + vec2(r, 0.0)], stroke); - painter.line_segment([c - vec2(r, -r / 2.0), c + vec2(r, r / 2.0)], stroke); - } - komorebi_client::DefaultLayout::VerticalStack => { - painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); - painter.line_segment([c, c + vec2(r, 0.0)], stroke); - } - komorebi_client::DefaultLayout::RightMainVerticalStack => { - painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); - painter.line_segment([c - vec2(r, 0.0), c], stroke); - } - komorebi_client::DefaultLayout::HorizontalStack => { - painter.line_segment([c - vec2(r, 0.0), c + vec2(r, 0.0)], stroke); - painter.line_segment([c, c + vec2(0.0, r)], stroke); - } - komorebi_client::DefaultLayout::UltrawideVerticalStack => { - painter.line_segment([c - vec2(r / 2.0, r), c + vec2(-r / 2.0, r)], stroke); - painter.line_segment([c + vec2(r / 2.0, 0.0), c + vec2(r, 0.0)], stroke); - painter.line_segment([c - vec2(-r / 2.0, r), c + vec2(r / 2.0, r)], stroke); - } - komorebi_client::DefaultLayout::Grid => { - painter.line_segment([c - vec2(r, 0.0), c + vec2(r, 0.0)], stroke); - painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); - } - // TODO: @CtByte can you think of a nice icon to draw here? - komorebi_client::DefaultLayout::Scrolling => { - painter.line_segment([c - vec2(r / 2.0, r), c + vec2(-r / 2.0, r)], stroke); - painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); - painter.line_segment([c - vec2(-r / 2.0, r), c + vec2(r / 2.0, r)], stroke); - } - }, - KomorebiLayout::Monocle => {} - KomorebiLayout::Floating => { - let mut rect_left = response.rect; - rect_left.set_width(rect.width() * 0.5); - rect_left.set_height(rect.height() * 0.5); - let mut rect_right = rect_left; - rect_left = rect_left.translate(Vec2::new( - rect.width() * 0.1 + stroke.width, - rect.width() * 0.1 + stroke.width, - )); - rect_right = rect_right.translate(Vec2::new( - rect.width() * 0.35 + stroke.width, - rect.width() * 0.35 + stroke.width, - )); - painter.rect_filled(rect_left, rounding, color); - painter.rect_stroke(rect_right, rounding, stroke, StrokeKind::Outside); - } - KomorebiLayout::Paused => { - let mut rect_left = response.rect; - rect_left.set_width(rect.width() * 0.25); - rect_left.set_height(rect.height() * 0.8); - let mut rect_right = rect_left; - rect_left = rect_left.translate(Vec2::new( - rect.width() * 0.2 + stroke.width, - rect.width() * 0.1 + stroke.width, - )); - rect_right = rect_right.translate(Vec2::new( - rect.width() * 0.55 + stroke.width, - rect.width() * 0.1 + stroke.width, - )); - painter.rect_filled(rect_left, rounding, color); - painter.rect_filled(rect_right, rounding, color); - } - KomorebiLayout::Custom => { - painter.line_segment([c - vec2(0.0, r), c + vec2(0.0, r)], stroke); - painter.line_segment([c + vec2(0.0, r / 2.0), c + vec2(r, r / 2.0)], stroke); - painter.line_segment([c - vec2(0.0, r / 3.0), c - vec2(r, r / 3.0)], stroke); - } - } - } - - pub fn show( - &mut self, - ctx: &Context, - ui: &mut Ui, - render_config: &mut RenderConfig, - layout_config: &KomorebiLayoutConfig, - workspace_idx: Option, - ) { - let monitor_idx = render_config.monitor_idx; - let font_id = render_config.icon_font_id.clone(); - let mut show_options = RenderConfig::load_show_komorebi_layout_options(); - let format = layout_config.display.unwrap_or(DisplayFormat::IconAndText); - - if !self.is_default() { - show_options = false; - } - - render_config.apply_on_widget(false, ui, |ui| { - let layout_frame = SelectableFrame::new(false) - .show(ui, |ui| { - if let DisplayFormat::Icon | DisplayFormat::IconAndText = format { - self.show_icon(true, font_id.clone(), ctx, ui); - } - - if let DisplayFormat::Text | DisplayFormat::IconAndText = format { - ui.add(Label::new(self.to_string()).selectable(false)); - } - }) - .on_hover_text(self.to_string()); - - if layout_frame.clicked() { - show_options = self.on_click(&show_options, monitor_idx, workspace_idx); - } - - if show_options && let Some(workspace_idx) = workspace_idx { - Frame::NONE.show(ui, |ui| { - ui.add( - Label::new(egui_phosphor::regular::ARROW_FAT_LINES_RIGHT.to_string()) - .selectable(false), - ); - - let mut layout_options = layout_config.options.clone().unwrap_or(vec![ - KomorebiLayout::Default(komorebi_client::DefaultLayout::BSP), - KomorebiLayout::Default(komorebi_client::DefaultLayout::Columns), - KomorebiLayout::Default(komorebi_client::DefaultLayout::Rows), - KomorebiLayout::Default(komorebi_client::DefaultLayout::VerticalStack), - KomorebiLayout::Default( - komorebi_client::DefaultLayout::RightMainVerticalStack, - ), - KomorebiLayout::Default(komorebi_client::DefaultLayout::HorizontalStack), - KomorebiLayout::Default( - komorebi_client::DefaultLayout::UltrawideVerticalStack, - ), - KomorebiLayout::Default(komorebi_client::DefaultLayout::Grid), - //KomorebiLayout::Custom, - KomorebiLayout::Monocle, - KomorebiLayout::Floating, - KomorebiLayout::Paused, - ]); - - for layout_option in &mut layout_options { - let is_selected = self == layout_option; - - if SelectableFrame::new(is_selected) - .show(ui, |ui| { - layout_option.show_icon(is_selected, font_id.clone(), ctx, ui) - }) - .on_hover_text(match layout_option { - KomorebiLayout::Default(layout) => layout.to_string(), - KomorebiLayout::Monocle => "Toggle monocle".to_string(), - KomorebiLayout::Floating => "Toggle tiling".to_string(), - KomorebiLayout::Paused => "Toggle pause".to_string(), - KomorebiLayout::Custom => "Custom".to_string(), - }) - .clicked() - { - layout_option.on_click_option(monitor_idx, Some(workspace_idx)); - show_options = false; - }; - } - }); - } - }); - - RenderConfig::store_show_komorebi_layout_options(show_options); - } -} diff --git a/komorebi-for-mac/komorebi-bar/src/widgets/mod.rs b/komorebi-for-mac/komorebi-bar/src/widgets/mod.rs deleted file mode 100644 index 34bbb3a8..00000000 --- a/komorebi-for-mac/komorebi-bar/src/widgets/mod.rs +++ /dev/null @@ -1,171 +0,0 @@ -use eframe::egui::ColorImage; -use eframe::egui::Context; -use eframe::egui::TextureHandle; -use eframe::egui::TextureOptions; -use image::RgbaImage; -use std::collections::HashMap; -use std::path::Path; -use std::sync::Arc; -use std::sync::LazyLock; -use std::sync::RwLock; - -pub mod applications; -pub use komorebi_bar_core::widgets::battery; -pub use komorebi_bar_core::widgets::cpu; -pub use komorebi_bar_core::widgets::date; -pub mod komorebi; -mod komorebi_layout; -pub use komorebi_bar_core::widgets::memory; -pub mod network; -pub mod storage; -pub mod time; -pub use komorebi_bar_core::widgets::update; -pub mod widget; - -/// Global cache for icon images and their associated GPU textures. -pub static ICONS_CACHE: IconsCache = IconsCache::new(); - -/// In-memory cache for icon images and their associated GPU textures. -/// -/// Stores raw [`ColorImage`]s and [`TextureHandle`]s keyed by [`ImageIconId`]. -/// Texture entries are context-dependent and automatically invalidated when the [`Context`] changes. -#[allow(clippy::type_complexity)] -pub struct IconsCache { - textures: LazyLock, HashMap)>>, - images: LazyLock>>>, -} - -impl IconsCache { - /// Creates a new empty IconsCache instance. - #[inline] - pub const fn new() -> Self { - Self { - textures: LazyLock::new(|| RwLock::new((None, HashMap::new()))), - images: LazyLock::new(|| RwLock::new(HashMap::new())), - } - } - - /// Retrieves or creates a texture handle for the given icon ID and image. - /// - /// If a texture for the given ID already exists for the current [`Context`], it is reused. - /// Otherwise, a new texture is created, inserted into the cache, and returned. - /// The cache is reset if the [`Context`] has changed. - #[inline] - pub fn texture(&self, ctx: &Context, id: &ImageIconId, img: &Arc) -> TextureHandle { - if let Some(texture) = self.get_texture(ctx, id) { - return texture; - } - let texture_handle = ctx.load_texture("icon", img.clone(), TextureOptions::default()); - self.insert_texture(ctx, id.clone(), texture_handle.clone()); - texture_handle - } - - /// Returns the cached texture for the given icon ID if it exists and matches the current [`Context`]. - pub fn get_texture(&self, ctx: &Context, id: &ImageIconId) -> Option { - let textures_lock = self.textures.read().unwrap(); - if textures_lock.0.as_ref() == Some(ctx) { - return textures_lock.1.get(id).cloned(); - } - None - } - - /// Inserts a texture handle, resetting the cache if the [`Context`] has changed. - pub fn insert_texture(&self, ctx: &Context, id: ImageIconId, texture: TextureHandle) { - let mut textures_lock = self.textures.write().unwrap(); - - if textures_lock.0.as_ref() != Some(ctx) { - textures_lock.0 = Some(ctx.clone()); - textures_lock.1.clear(); - } - - textures_lock.1.insert(id, texture); - } - - /// Returns the cached image for the given icon ID, if available. - pub fn get_image(&self, id: &ImageIconId) -> Option> { - self.images.read().unwrap().get(id).cloned() - } - - /// Caches a raw [`ColorImage`] associated with the given icon ID. - pub fn insert_image(&self, id: ImageIconId, image: Arc) { - self.images.write().unwrap().insert(id, image); - } -} - -#[inline] -fn rgba_to_color_image(rgba_image: &RgbaImage) -> ColorImage { - let size = [rgba_image.width() as usize, rgba_image.height() as usize]; - let pixels = rgba_image.as_flat_samples(); - ColorImage::from_rgba_unmultiplied(size, pixels.as_slice()) -} - -/// Represents an image-based icon with a unique ID and pixel data. -#[derive(Clone, Debug)] -pub struct ImageIcon { - /// Unique identifier for the image icon, used for texture caching. - pub id: ImageIconId, - /// Shared pixel data of the icon in `ColorImage` format. - pub image: Arc, -} - -impl ImageIcon { - /// Creates a new [`ImageIcon`] from the given ID and image data. - #[inline] - pub fn new(id: ImageIconId, image: Arc) -> Self { - Self { id, image } - } - - /// Loads an [`ImageIcon`] from [`ICONS_CACHE`] or calls `loader` if not cached. - /// The loaded image is converted to a [`ColorImage`], cached, and returned. - #[inline] - pub fn try_load(id: impl Into, loader: F) -> Option - where - F: FnOnce() -> Option, - I: Into, - { - let id = id.into(); - let image = ICONS_CACHE.get_image(&id).or_else(|| { - let img = loader()?; - let img = Arc::new(rgba_to_color_image(&img.into())); - ICONS_CACHE.insert_image(id.clone(), img.clone()); - Some(img) - })?; - - Some(ImageIcon::new(id, image)) - } - - /// Returns a texture handle for the icon, using the given [`Context`]. - /// - /// If the texture is already cached in [`ICONS_CACHE`], it is reused. - /// Otherwise, a new texture is created from the [`ColorImage`] and cached. - #[inline] - pub fn texture(&self, ctx: &Context) -> TextureHandle { - ICONS_CACHE.texture(ctx, &self.id, &self.image) - } -} - -/// Unique identifier for an image-based icon. -/// -/// Used to distinguish cached images and textures by either a file path -/// or a Windows window handle. -#[derive(Clone, Debug, Eq, Hash, PartialEq)] -pub enum ImageIconId { - /// Identifier based on a file system path. - Path(Arc), - /// Window ID - WindowId(u32), -} - -impl From<&Path> for ImageIconId { - #[inline] - fn from(value: &Path) -> Self { - Self::Path(value.into()) - } -} - -impl From for ImageIconId { - #[inline] - fn from(value: u32) -> Self { - Self::WindowId(value) - } -} diff --git a/komorebi-for-mac/komorebi-bar/src/widgets/storage.rs b/komorebi-for-mac/komorebi-bar/src/widgets/storage.rs deleted file mode 100644 index 830e06f8..00000000 --- a/komorebi-for-mac/komorebi-bar/src/widgets/storage.rs +++ /dev/null @@ -1,205 +0,0 @@ -use crate::bar::Alignment; -use crate::config::LabelPrefix; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::widgets::widget::BarWidget; -use eframe::egui::Align; -use eframe::egui::Context; -use eframe::egui::Label; -use eframe::egui::TextFormat; -use eframe::egui::Ui; -use eframe::egui::text::LayoutJob; -use serde::Deserialize; -use serde::Serialize; -use std::process::Command; -use std::time::Duration; -use std::time::Instant; -use sysinfo::Disks; - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Storage widget configuration -pub struct StorageConfig { - /// Enable the Storage widget - pub enable: bool, - /// Data refresh interval in seconds - #[cfg_attr(feature = "schemars", schemars(extend("default" = 10)))] - pub data_refresh_interval: Option, - /// Display label prefix - pub label_prefix: Option, - /// Show disks that are read only - #[cfg_attr(feature = "schemars", schemars(extend("default" = false)))] - pub show_read_only_disks: Option, - /// Show removable disks - #[cfg_attr(feature = "schemars", schemars(extend("default" = true)))] - pub show_removable_disks: Option, - /// Storage display name - pub storage_display_name: Option, - /// Select when the current percentage is over this value [[1-100]] - pub auto_select_over: Option, - /// Hide when the current percentage is under this value [[1-100]] - pub auto_hide_under: Option, -} - -impl From for Storage { - fn from(value: StorageConfig) -> Self { - Self { - enable: value.enable, - disks: Disks::new_with_refreshed_list(), - data_refresh_interval: value.data_refresh_interval.unwrap_or(10), - label_prefix: value.label_prefix.unwrap_or(LabelPrefix::IconAndText), - show_read_only_disks: value.show_read_only_disks.unwrap_or(false), - show_removable_disks: value.show_removable_disks.unwrap_or(true), - storage_display_name: value - .storage_display_name - .unwrap_or(StorageDisplayName::Mount), - auto_select_over: value.auto_select_over.map(|o| o.clamp(1, 100)), - auto_hide_under: value.auto_hide_under.map(|o| o.clamp(1, 100)), - last_updated: Instant::now(), - } - } -} - -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub enum StorageDisplayName { - /// Display label as mount point eg. / - Mount, - /// Display label as name eg. Macintosh HD - Name, - /// Display label as mount then name eg. / Macintosh HD - MountAndName, - /// Display label as name then mount eg. Macintosh HD / - NameAndMount, -} - -struct StorageDisk { - label: String, - selected: bool, -} - -pub struct Storage { - pub enable: bool, - disks: Disks, - data_refresh_interval: u64, - label_prefix: LabelPrefix, - show_read_only_disks: bool, - show_removable_disks: bool, - storage_display_name: StorageDisplayName, - auto_select_over: Option, - auto_hide_under: Option, - last_updated: Instant, -} - -impl Storage { - fn output(&mut self) -> Vec { - let now = Instant::now(); - if now.duration_since(self.last_updated) > Duration::from_secs(self.data_refresh_interval) { - self.disks.refresh(true); - self.last_updated = now; - } - - let mut disks = vec![]; - - for disk in &self.disks { - if disk.is_read_only() && !self.show_read_only_disks { - continue; - } - if disk.is_removable() && !self.show_removable_disks { - continue; - } - let mount = disk.mount_point(); - let name = disk.name(); - let display_name = match self.storage_display_name { - StorageDisplayName::Mount => mount.to_string_lossy(), - StorageDisplayName::Name => name.to_string_lossy(), - StorageDisplayName::MountAndName => { - mount.to_string_lossy() + name.to_string_lossy() - } - StorageDisplayName::NameAndMount => { - name.to_string_lossy() + mount.to_string_lossy() - } - }; - let total = disk.total_space(); - let available = disk.available_space(); - let used = total - available; - let percentage = ((used * 100) / total) as u8; - - let hide = self.auto_hide_under.is_some_and(|u| percentage <= u); - - if !hide { - let selected = self.auto_select_over.is_some_and(|o| percentage >= o); - - disks.push(StorageDisk { - label: match self.label_prefix { - LabelPrefix::Text | LabelPrefix::IconAndText => { - format!("{} {}%", display_name, percentage) - } - LabelPrefix::None | LabelPrefix::Icon => format!("{percentage}%"), - }, - selected, - }) - } - } - - disks.sort_by(|a, b| a.label.cmp(&b.label)); - - disks - } -} - -impl BarWidget for Storage { - fn render(&mut self, ctx: &Context, ui: &mut Ui, config: &mut RenderConfig) { - if self.enable { - let mut output = self.output(); - let is_reversed = matches!(config.alignment, Some(Alignment::Right)); - - if is_reversed { - output.reverse(); - } - - for output in output { - let auto_text_color = config.auto_select_text.filter(|_| output.selected); - - let mut layout_job = LayoutJob::simple( - match self.label_prefix { - LabelPrefix::Icon | LabelPrefix::IconAndText => { - egui_phosphor::regular::HARD_DRIVES.to_string() - } - LabelPrefix::None | LabelPrefix::Text => String::new(), - }, - config.icon_font_id.clone(), - auto_text_color.unwrap_or(ctx.style().visuals.selection.stroke.color), - 100.0, - ); - - layout_job.append( - &output.label, - 10.0, - TextFormat { - font_id: config.text_font_id.clone(), - color: auto_text_color.unwrap_or(ctx.style().visuals.text_color()), - valign: Align::Center, - ..Default::default() - }, - ); - - let auto_focus_fill = config.auto_select_fill; - - config.apply_on_widget(false, ui, |ui| { - if SelectableFrame::new_auto(output.selected, auto_focus_fill) - .show(ui, |ui| ui.add(Label::new(layout_job).selectable(false))) - .clicked() - { - let parts: Vec<&str> = output.label.split(' ').collect(); - let path = parts[..parts.len() - 1].join(" "); - - if let Err(error) = Command::new("open").args([path]).spawn() { - eprintln!("{error}") - } - } - }); - } - } - } -} diff --git a/komorebi-for-mac/komorebi-bar/src/widgets/time.rs b/komorebi-for-mac/komorebi-bar/src/widgets/time.rs deleted file mode 100644 index 384741a9..00000000 --- a/komorebi-for-mac/komorebi-bar/src/widgets/time.rs +++ /dev/null @@ -1,542 +0,0 @@ -use crate::bar::Alignment; -use crate::config::LabelPrefix; -use crate::render::RenderConfig; -use crate::selected_frame::SelectableFrame; -use crate::widgets::widget::BarWidget; -use chrono::Local; -use chrono::NaiveTime; -use chrono_tz::Tz; -use eframe::egui::Align; -use eframe::egui::Context; -use eframe::egui::CornerRadius; -use eframe::egui::Label; -use eframe::egui::Sense; -use eframe::egui::Stroke; -use eframe::egui::TextFormat; -use eframe::egui::Ui; -use eframe::egui::Vec2; -use eframe::egui::text::LayoutJob; -use eframe::epaint::StrokeKind; -use lazy_static::lazy_static; -use serde::Deserialize; -use serde::Serialize; -use std::time::Duration; -use std::time::Instant; - -lazy_static! { - static ref TIME_RANGES: Vec<(&'static str, NaiveTime)> = { - vec![ - ( - egui_phosphor::regular::MOON, - NaiveTime::from_hms_opt(0, 0, 0).expect("invalid"), - ), - ( - egui_phosphor::regular::ALARM, - NaiveTime::from_hms_opt(6, 0, 0).expect("invalid"), - ), - ( - egui_phosphor::regular::BREAD, - NaiveTime::from_hms_opt(6, 1, 0).expect("invalid"), - ), - ( - egui_phosphor::regular::BARBELL, - NaiveTime::from_hms_opt(6, 30, 0).expect("invalid"), - ), - ( - egui_phosphor::regular::COFFEE, - NaiveTime::from_hms_opt(8, 0, 0).expect("invalid"), - ), - ( - egui_phosphor::regular::CLOCK, - NaiveTime::from_hms_opt(8, 30, 0).expect("invalid"), - ), - ( - egui_phosphor::regular::HAMBURGER, - NaiveTime::from_hms_opt(12, 0, 0).expect("invalid"), - ), - ( - egui_phosphor::regular::CLOCK_AFTERNOON, - NaiveTime::from_hms_opt(12, 30, 0).expect("invalid"), - ), - ( - egui_phosphor::regular::FORK_KNIFE, - NaiveTime::from_hms_opt(18, 0, 0).expect("invalid"), - ), - ( - egui_phosphor::regular::MOON_STARS, - NaiveTime::from_hms_opt(18, 30, 0).expect("invalid"), - ), - ] - }; -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Time widget configuration -pub struct TimeConfig { - /// Enable the Time widget - pub enable: bool, - /// Set the Time format - pub format: TimeFormat, - /// Display label prefix - pub label_prefix: Option, - /// TimeZone (https://docs.rs/chrono-tz/latest/chrono_tz/enum.Tz.html) - /// - /// Use a custom format to display additional information, i.e.: - /// ```json - /// { - /// "Time": { - /// "enable": true, - /// "format": { "Custom": "%T %Z (Tokyo)" }, - /// "timezone": "Asia/Tokyo" - /// } - ///} - /// ``` - pub timezone: Option, - /// Change the icon depending on the time. The default icon is used between 8:30 and 12:00 - #[cfg_attr(feature = "schemars", schemars(extend("default" = false)))] - pub changing_icon: Option, -} - -impl From for Time { - fn from(value: TimeConfig) -> Self { - // using 1 second made the widget look "less accurate" and lagging (especially having multiple with seconds). - // This is still better than getting an update every frame - let data_refresh_interval = 500; - - Self { - enable: value.enable, - format: value.format, - label_prefix: value.label_prefix.unwrap_or(LabelPrefix::Icon), - timezone: value.timezone, - changing_icon: value.changing_icon.unwrap_or_default(), - data_refresh_interval_millis: data_refresh_interval, - last_state: TimeOutput::new(), - last_updated: Instant::now() - .checked_sub(Duration::from_millis(data_refresh_interval)) - .unwrap(), - } - } -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Time format -pub enum TimeFormat { - /// Twelve-hour format (with seconds) - TwelveHour, - /// Twelve-hour format (without seconds) - TwelveHourWithoutSeconds, - /// Twenty-four-hour format (with seconds) - TwentyFourHour, - /// Twenty-four-hour format (without seconds) - TwentyFourHourWithoutSeconds, - /// Twenty-four-hour format displayed as a binary clock with circles (with seconds) (https://en.wikipedia.org/wiki/Binary_clock) - BinaryCircle, - /// Twenty-four-hour format displayed as a binary clock with rectangles (with seconds) (https://en.wikipedia.org/wiki/Binary_clock) - BinaryRectangle, - /// Custom format (https://docs.rs/chrono/latest/chrono/format/strftime/index.html) - #[cfg_attr(feature = "schemars", schemars(title = "Default"))] - Custom(String), -} - -impl TimeFormat { - pub fn toggle(&mut self) { - match self { - TimeFormat::TwelveHour => *self = TimeFormat::TwelveHourWithoutSeconds, - TimeFormat::TwelveHourWithoutSeconds => *self = TimeFormat::TwentyFourHour, - TimeFormat::TwentyFourHour => *self = TimeFormat::TwentyFourHourWithoutSeconds, - TimeFormat::TwentyFourHourWithoutSeconds => *self = TimeFormat::BinaryCircle, - TimeFormat::BinaryCircle => *self = TimeFormat::BinaryRectangle, - TimeFormat::BinaryRectangle => *self = TimeFormat::TwelveHour, - _ => {} - }; - } - - fn fmt_string(&self) -> String { - match self { - TimeFormat::TwelveHour => String::from("%l:%M:%S %p"), - TimeFormat::TwelveHourWithoutSeconds => String::from("%l:%M %p"), - TimeFormat::TwentyFourHour => String::from("%T"), - TimeFormat::TwentyFourHourWithoutSeconds => String::from("%H:%M"), - TimeFormat::BinaryCircle => String::from("c%T"), - TimeFormat::BinaryRectangle => String::from("r%T"), - TimeFormat::Custom(format) => format.to_string(), - } - } -} - -#[derive(Clone, Debug)] -struct TimeOutput { - label: String, - icon: String, -} - -impl TimeOutput { - fn new() -> Self { - Self { - label: String::new(), - icon: String::new(), - } - } -} - -#[derive(Clone, Debug)] -pub struct Time { - pub enable: bool, - pub format: TimeFormat, - label_prefix: LabelPrefix, - timezone: Option, - changing_icon: bool, - data_refresh_interval_millis: u64, - last_state: TimeOutput, - last_updated: Instant, -} - -impl Time { - fn output(&mut self) -> TimeOutput { - let mut output = self.last_state.clone(); - let now = Instant::now(); - - if now.duration_since(self.last_updated) - > Duration::from_millis(self.data_refresh_interval_millis) - { - let (formatted, current_time) = match &self.timezone { - Some(timezone) => match timezone.parse::() { - Ok(tz) => { - let dt = Local::now().with_timezone(&tz); - ( - dt.format(&self.format.fmt_string()) - .to_string() - .trim() - .to_string(), - Some(dt.time()), - ) - } - Err(_) => (format!("Invalid timezone: {timezone:?}"), None), - }, - None => { - let dt = Local::now(); - ( - dt.format(&self.format.fmt_string()) - .to_string() - .trim() - .to_string(), - Some(dt.time()), - ) - } - }; - - if current_time.is_none() { - return TimeOutput { - label: formatted, - icon: egui_phosphor::regular::WARNING_CIRCLE.to_string(), - }; - } - - let current_range = match &self.changing_icon { - true => TIME_RANGES - .iter() - .rev() - .find(|&(_, start)| current_time.unwrap() > *start) - .cloned(), - false => None, - } - .unwrap_or((egui_phosphor::regular::CLOCK, NaiveTime::default())); - - output = TimeOutput { - label: formatted, - icon: current_range.0.to_string(), - }; - - self.last_state.clone_from(&output); - self.last_updated = now; - } - - output - } - - fn paint_binary_circle( - &mut self, - size: f32, - number: u32, - max_power: usize, - ctx: &Context, - ui: &mut Ui, - ) { - let full_height = size; - let height = full_height / 4.0; - let width = height; - let offset = height / 2.0 - height / 8.0; - - let (response, painter) = - ui.allocate_painter(Vec2::new(width, full_height + offset * 2.0), Sense::hover()); - let color = ctx.style().visuals.text_color(); - - let c = response.rect.center(); - let r = height / 2.0 - 0.5; - - if number == 1 || number == 3 || number == 5 || number == 7 || number == 9 { - painter.circle_filled(c + Vec2::new(0.0, height * 1.50 + offset), r, color); - } else { - painter.circle_filled(c + Vec2::new(0.0, height * 1.50 + offset), r / 2.5, color); - } - - if number == 2 || number == 3 || number == 6 || number == 7 { - painter.circle_filled(c + Vec2::new(0.0, height * 0.50 + offset), r, color); - } else { - painter.circle_filled(c + Vec2::new(0.0, height * 0.50 + offset), r / 2.5, color); - } - - if number == 4 || number == 5 || number == 6 || number == 7 { - painter.circle_filled(c + Vec2::new(0.0, -height * 0.50 + offset), r, color); - } else if max_power > 2 { - painter.circle_filled(c + Vec2::new(0.0, -height * 0.50 + offset), r / 2.5, color); - } - - if number == 8 || number == 9 { - painter.circle_filled(c + Vec2::new(0.0, -height * 1.50 + offset), r, color); - } else if max_power > 3 { - painter.circle_filled(c + Vec2::new(0.0, -height * 1.50 + offset), r / 2.5, color); - } - } - - fn paint_binary_rect( - &mut self, - size: f32, - number: u32, - max_power: usize, - ctx: &Context, - ui: &mut Ui, - ) { - let full_height = size; - let height = full_height / 4.0; - let width = height * 1.5; - let offset = height / 2.0 - height / 8.0; - - let (response, painter) = - ui.allocate_painter(Vec2::new(width, full_height + offset * 2.0), Sense::hover()); - let color = ctx.style().visuals.text_color(); - let stroke = Stroke::new(1.0, color); - - let round_all = CornerRadius::same((response.rect.width() * 0.1) as u8); - let round_top = CornerRadius { - nw: round_all.nw, - ne: round_all.ne, - ..Default::default() - }; - let round_none = CornerRadius::ZERO; - let round_bottom = CornerRadius { - sw: round_all.nw, - se: round_all.ne, - ..Default::default() - }; - - if max_power == 2 { - let mut rect = response - .rect - .shrink2(Vec2::new(stroke.width, stroke.width + offset)); - rect.set_height(rect.height() - height * 2.0); - rect = rect.translate(Vec2::new(0.0, height * 2.0 + offset)); - painter.rect_stroke(rect, round_all, stroke, StrokeKind::Outside); - } else if max_power == 3 { - let mut rect = response - .rect - .shrink2(Vec2::new(stroke.width, stroke.width + offset)); - rect.set_height(rect.height() - height); - rect = rect.translate(Vec2::new(0.0, height + offset)); - painter.rect_stroke(rect, round_all, stroke, StrokeKind::Outside); - } else { - let mut rect = response - .rect - .shrink2(Vec2::new(stroke.width, stroke.width + offset)); - rect = rect.translate(Vec2::new(0.0, 0.0 + offset)); - painter.rect_stroke(rect, round_all, stroke, StrokeKind::Outside); - } - - let mut rect_bin = response.rect; - rect_bin.set_width(width); - - if number == 1 || number == 5 || number == 9 { - rect_bin.set_height(height); - painter.rect_filled( - rect_bin.translate(Vec2::new(stroke.width, height * 3.0 + offset * 2.0)), - round_bottom, - color, - ); - } - if number == 2 { - rect_bin.set_height(height); - painter.rect_filled( - rect_bin.translate(Vec2::new(stroke.width, height * 2.0 + offset * 2.0)), - if max_power == 2 { - round_top - } else { - round_none - }, - color, - ); - } - if number == 3 { - rect_bin.set_height(height * 2.0); - painter.rect_filled( - rect_bin.translate(Vec2::new(stroke.width, height * 2.0 + offset * 2.0)), - round_bottom, - color, - ); - } - if number == 4 || number == 5 { - rect_bin.set_height(height); - painter.rect_filled( - rect_bin.translate(Vec2::new(stroke.width, height * 1.0 + offset * 2.0)), - if max_power == 3 { - round_top - } else { - round_none - }, - color, - ); - } - if number == 6 { - rect_bin.set_height(height * 2.0); - painter.rect_filled( - rect_bin.translate(Vec2::new(stroke.width, height * 1.0 + offset * 2.0)), - if max_power == 3 { - round_top - } else { - round_none - }, - color, - ); - } - if number == 7 { - rect_bin.set_height(height * 3.0); - painter.rect_filled( - rect_bin.translate(Vec2::new(stroke.width, height + offset * 2.0)), - if max_power == 3 { - round_all - } else { - round_bottom - }, - color, - ); - } - if number == 8 || number == 9 { - rect_bin.set_height(height); - painter.rect_filled( - rect_bin.translate(Vec2::new(stroke.width, 0.0 + offset * 2.0)), - round_top, - color, - ); - } - } -} - -impl BarWidget for Time { - fn render(&mut self, ctx: &Context, ui: &mut Ui, config: &mut RenderConfig) { - if self.enable { - let mut output = self.output(); - if !output.label.is_empty() { - let use_binary_circle = output.label.starts_with('c'); - let use_binary_rectangle = output.label.starts_with('r'); - - let mut layout_job = LayoutJob::simple( - match self.label_prefix { - LabelPrefix::Icon | LabelPrefix::IconAndText => output.icon, - LabelPrefix::None | LabelPrefix::Text => String::new(), - }, - config.icon_font_id.clone(), - ctx.style().visuals.selection.stroke.color, - 100.0, - ); - - if let LabelPrefix::Text | LabelPrefix::IconAndText = self.label_prefix { - output.label.insert_str(0, "TIME: "); - } - - if !use_binary_circle && !use_binary_rectangle { - layout_job.append( - &output.label, - 10.0, - TextFormat { - font_id: config.text_font_id.clone(), - color: ctx.style().visuals.text_color(), - valign: Align::Center, - ..Default::default() - }, - ); - } - - let font_id = config.icon_font_id.clone(); - let is_reversed = matches!(config.alignment, Some(Alignment::Right)); - - config.apply_on_widget(false, ui, |ui| { - if SelectableFrame::new(false) - .show(ui, |ui| { - if !is_reversed { - ui.add(Label::new(layout_job.clone()).selectable(false)); - } - - if use_binary_circle || use_binary_rectangle { - let ordered_output = if is_reversed { - output.label.chars().rev().collect() - } else { - output.label - }; - - for (section_index, section) in - ordered_output.split(':').enumerate() - { - ui.scope(|ui| { - ui.spacing_mut().item_spacing = Vec2::splat(2.0); - for (number_index, number_char) in - section.chars().enumerate() - { - if let Some(number) = number_char.to_digit(10) { - // the hour is the second char in the first section (in reverse, it's in the last section) - let max_power = match ( - is_reversed, - section_index, - number_index, - ) { - (true, 2, 1) | (false, 0, 1) => 2, - (true, _, 1) | (false, _, 0) => 3, - _ => 4, - }; - - if use_binary_circle { - self.paint_binary_circle( - font_id.size, - number, - max_power, - ctx, - ui, - ); - } else if use_binary_rectangle { - self.paint_binary_rect( - font_id.size, - number, - max_power, - ctx, - ui, - ); - } - } - } - }); - } - } - - if is_reversed { - ui.add(Label::new(layout_job.clone()).selectable(false)); - } - }) - .clicked() - { - self.format.toggle() - } - }); - } - } - } -} diff --git a/komorebi-for-mac/komorebi-bar/src/widgets/widget.rs b/komorebi-for-mac/komorebi-bar/src/widgets/widget.rs deleted file mode 100644 index 0f78b517..00000000 --- a/komorebi-for-mac/komorebi-bar/src/widgets/widget.rs +++ /dev/null @@ -1,110 +0,0 @@ -use crate::widgets::applications::Applications; -use crate::widgets::applications::ApplicationsConfig; -use crate::widgets::battery::Battery; -use crate::widgets::battery::BatteryConfig; -use crate::widgets::cpu::Cpu; -use crate::widgets::cpu::CpuConfig; -use crate::widgets::date::Date; -use crate::widgets::date::DateConfig; -// use crate::widgets::keyboard::Keyboard; -// use crate::widgets::keyboard::KeyboardConfig; -use crate::widgets::komorebi::Komorebi; -use crate::widgets::komorebi::KomorebiConfig; -// use crate::widgets::media::Media; -// use crate::widgets::media::MediaConfig; -use crate::widgets::memory::Memory; -use crate::widgets::memory::MemoryConfig; -use crate::widgets::network::Network; -use crate::widgets::network::NetworkConfig; -use crate::widgets::storage::Storage; -use crate::widgets::storage::StorageConfig; -use crate::widgets::time::Time; -use crate::widgets::time::TimeConfig; -use crate::widgets::update::Update; -use crate::widgets::update::UpdateConfig; -use serde::Deserialize; -use serde::Serialize; - -pub use komorebi_bar_core::widgets::widget::BarWidget; - -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Widget configuration -pub enum WidgetConfig { - /// Applications widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Applications"))] - Applications(ApplicationsConfig), - /// Battery widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Battery"))] - Battery(BatteryConfig), - /// CPU widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Cpu"))] - Cpu(CpuConfig), - /// Date widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Date"))] - Date(DateConfig), - // Keyboard(KeyboardConfig), - /// Komorebi widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Komorebi"))] - Komorebi(KomorebiConfig), - // Media(MediaConfig), - /// Memory widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Memory"))] - Memory(MemoryConfig), - /// Network widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Network"))] - Network(NetworkConfig), - /// Storage widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Storage"))] - Storage(StorageConfig), - /// Time widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Time"))] - Time(TimeConfig), - /// Update widget configuration - #[cfg_attr(feature = "schemars", schemars(title = "Update"))] - Update(UpdateConfig), -} - -impl WidgetConfig { - pub fn as_boxed_bar_widget(&self) -> Box { - match self { - WidgetConfig::Applications(config) => Box::new(Applications::from(config)), - WidgetConfig::Battery(config) => Box::new(Battery::from(*config)), - WidgetConfig::Cpu(config) => Box::new(Cpu::from(*config)), - WidgetConfig::Date(config) => Box::new(Date::from(config.clone())), - // WidgetConfig::Keyboard(config) => Box::new(Keyboard::from(*config)), - WidgetConfig::Komorebi(config) => Box::new(Komorebi::from(config)), - // WidgetConfig::Media(config) => Box::new(Media::from(*config)), - WidgetConfig::Memory(config) => Box::new(Memory::from(*config)), - WidgetConfig::Network(config) => Box::new(Network::from(*config)), - WidgetConfig::Storage(config) => Box::new(Storage::from(*config)), - WidgetConfig::Time(config) => Box::new(Time::from(config.clone())), - WidgetConfig::Update(config) => Box::new(Update::from(*config)), - } - } - - pub fn enabled(&self) -> bool { - match self { - WidgetConfig::Applications(config) => config.enable, - WidgetConfig::Battery(config) => config.enable, - WidgetConfig::Cpu(config) => config.enable, - WidgetConfig::Date(config) => config.enable, - // WidgetConfig::Keyboard(config) => config.enable, - WidgetConfig::Komorebi(config) => { - config.workspaces.as_ref().is_some_and(|w| w.enable) - || config.layout.as_ref().is_some_and(|w| w.enable) - || config.focused_container.as_ref().is_some_and(|w| w.enable) - || config - .configuration_switcher - .as_ref() - .is_some_and(|w| w.enable) - } - // WidgetConfig::Media(config) => config.enable, - WidgetConfig::Memory(config) => config.enable, - WidgetConfig::Network(config) => config.enable, - WidgetConfig::Storage(config) => config.enable, - WidgetConfig::Time(config) => config.enable, - WidgetConfig::Update(config) => config.enable, - } - } -} diff --git a/komorebi-for-mac/komorebi-client/Cargo.toml b/komorebi-for-mac/komorebi-client/Cargo.toml index 348a1ebe..7079df13 100644 --- a/komorebi-for-mac/komorebi-client/Cargo.toml +++ b/komorebi-for-mac/komorebi-client/Cargo.toml @@ -1,14 +1,17 @@ [package] -name = "komorebi-client" +name = "komorebi-client-macos" version = "0.1.1" edition = "2024" [dependencies] -komorebi = { path = "../komorebi", default-features = false } -komorebi-themes = { workspace = true } +komorebi = { package = "komorebi-macos", path = "../komorebi", default-features = false } +komorebi-themes = { path = "../../komorebi-themes" } -serde_json = { workspace = true } +serde_json = { package = "serde_json_lenient", version = "0.2" } [features] default = ["schemars"] schemars = ["komorebi/default"] + +[lib] +name = "komorebi_client" diff --git a/komorebi-for-mac/komorebi-client/src/lib.rs b/komorebi-for-mac/komorebi-client/src/lib.rs index d859fcba..26ce52a5 100644 --- a/komorebi-for-mac/komorebi-client/src/lib.rs +++ b/komorebi-for-mac/komorebi-client/src/lib.rs @@ -1,225 +1,9 @@ -pub use komorebi::DATA_DIR; -pub use komorebi::Notification; -pub use komorebi::NotificationEvent; -pub use komorebi::animation::AnimationPrefix; -pub use komorebi::container::Container; -pub use komorebi::core::ApplicationIdentifier; -pub use komorebi::core::Axis; -pub use komorebi::core::CycleDirection; -pub use komorebi::core::DefaultLayout; -pub use komorebi::core::Layout; -pub use komorebi::core::MonocleFocusBehaviour; -pub use komorebi::core::MoveBehaviour; -pub use komorebi::core::OperationBehaviour; -pub use komorebi::core::OperationDirection; -pub use komorebi::core::PanDirection; -pub use komorebi::core::PanGesture; -pub use komorebi::core::Rect; -pub use komorebi::core::Sizing; -pub use komorebi::core::SocketMessage; -pub use komorebi::core::StateQuery; -pub use komorebi::core::SubscribeOptions; -pub use komorebi::core::WindowKind; -pub use komorebi::core::animation::AnimationStyle; -pub use komorebi::core::asc::ApplicationSpecificConfiguration; -pub use komorebi::core::pathext::PathExt; -pub use komorebi::core::pathext::replace_env_in_path; -pub use komorebi::monitor_reconciliator::MonitorNotification; -pub use komorebi::splash; -pub use komorebi::state::State; -pub use komorebi::static_config::StaticConfig; -pub use komorebi::window::Window; -pub use komorebi::workspace::Workspace; -pub use komorebi::workspace::WorkspaceLayer; -pub use komorebi_themes::KomorebiTheme; -pub use komorebi_themes::colour::Colour; -pub use komorebi_themes::colour::Rgb; -use std::borrow::Borrow; -use std::io::BufReader; -use std::io::Read; -use std::io::Write; -use std::net::Shutdown; -use std::os::unix::net::UnixListener; -use std::os::unix::net::UnixStream; -use std::time::Duration; +//! `komorebi-client-macos`: the client of the unified `komorebi-client` package, kept under its old +//! package name until the cutover. The code is in `komorebi-client/src/macos.rs`. -const KOMOREBI: &str = "komorebi.sock"; +extern crate komorebi as komorebi_macos; -pub fn send_message(message: &SocketMessage) -> std::io::Result<()> { - let socket = DATA_DIR.join(KOMOREBI); - let mut stream = UnixStream::connect(socket)?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - stream.write_all(serde_json::to_string(message)?.as_bytes()) -} +#[path = "../../../komorebi-client/src/macos.rs"] +mod platform; -/// A connection to komorebi that messages are written to one after the other, which komorebi -/// handles in the order that they were written, as it does the lines of a batch. Messages sent -/// with [`send_message`] are each on a connection of their own, which komorebi handles on a -/// thread of its own, so two that are sent together can be handled in either order. -pub struct Connection { - stream: UnixStream, -} - -impl Connection { - pub fn open() -> std::io::Result { - let socket = DATA_DIR.join(KOMOREBI); - - Self::from_stream(UnixStream::connect(socket)?) - } - - fn from_stream(stream: UnixStream) -> std::io::Result { - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - - Ok(Self { stream }) - } - - pub fn send(&mut self, message: &SocketMessage) -> std::io::Result<()> { - let mut line = serde_json::to_string(message)?; - line.push('\n'); - - self.stream.write_all(line.as_bytes()) - } -} - -pub fn send_batch(messages: impl IntoIterator) -> std::io::Result<()> -where - Q: Borrow, -{ - let socket = DATA_DIR.join(KOMOREBI); - let mut stream = UnixStream::connect(socket)?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - let msgs = messages.into_iter().fold(String::new(), |mut s, m| { - if let Ok(m_str) = serde_json::to_string(m.borrow()) { - s.push_str(&m_str); - s.push('\n'); - } - s - }); - stream.write_all(msgs.as_bytes()) -} - -pub fn send_query(message: &SocketMessage) -> std::io::Result { - let socket = DATA_DIR.join(KOMOREBI); - - let mut stream = UnixStream::connect(socket)?; - stream.set_read_timeout(Some(Duration::from_secs(1)))?; - stream.set_write_timeout(Some(Duration::from_secs(1)))?; - stream.write_all(serde_json::to_string(message)?.as_bytes())?; - stream.shutdown(Shutdown::Write)?; - - let mut reader = BufReader::new(stream); - let mut response = String::new(); - reader.read_to_string(&mut response)?; - - Ok(response) -} - -pub fn subscribe(name: &str) -> std::io::Result { - let socket = DATA_DIR.join(name); - - match std::fs::remove_file(&socket) { - Ok(()) => {} - Err(error) => match error.kind() { - std::io::ErrorKind::NotFound => {} - _ => { - return Err(error); - } - }, - }; - - let listener = UnixListener::bind(&socket)?; - - send_message(&SocketMessage::AddSubscriberSocket(name.to_string()))?; - - Ok(listener) -} - -pub fn subscribe_with_options( - name: &str, - options: SubscribeOptions, -) -> std::io::Result { - let socket = DATA_DIR.join(name); - - match std::fs::remove_file(&socket) { - Ok(()) => {} - Err(error) => match error.kind() { - std::io::ErrorKind::NotFound => {} - _ => { - return Err(error); - } - }, - }; - - let listener = UnixListener::bind(&socket)?; - - send_message(&SocketMessage::AddSubscriberSocketWithOptions( - name.to_string(), - options, - ))?; - - Ok(listener) -} - -#[cfg(test)] -mod tests { - use super::*; - use std::io::BufRead; - use std::str::FromStr; - - #[test] - fn messages_are_written_to_a_connection_a_line_each_in_the_order_that_they_were_sent() { - let (ours, theirs) = UnixStream::pair().unwrap(); - let mut connection = Connection::from_stream(ours).unwrap(); - - connection - .send(&SocketMessage::PanGesture(PanGesture::Begin)) - .unwrap(); - connection - .send(&SocketMessage::Pan(PanDirection::Right)) - .unwrap(); - connection - .send(&SocketMessage::PanGesture(PanGesture::Move { - dx: 0.5, - dy: 0.0, - t: 12.0, - })) - .unwrap(); - drop(connection); - - let lines: Vec = BufReader::new(theirs) - .lines() - .collect::>() - .unwrap(); - assert_eq!(lines.len(), 3, "one line to a message: {lines:?}"); - - let messages: Vec = lines - .iter() - .map(|line| SocketMessage::from_str(line).unwrap()) - .collect(); - assert!(matches!( - messages[0], - SocketMessage::PanGesture(PanGesture::Begin) - )); - assert!(matches!( - messages[1], - SocketMessage::Pan(PanDirection::Right) - )); - assert!(matches!( - messages[2], - SocketMessage::PanGesture(PanGesture::Move { dx, t, .. }) if dx == 0.5 && t == 12.0 - )); - } - - #[test] - fn writing_to_a_connection_that_was_let_go_of_is_an_error() { - let (ours, theirs) = UnixStream::pair().unwrap(); - let mut connection = Connection::from_stream(ours).unwrap(); - drop(theirs); - - assert!( - connection - .send(&SocketMessage::PanGesture(PanGesture::Cancel)) - .is_err() - ); - } -} +pub use platform::*; diff --git a/komorebi-for-mac/komorebi/Cargo.toml b/komorebi-for-mac/komorebi/Cargo.toml index dfa9213a..276a1f21 100644 --- a/komorebi-for-mac/komorebi/Cargo.toml +++ b/komorebi-for-mac/komorebi/Cargo.toml @@ -1,33 +1,34 @@ [package] -name = "komorebi" +name = "komorebi-macos" version = "0.1.1" description = "A tiling window manager for macOS" edition = "2024" [dependencies] -komorebi-themes = { workspace = true } -komorebi-backend = { workspace = true } -komorebi-collections = { workspace = true } -komorebi-layouts = { workspace = true } -komorebi-config = { workspace = true } -komorebi-protocol = { workspace = true } -komorebi-transport = { workspace = true } +komorebi-themes = { path = "../../komorebi-themes" } +komorebi-backend = { path = "../../crates/komorebi-backend" } +komorebi-collections = { path = "../../crates/komorebi-collections" } +komorebi-layouts = { path = "../../komorebi-layouts", features = ["darwin", "schemars"] } +komorebi-config = { path = "../../crates/komorebi-config", default-features = false, features = ["schemars"] } +komorebi-settings = { path = "../../crates/komorebi-settings" } +komorebi-protocol = { path = "../../crates/komorebi-protocol", default-features = false, features = ["schemars"] } +komorebi-transport = { path = "../../crates/komorebi-transport" } quickxml_to_serde = { git = "https://github.com/LGUG2Z/quickxml_to_serde.git", version = "0.6.1" } -version = { path = "../version" } +version = { package = "version-macos", path = "../version" } base64 = "0.22" block2 = "0.6" -clap = { workspace = true } -chrono = { workspace = true } -color-eyre = { workspace = true } -crossbeam-channel = { workspace = true } -crossbeam-utils = { workspace = true } +clap = { version = "4", features = ["derive", "wrap_help"] } +chrono = { version = "0.4" } +color-eyre = { version = "0.6" } +crossbeam-channel = { version = "0.5" } +crossbeam-utils = { version = "0.8" } ctrlc = { version = "3", features = ["termination"] } -dirs = { workspace = true } +dirs = { version = "6" } dispatch2 = "0.3" ed25519-dalek = "2" -hotwatch = { workspace = true } -lazy_static = { workspace = true } +hotwatch = { version = "0.5" } +lazy_static = { version = "1" } nanoid = "0.4" objc2 = { version = "0.6", default-features = false, features = ["std"] } objc2-app-kit = { version = "0.3", default-features = false, features = [ @@ -109,22 +110,22 @@ objc2-quartz-core = { version = "0.3", default-features = false, features = [ "CALayer", "CATransaction", ] } -parking_lot = { workspace = true } -pastey = { workspace = true } +parking_lot = { version = "0.12" } +pastey = { version = "0.2" } regex = "1" # pinning to 0.12 until this is resolved: https://github.com/seanmonstar/reqwest/issues/2924 reqwest = { version = "0.12", features = ["blocking"] } -schemars = { workspace = true, optional = true } -serde = { workspace = true } -serde_json = { workspace = true, features = ["preserve_order"] } +schemars = { version = "1.1", optional = true } +serde = { version = "1", features = ["derive"] } +serde_json = { package = "serde_json_lenient", version = "0.2", features = ["preserve_order"] } serde_with = { version = "3", features = ["schemars_1"] } -shadow-rs = { workspace = true } +shadow-rs = { version = "1" } strum = { version = "0.28", features = ["derive"] } -sysinfo = { workspace = true } -thiserror = { workspace = true } -tracing = { workspace = true } -tracing-appender = { workspace = true } -tracing-subscriber = { workspace = true } +sysinfo = { version = "0.38" } +thiserror = { version = "2" } +tracing = { version = "0.1" } +tracing-appender = { version = "0.2" } +tracing-subscriber = { version = "0.3", features = ["env-filter"] } [dev-dependencies] uuid = { version = "1", features = ["v4"] } @@ -133,3 +134,10 @@ uuid = { version = "1", features = ["v4"] } default = ["schemars"] deadlock_detection = ["parking_lot/deadlock_detection"] schemars = ["dep:schemars", "komorebi-collections/schemars"] + +[lib] +name = "komorebi" + +[[bin]] +name = "komorebi" +path = "src/main.rs" diff --git a/komorebi-for-mac/komorebi/examples/capture_spike.rs b/komorebi-for-mac/komorebi/examples/capture_spike.rs index c2d93b16..747d8170 100644 --- a/komorebi-for-mac/komorebi/examples/capture_spike.rs +++ b/komorebi-for-mac/komorebi/examples/capture_spike.rs @@ -46,7 +46,8 @@ fn sample(data: &CFData) -> (f64, f64) { let bytes = data.to_vec(); let (mut total, mut visible, mut lit) = (0usize, 0usize, 0usize); - for pixel in bytes.chunks_exact(4).step_by(37) { + // a trailing partial pixel (a buffer that is not a multiple of 4) is dropped, as chunks_exact did + for pixel in bytes.chunks(4).filter(|pixel| pixel.len() == 4).step_by(37) { total += 1; if pixel[3] > 0 { visible += 1; diff --git a/komorebi-for-mac/komorebi/src/ax_registry.rs b/komorebi-for-mac/komorebi/src/ax_registry.rs new file mode 100644 index 00000000..a3159dac --- /dev/null +++ b/komorebi-for-mac/komorebi/src/ax_registry.rs @@ -0,0 +1,114 @@ +//! The id -> {AX element, pid, observer} table of step 11(ii): what lets anything act on a +//! window from nothing but its `WindowId`. +//! +//! It is `komorebi_backend::Registry` (whose rules are tested natively: thread-safe, nothing of +//! the platform runs under its lock, stale ids are `Error::WindowGone`) instantiated with +//! [`AxEntry`]. +//! +//! # Lifetime +//! +//! An entry is created by `Window::new` and by [`sync`] when a window's element or id changes +//! (a native tab). It ends at every place the daemon learns of a death: +//! +//! - `Window::drop`, when the window is no longer alive ([`forget`]); +//! - the reaper, when it reaps a window ([`forget`]); +//! - an application terminating ([`forget_pid`], from `WindowManagerEvent::Destroy`). +//! +//! A window that is alive and never managed stays registered until it dies or its application +//! quits: the entry only holds retained references that the `Window` clones held anyway. +//! +//! # Threads +//! +//! Callable from any thread. Nothing here dispatches to the main queue or takes the window +//! manager's lock (`docs/dev/seam.md` section 3.3); a closure that runs on the main thread may +//! call it. Handles removed from the table are dropped after the table's lock is released. + +use crate::AccessibilityObserver; +use crate::AccessibilityUiElement; +use crate::application::Application; +use crate::window::Window; +use komorebi_backend::Registry; +use komorebi_backend::Result; +use komorebi_backend::WindowId; +use std::sync::LazyLock; + +/// What it takes to act on one window: its element and observer, and its application (whose +/// element and observer are the application's, and whose `process_id` is the pid). +#[derive(Debug, Clone)] +pub struct AxEntry { + /// The window's Accessibility element + pub element: AccessibilityUiElement, + /// The observer that reports the window's events + pub observer: AccessibilityObserver, + /// The application that owns the window + pub application: Application, +} + +impl AxEntry { + /// The pid of the owning application + pub fn pid(&self) -> i32 { + self.application.process_id + } +} + +static WINDOWS: LazyLock> = LazyLock::new(Registry::new); + +/// Registers the window under its id, replacing what was registered under it. +pub fn register(window: &Window) { + let entry = window.entry(); + let pid = entry.pid(); + // the replaced entry is dropped here, with the table's lock released + drop(WINDOWS.insert(WindowId::from_u32(window.id), pid, entry)); +} + +/// A window changed its id or its element in place (a native tab that is now shown by another +/// element): forget the old id and register the window as it is. +pub fn sync(old_id: u32, window: &Window) { + if old_id != window.id { + forget(old_id); + } + + register(window); +} + +/// Forgets a window that is gone. A second call is not an error. +pub fn forget(id: u32) { + drop(WINDOWS.remove(WindowId::from_u32(id))); +} + +/// Forgets every window of a process that quit. +pub fn forget_pid(pid: i32) { + drop(WINDOWS.remove_pid(pid)); +} + +/// The entry of a window, or `Error::WindowGone` if the id is stale. +pub fn get(id: WindowId) -> Result { + WINDOWS.get(id) +} + +/// A `Window` made from the entry of the id, or `Error::WindowGone` if the id is stale. +pub fn window(id: WindowId) -> Result { + let entry = WINDOWS.get(id)?; + // an id that does not fit a `CGWindowID` cannot have been registered + let raw = id.to_u32().ok_or(komorebi_backend::Error::WindowGone(id))?; + Ok(Window::from_entry(raw, entry)) +} + +/// Every registered window, by id. +pub fn windows() -> Vec { + WINDOWS + .snapshot() + .into_iter() + .filter_map(|(id, entry)| Some(Window::from_entry(id.to_u32()?, entry))) + .collect() +} + +/// The `CGWindowID` of the window that an Accessibility element is, as handed over by the system +/// (an observer callback, the event tap, the focused window of an application). This is the one +/// way to turn an element into the key of the table; a window is registered under what it +/// returns. +pub fn identify( + element: &objc2_application_services::AXUIElement, +) -> std::result::Result { + crate::accessibility::AccessibilityApi::window_id(element) +} diff --git a/komorebi-for-mac/komorebi/src/input_event_listener.rs b/komorebi-for-mac/komorebi/src/input_event_listener.rs index f6154849..f2031c64 100644 --- a/komorebi-for-mac/komorebi/src/input_event_listener.rs +++ b/komorebi-for-mac/komorebi/src/input_event_listener.rs @@ -1,4 +1,3 @@ -use crate::accessibility::AccessibilityApi; use crate::macos_api::MacosApi; use crate::reaper; use crate::reaper::ReaperNotification; @@ -93,7 +92,7 @@ extern "C-unwind" fn callback( } if pid != 0 { - let window_id = AccessibilityApi::window_id(&element).ok(); + let window_id = crate::ax_registry::identify(&element).ok(); // Send MoveEnd to handle pending drag-to-swap operations // macOS doesn't reliably fire AXWindowMoved after mouse release diff --git a/komorebi-for-mac/komorebi/src/lib.rs b/komorebi-for-mac/komorebi/src/lib.rs index 55cf64de..8ebc30db 100644 --- a/komorebi-for-mac/komorebi/src/lib.rs +++ b/komorebi-for-mac/komorebi/src/lib.rs @@ -54,6 +54,7 @@ pub mod animation; pub mod app_kit_notification_constants; pub mod application; pub mod arrival; +pub mod ax_registry; pub mod border_manager; pub mod container; pub mod core; @@ -72,6 +73,7 @@ pub mod process_command; pub mod process_event; pub mod reaper; pub mod scrolling; +pub mod settings; pub mod settle; pub mod skylight; pub mod splash; @@ -122,6 +124,10 @@ lazy_static! { Arc::new(Mutex::new(HashMap::new())); static ref WORKSPACE_MATCHING_RULES: Arc>> = Arc::new(Mutex::new(Vec::new())); + // LOCK ORDER for the rule lists (as in the KDE tree, minus the lists macOS does not have): + // FLOATING_APPLICATIONS, SESSION_FLOATING_APPLICATIONS, IGNORE_IDENTIFIERS, MANAGE_IDENTIFIERS, + // WORKSPACE_MATCHING_RULES, REGEX_IDENTIFIERS. Take the ones you need in that order and never + // the other way round; a thread that does can deadlock with one that does not. static ref REGEX_IDENTIFIERS: Arc>> = Arc::new(Mutex::new(HashMap::new())); static ref MANAGE_IDENTIFIERS: Arc>> = Arc::new(Mutex::new(vec![])); @@ -159,10 +165,12 @@ lazy_static! { Arc::new(Mutex::new(HashMap::new())); } -pub static DEFAULT_WORKSPACE_PADDING: AtomicI32 = AtomicI32::new(5); -pub static DEFAULT_CONTAINER_PADDING: AtomicI32 = AtomicI32::new(5); -pub static DEFAULT_RESIZE_DELTA: i32 = 50; -pub static DEFAULT_MOUSE_FOLLOWS_FOCUS: bool = true; +pub static DEFAULT_WORKSPACE_PADDING: AtomicI32 = + AtomicI32::new(komorebi_settings::shared::PlatformDefaults::MACOS.workspace_padding); +pub static DEFAULT_CONTAINER_PADDING: AtomicI32 = + AtomicI32::new(komorebi_settings::shared::PlatformDefaults::MACOS.container_padding); +pub static DEFAULT_RESIZE_DELTA: i32 = komorebi_settings::shared::DEFAULT_RESIZE_DELTA; +pub static DEFAULT_MOUSE_FOLLOWS_FOCUS: bool = komorebi_settings::shared::DEFAULT_MOUSE_FOLLOWS_FOCUS; pub const PUBLIC_KEY: [u8; 32] = [ 0x5a, 0x69, 0x4a, 0xe1, 0x3c, 0x4b, 0xc8, 0x4e, 0xc3, 0x79, 0x0f, 0xab, 0x27, 0x6b, 0x7e, 0xdd, diff --git a/komorebi-for-mac/komorebi/src/macos_backend.rs b/komorebi-for-mac/komorebi/src/macos_backend.rs index 6e9fc14d..ae73aef9 100644 --- a/komorebi-for-mac/komorebi/src/macos_backend.rs +++ b/komorebi-for-mac/komorebi/src/macos_backend.rs @@ -1,5 +1,6 @@ -//! `MacosBackend`: the shared [`komorebi_backend::Backend`] over the existing [`MacosApi`], -//! [`Window`] and [`AdhocWindow`] functions. +//! `MacosBackend`: the shared [`komorebi_backend::Backend`] over the existing [`MacosApi`] and +//! [`Window`] methods (set_rect, focus, raise, hide, restore, minimize, unminimize, close, alive, +//! window_rect and minimized): it holds no Accessibility call of its own. //! //! **Nothing uses it yet.** The daemon still holds `Window` values (element, application and //! observer) and calls them directly; this adapter exists so that the trait is known to be @@ -8,7 +9,8 @@ //! `docs/dev/seam.md`, section 9, and commented where they are. //! //! The trait names a window by an id, and nothing on macOS acts from a bare id: a window is its -//! Accessibility element. So the adapter owns the **id registry** of consequence (1): the daemon +//! Accessibility element. So the backend looks windows up in the **id registry** of consequence +//! (1), `ax_registry`: the daemon //! registers each `Window` it learns of ([`MacosBackend::register`]) and forgets it when it is //! gone, and every method looks the element up by id. An id the registry does not hold is a //! window that is gone. @@ -19,13 +21,10 @@ //! callback refreshes on main with [`MacosBackend::refresh_monitors`]. use crate::LibraryError; -use crate::accessibility::AccessibilityApi; -use crate::accessibility::attribute_constants::kAXMinimizedAttribute; use crate::core::Rect; use crate::core::WindowHidingPosition; use crate::macos_api::MacosApi; use crate::skylight::BatchedUpdates; -use crate::window::AdhocWindow; use crate::window::Window; use komorebi_backend::Backend; use komorebi_backend::Error; @@ -35,9 +34,7 @@ use komorebi_backend::Result; use komorebi_backend::WindowId; use komorebi_backend::WindowInfo; use objc2::MainThreadMarker; -use objc2_core_foundation::CFBoolean; use parking_lot::Mutex; -use std::collections::HashMap; /// The shared [`Backend`] for macOS. /// @@ -45,7 +42,6 @@ use std::collections::HashMap; /// opacity and no focus follows mouse (`docs/dev/seam.md` section 2.1), so those methods answer /// `Unsupported`. pub struct MacosBackend { - windows: Mutex>, monitors: Mutex>, hiding_position: WindowHidingPosition, batches: Mutex>, @@ -67,7 +63,6 @@ impl MacosBackend { /// the monitor's configuration, and the trait has no place for it. pub fn new(hiding_position: WindowHidingPosition) -> Self { Self { - windows: Mutex::new(HashMap::new()), monitors: Mutex::new(Vec::new()), hiding_position, batches: Mutex::new(Vec::new()), @@ -76,12 +71,12 @@ impl MacosBackend { /// Makes the window known to the backend, by its `CGWindowID`. pub fn register(&self, window: Window) { - self.windows.lock().insert(window.id, window); + crate::ax_registry::register(&window); } /// Forgets a window that is gone. pub fn forget(&self, id: u32) { - self.windows.lock().remove(&id); + crate::ax_registry::forget(id); } /// Reads the monitors from `NSScreen` into the cache that [`Backend::monitors`] answers @@ -105,9 +100,7 @@ impl MacosBackend { } fn lookup(&self, id: WindowId) -> Result { - id.to_u32() - .and_then(|raw| self.windows.lock().get(&raw).cloned()) - .ok_or(Error::WindowGone(id)) + crate::ax_registry::window(id) } /// Says why a call about a window failed. A failed write is how macOS finds out that a window @@ -118,7 +111,7 @@ impl MacosBackend { window: &Window, error: impl std::error::Error + Send + Sync + 'static, ) -> Error { - if window.is_valid() { + if window.alive() { platform(error) } else { Error::WindowGone(id) @@ -126,24 +119,16 @@ impl MacosBackend { } fn info(window: &Window) -> Option { - if !window.is_valid() { + if !window.alive() { return None; } - let minimized = AccessibilityApi::copy_attribute_value::( - &window.element, - kAXMinimizedAttribute, - ) - .is_some_and(|b| b.as_bool()); - Some(WindowInfo { id: WindowId::from_u32(window.id), pid: window.application.process_id, // the Accessibility position and size, in points; a failure leaves the default - rect: MacosApi::window_rect(&window.element) - .map(Rect::from) - .unwrap_or_default(), - minimized, + rect: window.window_rect().map(Rect::from).unwrap_or_default(), + minimized: window.minimized(), alive: true, title: window.title(), // macOS has no window class: a bundle identifier, role and subrole instead @@ -162,7 +147,7 @@ impl Backend for MacosBackend { // The registry is the only list there is: the CoreGraphics list joined with the // Accessibility elements by title lives inside `load_workspace_information`, which fills // a `WindowManager`, and the daemon registers what it finds - let registered: Vec<_> = self.windows.lock().values().cloned().collect(); + let registered = crate::ax_registry::windows(); let mut windows: Vec<_> = registered.iter().filter_map(Self::info).collect(); windows.sort_by_key(|w| w.id); windows @@ -203,11 +188,11 @@ impl Backend for MacosBackend { } fn set_rect(&self, id: WindowId, rect: &Rect) -> Result<()> { - // `Window::set_position` writes directly (two Accessibility writes) or hands the move to + // `Window::set_rect` writes directly (two Accessibility writes) or hands the move to // the animator, depending on the animation settings; both are requests let window = self.lookup(id)?; window - .set_position(rect) + .set_rect(rect) .map_err(|e| Self::failed(id, &window, e)) } @@ -252,7 +237,7 @@ impl Backend for MacosBackend { fn close(&self, id: WindowId) -> Result<()> { // presses the close button; `Ok` when the window has none let window = self.lookup(id)?; - AdhocWindow::close(&window.element.0).map_err(|e| Self::failed(id, &window, e)) + window.close().map_err(|e| Self::failed(id, &window, e)) } fn center_cursor_in(&self, rect: &Rect) -> Result<()> { diff --git a/komorebi-for-mac/komorebi/src/main.rs b/komorebi-for-mac/komorebi/src/main.rs index 85137d52..5b5ad65c 100644 --- a/komorebi-for-mac/komorebi/src/main.rs +++ b/komorebi-for-mac/komorebi/src/main.rs @@ -186,7 +186,7 @@ enum LogLevel { } #[derive(Parser)] -#[clap(author, about, version = version::LONG_VERSION)] +#[clap(name = "komorebi", author, about, version = version::LONG_VERSION)] struct Opts { /// Path to a static configuration JSON file #[clap(short, long)] diff --git a/komorebi-for-mac/komorebi/src/monitor.rs b/komorebi-for-mac/komorebi/src/monitor.rs index 5703086d..967abe51 100644 --- a/komorebi-for-mac/komorebi/src/monitor.rs +++ b/komorebi-for-mac/komorebi/src/monitor.rs @@ -467,6 +467,7 @@ impl Monitor { workspace.add_container_to_front(container); } DefaultLayout::UltrawideVerticalStack => { + #[allow(clippy::collapsible_match)] // the outer match has one arm per layout; collapsing would restructure it if workspace.containers().len() == 1 { workspace.insert_container_at_idx(0, container); } else { @@ -489,6 +490,7 @@ impl Monitor { match layout { DefaultLayout::RightMainVerticalStack | DefaultLayout::UltrawideVerticalStack => { + #[allow(clippy::collapsible_match)] // the outer match has one arm per layout; collapsing would restructure it if workspace.containers().len() == 1 { workspace.add_container_to_back(container); } else { @@ -577,7 +579,7 @@ impl Monitor { } pub fn remove_workspaces(&mut self) -> VecDeque { - self.workspaces_mut().drain(..).collect() + std::mem::take(self.workspaces_mut()) } pub fn ensure_workspace_count(&mut self, ensure_count: usize) { diff --git a/komorebi-for-mac/komorebi/src/process_command.rs b/komorebi-for-mac/komorebi/src/process_command.rs index 276d9ada..f32d3680 100644 --- a/komorebi-for-mac/komorebi/src/process_command.rs +++ b/komorebi-for-mac/komorebi/src/process_command.rs @@ -9,7 +9,6 @@ use crate::SESSION_FLOATING_APPLICATIONS; use crate::SUBSCRIPTION_SOCKET_OPTIONS; use crate::SUBSCRIPTION_SOCKETS; use crate::WORKSPACE_MATCHING_RULES; -use crate::accessibility::AccessibilityApi; use crate::animation; use crate::animation::ANIMATION_DURATION_GLOBAL; use crate::animation::ANIMATION_DURATION_PER_ANIMATION; @@ -637,7 +636,7 @@ impl WindowManager { // Sort by window area window_idx_pairs.sort_by_key(|(_, w)| { let rect = - Rect::from(MacosApi::window_rect(&w.element).unwrap_or_default()); + Rect::from(w.window_rect().unwrap_or_default()); rect.right * rect.bottom }); window_idx_pairs.reverse(); @@ -707,7 +706,7 @@ impl WindowManager { // Sort by window area window_idx_pairs.sort_by_key(|w| { let rect = Rect::from( - MacosApi::window_rect(&w.element).unwrap_or_default(), + w.window_rect().unwrap_or_default(), ); rect.right * rect.bottom }); @@ -1718,7 +1717,7 @@ impl WindowManager { let application = Application::new(raw_info.owner_pid)?; if let Some(elements) = application.window_elements() { for element in elements { - if let Ok(wid) = AccessibilityApi::window_id(&element) + if let Ok(wid) = crate::ax_registry::identify(&element) && i64::from(wid) == window_id && let Ok(window) = Window::new(element, application.clone()) { diff --git a/komorebi-for-mac/komorebi/src/process_event.rs b/komorebi-for-mac/komorebi/src/process_event.rs index ac23ca20..0a03bcd5 100644 --- a/komorebi-for-mac/komorebi/src/process_event.rs +++ b/komorebi-for-mac/komorebi/src/process_event.rs @@ -6,7 +6,6 @@ use crate::REGEX_IDENTIFIERS; use crate::TABBED_APPLICATIONS; use crate::UNMANAGED_WINDOW_IDS; use crate::WORKSPACE_MATCHING_RULES; -use crate::accessibility::AccessibilityApi; use crate::accessibility::enhanced_ui; use crate::accessibility::error::AccessibilityApiError; use crate::accessibility::error::AccessibilityError; @@ -182,7 +181,7 @@ impl WindowManager { { let application = self.application(event.process_id())?; if let Some(element) = application.main_window() - && let Ok(wid) = AccessibilityApi::window_id(&element) + && let Ok(wid) = crate::ax_registry::identify(&element) { window_id = Some(wid); window_element = Some(AccessibilityUiElement(element.clone())); @@ -260,7 +259,7 @@ impl WindowManager { && window.application.process_id == process_id { let tab_rect = MacosApi::window_rect(&element)?; - let main_rect = match MacosApi::window_rect(&window.element) { + let main_rect = match window.window_rect() { Ok(rect) => rect, Err(AccessibilityError::Api( AccessibilityApiError::InvalidUIElement, @@ -296,7 +295,7 @@ impl WindowManager { // Additional check: verify the stored element belongs to this container // This prevents treating separate windows as tabs when they have matching geometry if let Ok(stored_window_id) = - AccessibilityApi::window_id(&window.element.0) + crate::ax_registry::identify(&window.element.0) && stored_window_id == window.id { // All checks pass: stored element matches container ID = true tab change @@ -316,8 +315,10 @@ impl WindowManager { workspace.containers_mut().get_mut(container_idx) && let Some(window) = container.focused_window_mut() { + let old_id = window.id; window.id = window_id; window.element = AccessibilityUiElement(element.clone()); + crate::ax_registry::sync(old_id, window); } // check monocle_container for tabbed applications @@ -328,7 +329,7 @@ impl WindowManager { && window.application.process_id == process_id { let tab_rect = MacosApi::window_rect(&element)?; - let main_rect = match MacosApi::window_rect(&window.element) { + let main_rect = match window.window_rect() { Ok(rect) => rect, Err(AccessibilityError::Api( AccessibilityApiError::InvalidUIElement, @@ -349,8 +350,10 @@ impl WindowManager { && let Some(monocle) = workspace.monocle_container.as_mut() && let Some(window) = monocle.focused_window_mut() { + let old_id = window.id; window.id = window_id; window.element = AccessibilityUiElement(element.clone()); + crate::ax_registry::sync(old_id, window); } if first_tab_destroyed { @@ -534,7 +537,7 @@ impl WindowManager { { let application = self.application(process_id)?; if let Some(element) = application.main_window() - && let Ok(wid) = AccessibilityApi::window_id(&element) + && let Ok(wid) = crate::ax_registry::identify(&element) { window_id = Some(wid); window_element = Some(element.clone()); @@ -548,12 +551,12 @@ impl WindowManager { let tabbed_applications = TABBED_APPLICATIONS.lock(); if tabbed_applications.contains(&application_name) { // Get the window_id for the new window - if let Ok(new_window_id) = AccessibilityApi::window_id(element) { + if let Ok(new_window_id) = crate::ax_registry::identify(element) { for window in workspace.visible_windows().iter().flatten() { if window.application.name().unwrap_or_default() == application_name { let tab_rect = MacosApi::window_rect(element)?; - let main_rect = MacosApi::window_rect(&window.element)?; + let main_rect = window.window_rect()?; // BOTH conditions must be true: // 1. Geometry matches (original check - preserves existing behavior) // 2. Window IDs match (new check - prevents false positives) @@ -745,6 +748,7 @@ impl WindowManager { ) ) { enhanced_ui::forget(process_id); + crate::ax_registry::forget_pid(process_id); } // some apps like Discord in all of their relentless Electron slop stupidity @@ -897,7 +901,7 @@ impl WindowManager { { // TODO: not sure about this clone let window = window.clone(); - let new_position = Rect::from(MacosApi::window_rect(&window.element)?); + let new_position = Rect::from(window.window_rect()?); let old_position = *workspace .latest_layout .get(focused_container_idx) @@ -1102,7 +1106,7 @@ impl WindowManager { && let Some(window) = container.windows().iter().find(|w| w.id == window_id) { - let started_from = Rect::from(MacosApi::window_rect(&window.element)?); + let started_from = Rect::from(window.window_rect()?); let pending_resize_op = Arc::make_mut(&mut self.pending_resize_op); *pending_resize_op = Option::from((window_id, Some(started_from))); @@ -1162,7 +1166,7 @@ impl WindowManager { && let Some(window) = container.windows().iter().find(|w| w.id == window_id) { - let ended_at = Rect::from(MacosApi::window_rect(&window.element)?); + let ended_at = Rect::from(window.window_rect()?); tracing::info!("resizing with mouse"); redraw |= self.resize_by_drag(window_id, started_from, ended_at)?; diff --git a/komorebi-for-mac/komorebi/src/reaper.rs b/komorebi-for-mac/komorebi/src/reaper.rs index 8f88b0c9..362c95b1 100644 --- a/komorebi-for-mac/komorebi/src/reaper.rs +++ b/komorebi-for-mac/komorebi/src/reaper.rs @@ -64,7 +64,7 @@ fn handle_notifications(wm: Arc>) -> color_eyre::Result<()> continue 'notification; } - handle_notification(&mut wm, notification, Window::is_valid)?; + handle_notification(&mut wm, notification, Window::alive)?; } Ok(()) @@ -111,6 +111,9 @@ fn invalid_window_ids( } fn reap_window(wm: &mut WindowManager, window_id: u32) -> color_eyre::Result<()> { + // whatever else happens to the window, the id no longer names anything + crate::ax_registry::forget(window_id); + let mut should_update = false; for monitor in wm.monitors_mut() { for workspace in monitor.workspaces_mut() { diff --git a/komorebi-for-mac/komorebi/src/scrolling.rs b/komorebi-for-mac/komorebi/src/scrolling.rs index a11ae9c3..c87bc504 100644 --- a/komorebi-for-mac/komorebi/src/scrolling.rs +++ b/komorebi-for-mac/komorebi/src/scrolling.rs @@ -303,7 +303,7 @@ impl Workspace { for window in container.windows_mut() { let result = match placement.visibility { Visibility::Visible => window - .set_position(&rect) + .set_rect(&rect) .map(|()| window.note_arrival(&rect, resized)), Visibility::Clipped => { // part of it is in view and the rest is past the edge of the screen, @@ -315,7 +315,7 @@ impl Workspace { } window - .set_position(&target) + .set_rect(&target) .map(|()| window.note_arrival(&target, resized)) } Visibility::OffLeft => { diff --git a/komorebi-for-mac/komorebi/src/settings.rs b/komorebi-for-mac/komorebi/src/settings.rs new file mode 100644 index 00000000..8d7db4df --- /dev/null +++ b/komorebi-for-mac/komorebi/src/settings.rs @@ -0,0 +1,97 @@ +//! The settings of this daemon, as one snapshot (plan step 10, `docs/dev/settings.md`). +//! +//! Nothing reads this yet: the process-wide statics are still the source of truth, and each +//! migration step moves one group of them (writers and readers together) into +//! [`settings()`]. Until then the value is the starting values of those statics. + +use std::sync::LazyLock; + +use komorebi_settings::Handle; +use komorebi_settings::Shared; +use komorebi_settings::shared::PlatformDefaults; + +/// The part of the settings that only this platform has. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct MacosSettings {} + +pub type Settings = komorebi_settings::Settings; + +static SETTINGS: LazyLock> = LazyLock::new(|| { + Handle::new(Settings::new( + Shared::defaults_for(PlatformDefaults::MACOS), + MacosSettings::default(), + )) +}); + +/// The settings of the running daemon: take a [`Handle::snapshot`] once per unit of work. +pub fn settings() -> &'static Handle { + &SETTINGS +} + +#[cfg(test)] +mod tests { + use std::sync::atomic::Ordering; + + use super::*; + use crate::border_manager; + + // The statics are still the source of truth. These pin that the starting values of the + // settings are the starting values of the statics, so that moving a group over changes nothing. + // (They read the statics without any test writing them first: no test here sets them.) + #[test] + fn the_starting_settings_are_the_starting_values_of_the_statics() { + let shared = &settings().snapshot().shared; + + assert_eq!( + shared.defaults.container_padding, + crate::DEFAULT_CONTAINER_PADDING.load(Ordering::SeqCst) + ); + assert_eq!( + shared.defaults.workspace_padding, + crate::DEFAULT_WORKSPACE_PADDING.load(Ordering::SeqCst) + ); + assert_eq!(shared.defaults.resize_delta, crate::DEFAULT_RESIZE_DELTA); + assert_eq!( + shared.defaults.mouse_follows_focus, + crate::DEFAULT_MOUSE_FOLLOWS_FOCUS + ); + assert_eq!( + shared.border.enabled, + border_manager::BORDER_ENABLED.load(Ordering::SeqCst) + ); + assert_eq!( + shared.border.width, + border_manager::BORDER_WIDTH.load(Ordering::SeqCst) + ); + assert_eq!( + shared.border.offset, + border_manager::BORDER_OFFSET.load(Ordering::SeqCst) + ); + assert_eq!( + shared.border.radius, + border_manager::BORDER_RADIUS.load(Ordering::SeqCst) + ); + let colours = shared.border.colours; + assert_eq!( + colours.single, + border_manager::FOCUSED.load(Ordering::SeqCst) + ); + assert_eq!(colours.stack, border_manager::STACK.load(Ordering::SeqCst)); + assert_eq!( + colours.monocle, + border_manager::MONOCLE.load(Ordering::SeqCst) + ); + assert_eq!( + colours.floating, + border_manager::FLOATING.load(Ordering::SeqCst) + ); + assert_eq!( + colours.unfocused, + border_manager::UNFOCUSED.load(Ordering::SeqCst) + ); + assert_eq!( + colours.unfocused_locked, + border_manager::UNFOCUSED_LOCKED.load(Ordering::SeqCst) + ); + } +} diff --git a/komorebi-for-mac/komorebi/src/settle.rs b/komorebi-for-mac/komorebi/src/settle.rs index d72f2991..1f1f6f67 100644 --- a/komorebi-for-mac/komorebi/src/settle.rs +++ b/komorebi-for-mac/komorebi/src/settle.rs @@ -8,10 +8,8 @@ //! and any that are not where they are to be are sent there again, and looked at once more after //! that. -use crate::accessibility::AccessibilityApi; use crate::animation::animator; use crate::core::Rect; -use crate::macos_api::MacosApi; use crate::window::Snapping; use crate::window::dragged_window; use crate::window::is_parked; @@ -185,9 +183,9 @@ impl WindowManager { return Ok(0); } - let _ = AccessibilityApi::set_messaging_timeout(&window.element, LOOK_TIMEOUT); - let rect = MacosApi::window_rect(&window.element).map(Rect::from); - let _ = AccessibilityApi::set_messaging_timeout(&window.element, 0.0); + let _ = window.set_messaging_timeout(LOOK_TIMEOUT); + let rect = window.window_rect().map(Rect::from); + let _ = window.set_messaging_timeout(0.0); if let Ok(rect) = rect && is_off(&rect, &layout) @@ -208,7 +206,7 @@ impl WindowManager { let _snapping = Snapping::end(); for (window, layout) in &off { - if let Err(error) = window.set_position(layout) { + if let Err(error) = window.set_rect(layout) { tracing::debug!( "live resize: could not send window {} again: {error}", window.id diff --git a/komorebi-for-mac/komorebi/src/static_config.rs b/komorebi-for-mac/komorebi/src/static_config.rs index 5fe68137..6fbb0341 100644 --- a/komorebi-for-mac/komorebi/src/static_config.rs +++ b/komorebi-for-mac/komorebi/src/static_config.rs @@ -64,6 +64,7 @@ use std::io::ErrorKind; use std::io::Write; use std::os::unix::net::UnixListener; use std::os::unix::net::UnixStream; +use std::path::Path; use std::path::PathBuf; use std::sync::Arc; use std::sync::atomic::Ordering; @@ -545,16 +546,18 @@ impl ApplyGlobals for StaticConfig { // transparency_manager::TRANSPARENCY_ALPHA // .store(self.transparency_alpha.unwrap_or(200), Ordering::SeqCst); + // the order every other place takes them in (floating, ignore, manage, regex; see lib.rs): + // a thread that takes two in another order can wait for one that holds what it needs + let mut floating_applications = FLOATING_APPLICATIONS.lock(); let mut ignore_identifiers = IGNORE_IDENTIFIERS.lock(); - let mut regex_identifiers = REGEX_IDENTIFIERS.lock(); let mut manage_identifiers = MANAGE_IDENTIFIERS.lock(); + let mut regex_identifiers = REGEX_IDENTIFIERS.lock(); // let mut tray_and_multi_window_identifiers = TRAY_AND_MULTI_WINDOW_IDENTIFIERS.lock(); // let mut object_name_change_identifiers = OBJECT_NAME_CHANGE_ON_LAUNCH.lock(); // let mut object_name_change_title_ignore_list = OBJECT_NAME_CHANGE_TITLE_IGNORE_LIST.lock(); // let mut layered_identifiers = LAYERED_WHITELIST.lock(); // let mut transparency_blacklist = TRANSPARENCY_BLACKLIST.lock(); // let mut slow_application_identifiers = SLOW_APPLICATION_IDENTIFIERS.lock(); - let mut floating_applications = FLOATING_APPLICATIONS.lock(); // let mut no_titlebar_applications = NO_TITLEBAR.lock(); let mut titleless_applications = TITLELESS_APPLICATIONS.lock(); let mut tabbed_applications = TABBED_APPLICATIONS.lock(); @@ -714,23 +717,23 @@ impl ApplyGlobals for StaticConfig { pub trait StaticConfigExt: Sized { /// Makes the window manager from the file at `path`, and starts watching the file fn preload( - path: &PathBuf, + path: &Path, incoming: Receiver, unix_listener: Option, run_loop: &CFRetained, ) -> eyre::Result; /// Gives the monitors of the window manager what the file says about them - fn postload(path: &PathBuf, wm: &Arc>) -> eyre::Result<()>; + fn postload(path: &Path, wm: &Arc>) -> eyre::Result<()>; /// Replaces the configuration of the window manager with the file at `path` - fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()>; + fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()>; } impl StaticConfigExt for StaticConfig { #[allow(clippy::too_many_lines)] fn preload( - path: &PathBuf, + path: &Path, incoming: Receiver, unix_listener: Option, run_loop: &CFRetained, @@ -809,7 +812,7 @@ impl StaticConfigExt for StaticConfig { known_window_ids: HashMap::new(), }; - let bytes = SocketMessage::ReloadStaticConfiguration(path.clone()).as_bytes()?; + let bytes = SocketMessage::ReloadStaticConfiguration(path.to_path_buf()).as_bytes()?; wm.hotwatch.watch(path, move |event| match event.kind { // Editing in Notepad sends a NoticeWrite while editing in (Neo)Vim sends @@ -828,7 +831,7 @@ impl StaticConfigExt for StaticConfig { Ok(wm) } - fn postload(path: &PathBuf, wm: &Arc>) -> eyre::Result<()> { + fn postload(path: &Path, wm: &Arc>) -> eyre::Result<()> { let mut value = Self::read(path)?; let mut wm = wm.lock(); @@ -990,7 +993,7 @@ impl StaticConfigExt for StaticConfig { Ok(()) } - fn reload(path: &PathBuf, wm: &mut WindowManager) -> eyre::Result<()> { + fn reload(path: &Path, wm: &mut WindowManager) -> eyre::Result<()> { let mut value = Self::read(path)?; value.apply_globals()?; @@ -1253,6 +1256,7 @@ fn handle_asc_file( match path.extension() { None => {} Some(ext) => { + #[allow(clippy::collapsible_match)] // collapsing the nested if into a guard would restructure a 40-line block if ext.to_string_lossy().to_string().as_str() == "json" { tracing::info!("loading applications.json from: {}", path.display()); let mut asc = ApplicationSpecificConfiguration::load(path)?; diff --git a/komorebi-for-mac/komorebi/src/window.rs b/komorebi-for-mac/komorebi/src/window.rs index 90e80ad2..595e6702 100644 --- a/komorebi-for-mac/komorebi/src/window.rs +++ b/komorebi-for-mac/komorebi/src/window.rs @@ -465,7 +465,7 @@ impl Drop for Window { fn drop(&mut self) { // this gets called when a cloned Window is dropped, so we need to make sure it only // invalidates the observer if the Window is no longer open - if !self.is_valid() { + if !self.alive() { tracing::info!( "invalidating window observer for {}", self.title() @@ -476,6 +476,9 @@ impl Drop for Window { // for now - hopefully it doesn't break anything else reaper::send_notification(ReaperNotification::InvalidWindow(self.id)); + // and the id no longer names anything + crate::ax_registry::forget(self.id); + // make sure the observer gets removed from any run loops AccessibilityApi::invalidate_observer(&self.observer); } @@ -520,7 +523,7 @@ impl Serialize for Window { state.serialize_field("id", &self.id)?; state.serialize_field( "rect", - &Rect::from(MacosApi::window_rect(&self.element).unwrap_or_default()), + &Rect::from(self.window_rect().unwrap_or_default()), )?; state.serialize_field("details", &WindowDetails::from(self))?; state.end() @@ -560,16 +563,52 @@ impl Window { Some(window_observer_callback), )?; - Ok(Self { + let window = Self { id: AccessibilityApi::window_id(&element)?, element: AccessibilityUiElement(element), application, observer: AccessibilityObserver(Some(observer)), details: None, - }) + }; + + // so that the window can be found again from its id alone + crate::ax_registry::register(&window); + + Ok(window) } - pub fn is_valid(&self) -> bool { + /// The handles that act on this window, as the registry keeps them + pub(crate) fn entry(&self) -> crate::ax_registry::AxEntry { + crate::ax_registry::AxEntry { + element: self.element.clone(), + observer: self.observer.clone(), + application: self.application.clone(), + } + } + + /// A window made from a registry entry + pub(crate) fn from_entry(id: u32, entry: crate::ax_registry::AxEntry) -> Self { + Self { + id, + element: entry.element, + application: entry.application, + observer: entry.observer, + details: None, + } + } + + /// The frame query (`Backend::window_rect`): the Accessibility position and size, in points. + pub fn window_rect(&self) -> Result { + MacosApi::window_rect(&self.element) + } + + /// How long an Accessibility call to this window's app may block, in seconds (0 restores the + /// system default). Not an operation of the shared `Backend`; it bounds the frame query. + pub fn set_messaging_timeout(&self, seconds: f32) -> Result<(), AccessibilityError> { + AccessibilityApi::set_messaging_timeout(&self.element, seconds) + } + + pub fn alive(&self) -> bool { AccessibilityApi::copy_attribute_names(&self.element).is_some() } @@ -622,7 +661,7 @@ impl Window { // it happened to be when it was hidden let rect = match animator::take_over(self.id) { Some(target) => CGRect::from(target), - None => MacosApi::window_rect(&self.element)?, + None => self.window_rect()?, }; let mut window_restore_positions = WINDOW_RESTORE_POSITIONS.lock(); @@ -706,7 +745,7 @@ impl Window { let rect = match animator::target(self.id) { Some(target) => CGRect::from(target), - None => MacosApi::window_rect(&self.element)?, + None => self.window_rect()?, }; let Some(screen) = screen.or_else(|| CoreGraphicsApi::display_bounds_for_window_rect(rect)) @@ -791,6 +830,12 @@ impl Window { Ok(()) } + /// Whether the window is minimized (the `WindowInfo::minimized` field of the shared `Backend`). + pub fn minimized(&self) -> bool { + AccessibilityApi::copy_attribute_value::(&self.element, kAXMinimizedAttribute) + .is_some_and(|b| b.as_bool()) + } + pub fn minimize(&mut self) -> Result<(), AccessibilityError> { let cf_boolean = CFBoolean::new(true); let value = &**cf_boolean; @@ -803,6 +848,11 @@ impl Window { AccessibilityApi::set_attribute_cf_value(&self.element, kAXMinimizedAttribute, value) } + /// Closes the window by pressing its close button (`Backend::close`); `Ok` when it has none. + pub fn close(&self) -> Result<(), AccessibilityError> { + AdhocWindow::close(&self.element.0) + } + #[tracing::instrument(skip_all)] pub fn restore(&mut self) -> Result<(), AccessibilityError> { // waiting for what is on its way to the window is not something to do with a lock held @@ -912,7 +962,7 @@ impl Window { )) } - pub fn set_position(&self, rect: &Rect) -> Result<(), AccessibilityError> { + pub fn set_rect(&self, rect: &Rect) -> Result<(), AccessibilityError> { match snap() { Snap::Step(dragged) => return self.set_position_for_step(dragged, rect), Snap::End => { @@ -954,9 +1004,9 @@ impl Window { } // the window manager is waiting for this, and so is every window after this one - let _ = AccessibilityApi::set_messaging_timeout(&self.element, ARRIVAL_TIMEOUT); + let _ = self.set_messaging_timeout(ARRIVAL_TIMEOUT); - match MacosApi::window_rect(&self.element) { + match self.window_rect() { Ok(actual) => arrival::report(self.id, *target, Rect::from(actual)), Err(error) => { tracing::debug!( @@ -985,7 +1035,7 @@ impl Window { return; } - let Ok(current) = MacosApi::window_rect(&self.element) else { + let Ok(current) = self.window_rect() else { return; }; @@ -1077,7 +1127,7 @@ impl Window { motion, after: None, }, - || MacosApi::window_rect(&self.element).map(Rect::from), + || self.window_rect().map(Rect::from), ) } @@ -1192,14 +1242,14 @@ impl Window { let target_width = (target_height * aspect_ratio_width) / aspect_ratio_height; (target_width, target_height) } else { - let current_rect = Rect::from(MacosApi::window_rect(&self.element)?); + let current_rect = Rect::from(self.window_rect()?); (current_rect.right, current_rect.bottom) }; let x = work_area.left + ((work_area.right - target_width) / 2); let y = work_area.top + ((work_area.bottom - target_height) / 2); - self.set_position(&Rect { + self.set_rect(&Rect { left: x, top: y, right: target_width, @@ -1212,7 +1262,7 @@ impl Window { current_area: &Rect, target_area: &Rect, ) -> Result<(), AccessibilityError> { - let current_rect = Rect::from(MacosApi::window_rect(&self.element)?); + let current_rect = Rect::from(self.window_rect()?); let x_diff = target_area.left - current_area.left; let y_diff = target_area.top - current_area.top; let x_ratio = f32::abs((target_area.right as f32) / (current_area.right as f32)); @@ -1250,7 +1300,7 @@ impl Window { // let anim_count = ANIMATION_MANAGER // .lock() // .count_in_progress(MovementRenderDispatcher::PREFIX); - // self.set_position(&new_rect, true)?; + // self.set_rect(&new_rect, true)?; // let hwnd = self.hwnd; // // Wait for the animation to finish before maximizing the window again, otherwise // // we would be maximizing the window on the current monitor anyway @@ -1269,11 +1319,11 @@ impl Window { // windows_api::WindowsApi::maximize_window(hwnd); // }); // } else { - // self.set_position(&new_rect, true)?; + // self.set_rect(&new_rect, true)?; // windows_api::WindowsApi::maximize_window(self.hwnd); // } // } else { - self.set_position(&new_rect)?; + self.set_rect(&new_rect)?; // } Ok(()) @@ -1285,7 +1335,7 @@ impl Window { event: Option, debug: &mut RuleDebug, ) -> eyre::Result { - if !self.is_valid() { + if !self.alive() { return Ok(false); } @@ -1537,7 +1587,7 @@ impl From<&CFDictionary> for WindowInfo { Self { name: cf_dictionary_value::(value, kCGWindowName) .map(|s| s.as_ref().to_string()) - .and_then(|s| if s.is_empty() { None } else { Some(s) }), + .filter(|s| !s.is_empty()), owner_pid: cf_dictionary_value::(value, kCGWindowOwnerPID) .and_then(|s| s.as_ref().as_i32()) .expect("window must have an owner process id"), @@ -1641,9 +1691,14 @@ fn window_is_eligible( } } + // Every place that holds two of the rule lists takes them in this order: floating, ignore, + // manage, regex (see the statics in lib.rs). A thread that takes two in another order can wait + // for one that holds what it needs, and both wait for ever. + let floating_identifiers = FLOATING_APPLICATIONS.lock(); + let ignore_identifiers = IGNORE_IDENTIFIERS.lock(); + let manage_identifiers = MANAGE_IDENTIFIERS.lock(); let regex_identifiers = REGEX_IDENTIFIERS.lock(); - let ignore_identifiers = IGNORE_IDENTIFIERS.lock(); let should_ignore = if let Some(rule) = should_act( title, exe_name, @@ -1658,7 +1713,6 @@ fn window_is_eligible( false }; - let manage_identifiers = MANAGE_IDENTIFIERS.lock(); let managed_override = if let Some(rule) = should_act( title, exe_name, @@ -1673,7 +1727,6 @@ fn window_is_eligible( false }; - let floating_identifiers = FLOATING_APPLICATIONS.lock(); if let Some(rule) = should_act( title, exe_name, diff --git a/komorebi-for-mac/komorebi/src/window_manager.rs b/komorebi-for-mac/komorebi/src/window_manager.rs index 3bd9cd3a..e9dc083b 100644 --- a/komorebi-for-mac/komorebi/src/window_manager.rs +++ b/komorebi-for-mac/komorebi/src/window_manager.rs @@ -279,7 +279,7 @@ impl WindowManager { .enumerate() .flat_map(|(idx, w)| { (w.id != focused_window_id).then_some( - MacosApi::window_rect(&w.element) + w.window_rect() .ok() .map(|r| (idx, Rect::from(r))), ) @@ -305,7 +305,7 @@ impl WindowManager { .enumerate() .flat_map(|(idx, w)| { (w.id != focused_window_id).then_some( - MacosApi::window_rect(&w.element) + w.window_rect() .ok() .map(|r| (idx, Rect::from(r))), ) @@ -331,7 +331,7 @@ impl WindowManager { .enumerate() .flat_map(|(idx, w)| { (w.id != focused_window_id).then_some( - MacosApi::window_rect(&w.element) + w.window_rect() .ok() .map(|r| (idx, Rect::from(r))), ) @@ -357,7 +357,7 @@ impl WindowManager { .enumerate() .flat_map(|(idx, w)| { (w.id != focused_window_id).then_some( - MacosApi::window_rect(&w.element) + w.window_rect() .ok() .map(|r| (idx, Rect::from(r))), ) @@ -747,7 +747,7 @@ impl WindowManager { MacosApi::foreground_window_id().ok_or_eyre("no foreground window")?; for window in focused_workspace.floating_windows().iter() { if window.id == focused_window_id { - let mut rect = Rect::from(MacosApi::window_rect(&window.element)?); + let mut rect = Rect::from(window.window_rect()?); match direction { OperationDirection::Left => { if rect.left - delta < focused_monitor_work_area.left { @@ -787,7 +787,7 @@ impl WindowManager { } } - window.set_position(&rect)?; + window.set_rect(&rect)?; if mouse_follows_focus { MacosApi::center_cursor_in_rect(&rect)?; @@ -1180,7 +1180,7 @@ impl WindowManager { let mut valid_window_ids = vec![]; if let Some(elements) = application.window_elements() { for element in elements { - if let Ok(window_id) = AccessibilityApi::window_id(&element) { + if let Ok(window_id) = crate::ax_registry::identify(&element) { valid_window_ids.push(window_id); } } @@ -1475,7 +1475,7 @@ impl WindowManager { .into_iter() .flatten() .filter_map(|window| { - MacosApi::window_rect(&window.element) + window.window_rect() .ok() .map(|rect| (window.id, Rect::from(rect))) }) @@ -1696,7 +1696,7 @@ impl WindowManager { for window in workspace.floating_windows().iter() { if window.id == focused_window_id { - let mut rect = Rect::from(MacosApi::window_rect(&window.element)?); + let mut rect = Rect::from(window.window_rect()?); match (direction, sizing) { (OperationDirection::Left, Sizing::Increase) => { if rect.left - delta < focused_monitor_work_area.left { @@ -1750,7 +1750,7 @@ impl WindowManager { } } - window.set_position(&rect)?; + window.set_rect(&rect)?; if mouse_follows_focus { MacosApi::center_cursor_in_rect(&rect)?; @@ -2190,14 +2190,13 @@ impl WindowManager { return Ok(()); } - let element = self - .focused_workspace()? - .container_for_window(window_id) - .and_then(|container| container.windows().iter().find(|w| w.id == window_id)) - .map(|window| window.element.clone()) - .ok_or_eyre("the dragged window is not in a container on the focused workspace")?; - - let now = Rect::from(MacosApi::window_rect(&element)?); + let now = Rect::from( + self.focused_workspace()? + .container_for_window(window_id) + .and_then(|container| container.windows().iter().find(|w| w.id == window_id)) + .ok_or_eyre("the dragged window is not in a container on the focused workspace")? + .window_rect()?, + ); if !self.live_resize_apply(now)? { return Ok(()); @@ -2266,9 +2265,7 @@ impl WindowManager { // Reset any resize adjustments if we want to force a retile if !preserve_resize_dimensions { - for resize in &mut workspace.resize_dimensions { - *resize = None; - } + workspace.resize_dimensions.fill(None); // and the widths and heights of the Scrolling layout, which are resize // adjustments too @@ -3518,7 +3515,7 @@ impl WindowManager { let rules: &mut Vec<(usize, Layout)> = &mut workspace.layout_rules; rules.retain(|pair| pair.0 != at_container_count); rules.push((at_container_count, Layout::Default(layout))); - rules.sort_by(|a, b| a.0.cmp(&b.0)); + rules.sort_by_key(|a| a.0); // If this is the focused workspace on a non-focused screen, let's update it if focused_monitor_idx != monitor_idx && focused_workspace_idx == workspace_idx { diff --git a/komorebi-for-mac/komorebi/src/workspace.rs b/komorebi-for-mac/komorebi/src/workspace.rs index 042eb7b9..7666bf3b 100644 --- a/komorebi-for-mac/komorebi/src/workspace.rs +++ b/komorebi-for-mac/komorebi/src/workspace.rs @@ -553,7 +553,7 @@ impl Workspace { && focused_window.application.process_id == process_id { if !valid_window_ids.contains(&focused_window.id) { - if let Ok(rect) = MacosApi::window_rect(&focused_window.element) { + if let Ok(rect) = focused_window.window_rect() { tracing::debug!( "reaping window {} ({}): rect = {:?}", focused_window.id, @@ -566,7 +566,7 @@ impl Workspace { // if accessibility API calls fail on AXError::InvalidUIElement // let's try and nuke these early - if !focused_window.is_valid() { + if !focused_window.alive() { invalid_window_ids.push(focused_window.id); } } @@ -578,7 +578,7 @@ impl Workspace { if focused_window.application.process_id == process_id && !valid_window_ids.contains(&focused_window.id) { - if let Ok(rect) = MacosApi::window_rect(&focused_window.element) { + if let Ok(rect) = focused_window.window_rect() { tracing::debug!( "reaping monocle window {} ({}): rect = {:?}", focused_window.id, @@ -591,7 +591,7 @@ impl Workspace { // if accessibility API calls fail on AXError::InvalidUIElement // let's try and nuke these early - if !focused_window.is_valid() { + if !focused_window.alive() { invalid_window_ids.push(focused_window.id); } } @@ -599,7 +599,7 @@ impl Workspace { for window in self.floating_windows() { if window.application.process_id == process_id { if !valid_window_ids.contains(&window.id) { - if let Ok(rect) = MacosApi::window_rect(&window.element) { + if let Ok(rect) = window.window_rect() { tracing::debug!( "reaping floating window {} ({}): rect = {:?}", window.id, @@ -612,7 +612,7 @@ impl Workspace { // if accessibility API calls fail on AXError::InvalidUIElement // let's try and nuke these early - if !window.is_valid() { + if !window.alive() { invalid_floating_window_ids.push(window.id); } } @@ -1476,7 +1476,7 @@ impl Workspace { adjusted_work_area.add_padding(container_padding); adjusted_work_area.add_padding(border_offset); adjusted_work_area.add_padding(border_width); - window.set_position(&adjusted_work_area)?; + window.set_rect(&adjusted_work_area)?; }; } else if !self.containers().is_empty() { if self.is_scrolling() { @@ -1503,7 +1503,7 @@ impl Workspace { layout.add_padding(border_width); for window in container.windows_mut() { - if let Err(error) = window.set_position(layout) { + if let Err(error) = window.set_rect(layout) { tracing::warn!("failed to set window position: {error}") } } diff --git a/komorebi-for-mac/komorebic/Cargo.toml b/komorebi-for-mac/komorebic/Cargo.toml index 20043ba4..0b351004 100644 --- a/komorebi-for-mac/komorebic/Cargo.toml +++ b/komorebi-for-mac/komorebic/Cargo.toml @@ -1,31 +1,27 @@ [package] -name = "komorebic" +name = "komorebic-macos" version = "0.1.1" description = "The command-line interface for Komorebi, a tiling window manager for macOS" edition = "2024" [dependencies] -komorebi-config = { workspace = true } -komorebi-client = { path = "../komorebi-client", default-features = false } +komorebi-config = { path = "../../crates/komorebi-config", default-features = false, features = ["schemars"] } +komorebi-client = { package = "komorebi-client-macos", path = "../komorebi-client", default-features = false } komorebic-core = { path = "../../crates/komorebic-core" } -version = { path = "../version" } +version = { package = "version-macos", path = "../version" } -clap = { workspace = true } +clap = { version = "4", features = ["derive", "wrap_help"] } clap_complete = "4" -chrono = { workspace = true } -color-eyre = { workspace = true } -dirs = { workspace = true } +chrono = { version = "0.4" } +color-eyre = { version = "0.6" } +dirs = { version = "6" } fs-tail = "0.1" -lazy_static = { workspace = true } +lazy_static = { version = "1" } reqwest = { version = "0.12", features = ["blocking"] } -schemars = { workspace = true, optional = true } -serde_json = { workspace = true } -shadow-rs = { workspace = true } -sysinfo = { workspace = true } - -[build-dependencies] -reqwest = { version = "0.12", features = ["blocking"] } -shadow-rs = { workspace = true } +schemars = { version = "1.1", optional = true } +serde_json = { package = "serde_json_lenient", version = "0.2" } +shadow-rs = { version = "1" } +sysinfo = { version = "0.38" } [features] default = ["schemars"] @@ -33,3 +29,7 @@ schemars = ["dep:schemars", "komorebi-client/default"] [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(FALSE)'] } + +[[bin]] +name = "komorebic" +path = "src/main.rs" diff --git a/komorebi-for-mac/komorebic/applications.json b/komorebi-for-mac/komorebic/applications.json new file mode 100644 index 00000000..e00e8b12 --- /dev/null +++ b/komorebi-for-mac/komorebic/applications.json @@ -0,0 +1,286 @@ +{ + "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi-for-mac/master/schema.asc.json", + "Archive Utility": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Archive Utility", + "matching_strategy": "Equals" + } + ] + ] + }, + "Cloudflare Warp": { + "ignore": [ + { + "kind": "Exe", + "id": "Updater", + "matching_strategy": "Equals" + }, + [ + { + "kind": "Exe", + "id": "Cloudflare WARP", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Updating Cloudflare WARP", + "matching_strategy": "Equals" + } + ] + ] + }, + "Control Center": { + "ignore": [ + { + "kind": "Exe", + "id": "Control Center", + "matching_strategy": "Equals" + } + ] + }, + "Discord": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Discord", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "DiscordUpdater", + "matching_strategy": "Equals" + } + ] + ] + }, + "Finder": { + "tabbed": [ + { + "kind": "Exe", + "id": "Finder", + "matching_strategy": "Equals" + } + ], + "ignore": [ + [ + { + "kind": "Exe", + "id": "Finder", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Info", + "matching_strategy": "EndsWith" + } + ], + [ + { + "kind": "Exe", + "id": "Finder", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Copy", + "matching_strategy": "Equals" + } + ] + ] + }, + "Ghostty": { + "tabbed": [ + { + "kind": "Exe", + "id": "Ghostty", + "matching_strategy": "Equals" + } + ], + "titleless": [ + { + "kind": "Exe", + "id": "Ghostty", + "matching_strategy": "Equals" + } + ] + }, + "Installer": { + "ignore": [ + { + "kind": "Exe", + "id": "Installer", + "matching_strategy": "Equals" + } + ] + }, + "MobileDeviceUpdater": { + "ignore": [ + { + "kind": "Exe", + "id": "MobileDeviceUpdater", + "matching_strategy": "Equals" + } + ] + }, + "Notification Center": { + "ignore": [ + { + "kind": "Exe", + "id": "Notification Center", + "matching_strategy": "Equals" + } + ] + }, + "Photos": { + "titleless": [ + { + "kind": "Exe", + "id": "Photos", + "matching_strategy": "Equals" + } + ] + }, + "RustRover": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "java", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Update", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "RustRover", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "–", + "matching_strategy": "DoesNotContain" + } + ] + ] + }, + "SecurityAgent": { + "ignore": [ + { + "kind": "Exe", + "id": "SecurityAgent", + "matching_strategy": "Equals" + } + ] + }, + "System Information": { + "ignore": [ + { + "kind": "Exe", + "id": "System Information", + "matching_strategy": "Equals" + } + ] + }, + "System Settings": { + "ignore": [ + { + "kind": "Exe", + "id": "System Settings", + "matching_strategy": "Equals" + } + ] + }, + "Tailscale": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Tailscale", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Software Update", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "Tailscale", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Updating Tailscale", + "matching_strategy": "Equals" + } + ] + ] + }, + "Zed": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Zed", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Open", + "matching_strategy": "Equals" + } + ] + ] + }, + "Zen": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Zen", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "File Upload", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "Zen", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Enter name of file to save to", + "matching_strategy": "StartsWith" + } + ], + [ + { + "kind": "Exe", + "id": "Zen", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Picture-in-Picture", + "matching_strategy": "Equals" + } + ] + ] + } +} diff --git a/komorebi-for-mac/komorebic/build.rs b/komorebi-for-mac/komorebic/build.rs deleted file mode 100644 index b7c1f27e..00000000 --- a/komorebi-for-mac/komorebic/build.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - if std::fs::metadata("applications.json").is_err() { - let applications_json = reqwest::blocking::get( - "https://raw.githubusercontent.com/LGUG2Z/komorebi-application-specific-configuration/master/applications.mac.json" - ).unwrap().text().unwrap(); - std::fs::write("applications.json", applications_json).unwrap(); - } -} diff --git a/komorebi-for-mac/komorebic/src/main.rs b/komorebi-for-mac/komorebic/src/main.rs index 9be53800..1d6b621d 100644 --- a/komorebi-for-mac/komorebic/src/main.rs +++ b/komorebi-for-mac/komorebic/src/main.rs @@ -1,807 +1,9 @@ -#![warn(clippy::all)] +//! `komorebic-macos`: the macOS command line of the unified `komorebic` package, kept under its old +//! package name until the cutover. The code is in `komorebic/src/macos`. -use chrono::Utc; -use color_eyre::eyre; -use fs_tail::TailedFile; -use komorebi_client::PathExt; -use komorebi_client::SocketMessage; -use komorebi_client::send_message; -use komorebi_client::send_query; -use komorebi_client::splash; -use komorebi_client::splash::ValidationFeedback; -use komorebic_core::cli::Cmd; -use komorebic_core::cli::Meta; -use komorebic_core::cli::command; -use komorebic_core::docgen::DocFormat; -use komorebic_core::launcher; -use komorebic_core::launcher::Launcher; -use komorebic_core::messages::Messages; -use komorebic_core::pan; -use komorebic_core::platform::macos::*; -use lazy_static::lazy_static; -use std::fs::File; -use std::fs::OpenOptions; -use std::io; -use std::io::BufRead; -use std::io::BufReader; -use std::io::Write; -use std::path::PathBuf; -use std::process::Command; -use std::process::Stdio; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::Ordering; -use sysinfo::ProcessesToUpdate; +#[path = "../../../komorebic/src/macos/mod.rs"] +mod macos; -lazy_static! { - static ref HAS_CUSTOM_CONFIG_HOME: AtomicBool = AtomicBool::new(false); - static ref HOME_DIR: PathBuf = { - std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( - |_| dirs::home_dir().expect("there is no home directory").join(".config").join("komorebi"), - |home_path| { - let home = home_path.replace_env(); - if home.as_path().is_dir() { - HAS_CUSTOM_CONFIG_HOME.store(true, Ordering::SeqCst); - home - } else { - panic!( - "$KOMOREBI_CONFIG_HOME is set to \"{home_path}\", which is not a valid directory", - ); - } - }, - ) - }; - static ref DATA_DIR: PathBuf = dirs::data_local_dir() - .expect("there is no local data directory") - .join("komorebi"); -} - -fn print_query(message: &SocketMessage) { - match send_query(message) { - Ok(response) => println!("{response}"), - Err(error) => panic!("{}", error), - } -} - -/// Starting `komorebi` for `komorebic start`: a `Command` for the daemon, found among the -/// processes by its exact name. -struct MacosLauncher<'a> { - args: &'a Start, - system: sysinfo::System, -} - -impl Launcher for MacosLauncher<'_> { - fn daemon_name(&self) -> &str { - "komorebi" - } - - fn spawn(&mut self) -> eyre::Result<()> { - let mut command = Command::new("komorebi"); - - if let Some(config) = &self.args.config { - command.args(["--config", &format!("'--config=\"{}\"'", config.display())]); - } - - command - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .stdin(Stdio::null()) - .spawn()?; - - Ok(()) - } - - fn is_running(&mut self) -> eyre::Result { - self.system.refresh_processes(ProcessesToUpdate::All, true); - - Ok(self - .system - .processes_by_exact_name("komorebi".as_ref()) - .next() - .is_some()) - } - - fn diagnose(&mut self) -> eyre::Result<()> { - let mut command = Command::new("komorebi"); - - if let Some(config) = &self.args.config { - command.arg(format!("'--config=\"{}\"'", config.display())); - } - - if let Ok(output) = command.output() { - println!("{}", String::from_utf8(output.stderr)?); - } - - Ok(()) - } -} - -/// What the top of the help and `--version` say. -const META: Meta = Meta { - name: "komorebic", - about: env!("CARGO_PKG_DESCRIPTION"), - author: env!("CARGO_PKG_AUTHORS"), - version: version::LONG_VERSION, -}; - -/// Write a message to the daemon's socket, or, if the daemon answers it, print the answer. -fn send_or_query(messages: Messages) -> eyre::Result<()> { - let query = messages.is_query(); - let message = SocketMessage::from(messages); - if query { - print_query(&message); - } else { - send_message(&message)?; - } - Ok(()) -} - -/// The connection to the daemon that the gesture stream tells what the fingers do over. -struct PanLink(komorebi_client::Connection); - -impl pan::Link for PanLink { - fn send(&mut self, message: &SocketMessage) -> io::Result<()> { - self.0.send(message) - } -} - -fn main() -> eyre::Result<()> { - let opts = komorebic_core::cli::parse::(&META); - - match opts.cmd { - Cmd::Messages(messages) => send_or_query(messages)?, - Cmd::Platform(platform) => match platform { - MacosCommands::Docgen(args) => { - let output_dir = args.output.unwrap_or_else(|| PathBuf::from("docs/cli")); - let pages = komorebic_core::docgen::write( - command::(&META), - &DocFormat::PLAIN, - &output_dir, - )?; - for page in pages { - println!("{}", page.display()); - } - } - MacosCommands::Splash(args) => { - splash::show(args.mdm_server)?; - } - MacosCommands::Completions(args) => { - let mut cli = command::(&META); - clap_complete::generate(args.shell, &mut cli, "komorebic", &mut std::io::stdout()); - } - MacosCommands::License(args) => { - let _ = std::fs::remove_file(DATA_DIR.join("icul.validation")); - std::fs::write(DATA_DIR.join("icul"), &args.email)?; - match splash::should()? { - ValidationFeedback::Successful(icul_validation) => { - println!("Individual commercial use license validation successful"); - println!( - "Local validation file saved to {}", - icul_validation.display() - ); - println!("\n{}", std::fs::read_to_string(&icul_validation)?); - } - ValidationFeedback::Unsuccessful(invalid_payload) => { - println!( - "No active individual commercial use license found for {}", - args.email - ); - println!("\n{invalid_payload}"); - println!( - "\nYou can purchase an individual commercial use license at https://lgug2z.com/software/komorebi" - ); - } - ValidationFeedback::NoEmail => {} - ValidationFeedback::NoConnectivity => { - println!( - "Could not make a connection to validate an individual commercial use license for {}", - args.email - ); - } - } - } - MacosCommands::Permissions => { - let mut current_exe = std::env::current_exe().expect("unable to get exec path"); - current_exe.pop(); - let komorebi_exe = current_exe.join("komorebi"); - - let term_program = std::env::var("TERM_PROGRAM") - .unwrap_or_else(|_| String::from("this terminal emulator")); - - println!( - "\nPlease grant Accessibility permissions to \"{}\" and \"{term_program}\"", - komorebi_exe.display() - ); - println!( - "Accessibility permissions are required for komorebi to to manage windows" - ); - Command::new("open") - .arg( - "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility", - ) - .spawn()?; - - println!("\nHit return when done..."); - std::io::stdout().flush()?; - let mut input = String::new(); - std::io::stdin().read_line(&mut input)?; - - println!( - "Please grant Screen Recording permissions to \"{}\" and \"{term_program}\"", - komorebi_exe.display() - ); - println!( - "Screen Recording permissions are required to for komorebi to read window titles" - ); - Command::new("open") - .arg( - "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture", - ) - .spawn()?; - - println!("\nHit return when done..."); - std::io::stdout().flush()?; - let mut input = String::new(); - std::io::stdin().read_line(&mut input)?; - } - MacosCommands::Quickstart => { - fn write_file_with_prompt( - path: &PathBuf, - content: &str, - created_files: &mut Vec, - ) -> eyre::Result<()> { - if path.exists() { - print!( - "{} will be overwritten, do you want to continue? (y/N): ", - path.display() - ); - std::io::stdout().flush()?; - let mut input = String::new(); - std::io::stdin().read_line(&mut input)?; - let trimmed = input.trim().to_lowercase(); - if trimmed == "y" || trimmed == "yes" { - std::fs::write(path, content)?; - created_files.push(path.display().to_string()); - } else { - println!("Skipping {}", path.display()); - } - } else { - std::fs::write(path, content)?; - created_files.push(path.display().to_string()); - } - Ok(()) - } - - let local_appdata_dir = - dirs::data_local_dir().expect("could not find localdata dir"); - let data_dir = local_appdata_dir.join("komorebi"); - std::fs::create_dir_all(&*HOME_DIR)?; - std::fs::create_dir_all(data_dir)?; - - let mut komorebi_json = - include_str!("../../docs/komorebi.example.json").to_string(); - let komorebi_bar_json = - include_str!("../../docs/komorebi.bar.example.json").to_string(); - - if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() { - komorebi_json = - komorebi_json.replace("Env:USERPROFILE", "Env:KOMOREBI_CONFIG_HOME"); - } - - let komorebi_path = HOME_DIR.join("komorebi.json"); - let bar_path = HOME_DIR.join("komorebi.bar.json"); - let applications_path = HOME_DIR.join("applications.json"); - let skhdrc_path = HOME_DIR.join("skhdrc"); - - let mut written_files = Vec::new(); - - write_file_with_prompt(&komorebi_path, &komorebi_json, &mut written_files)?; - write_file_with_prompt(&bar_path, &komorebi_bar_json, &mut written_files)?; - - let applications_json = include_str!("../applications.json"); - write_file_with_prompt(&applications_path, applications_json, &mut written_files)?; - - let whkdrc = include_str!("../../docs/skhdrc.sample"); - write_file_with_prompt(&skhdrc_path, whkdrc, &mut written_files)?; - if written_files.is_empty() { - println!("\nNo files were written.") - } else { - println!( - "\nThe following example files were written:\n{}", - written_files.join("\n") - ); - } - - let mut current_exe = std::env::current_exe().expect("unable to get exec path"); - current_exe.pop(); - let komorebi_exe = current_exe.join("komorebi"); - - let term_program = std::env::var("TERM_PROGRAM") - .unwrap_or_else(|_| String::from("this terminal emulator")); - - println!( - "\nPlease grant Accessibility permissions to \"{}\" and \"{term_program}\"", - komorebi_exe.display() - ); - println!( - "Accessibility permissions are required for komorebi to to manage windows" - ); - Command::new("open") - .arg( - "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility", - ) - .spawn()?; - - println!("\nHit return when done..."); - std::io::stdout().flush()?; - let mut input = String::new(); - std::io::stdin().read_line(&mut input)?; - - println!( - "Please grant Screen Recording permissions to \"{}\" and \"{term_program}\"", - komorebi_exe.display() - ); - println!( - "Screen Recording permissions are required to for komorebi to read window titles" - ); - Command::new("open") - .arg( - "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture", - ) - .spawn()?; - - println!("\nHit return when done..."); - std::io::stdout().flush()?; - let mut input = String::new(); - std::io::stdin().read_line(&mut input)?; - - if let Ok((mdm, server)) = splash::mdm_enrollment() - && mdm - { - if let Some(server) = server { - println!( - "It looks like you are using a corporate device enrolled in mobile device management ({server})\n" - ); - } else { - println!( - "It looks like you are using a corporate device enrolled in mobile device management\n" - ); - } - println!("The Komorebi License does not permit any kind of commercial use\n"); - println!( - "A dedicated Individual Commercial Use License is available if you wish to use this software at work\n" - ); - println!( - "You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement\n" - ); - println!( - "If you already have a license, you can run \"komorebic license \" with the email address your license is associated with\n" - ); - } - - println!("You can now run: komorebic start"); - println!( - "\nIf you have skhd hotkey daemon installed, you can also run: skhd --config {}", - skhdrc_path.display() - ); - } - MacosCommands::EnableAutostart(args) => { - let mut current_exe = std::env::current_exe().expect("unable to get exec path"); - current_exe.pop(); - let komorebic_exe = current_exe.join("komorebi"); - - let plist = match args.config { - None => { - format!( - r#" - - - - - EnvironmentVariables - - PATH - $HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - - RunAtLoad - - KeepAlive - - Label - com.lgug2z.komorebi - ProcessType - Interactive - ProgramArguments - - {} - - StandardOutPath - /tmp/komorebi.out.log - StandardErrorPath - /tmp/komorebi.err.log - -"#, - komorebic_exe.to_string_lossy() - ) - } - Some(config) => { - format!( - r#" - - - - - EnvironmentVariables - - PATH - $HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - - RunAtLoad - - KeepAlive - - Label - com.lgug2z.komorebi - ProcessType - Interactive - ProgramArguments - - {} - --config - {} - - StandardOutPath - /tmp/komorebi.out.log - StandardErrorPath - /tmp/komorebi.err.log - -"#, - komorebic_exe.to_string_lossy(), - config.to_string_lossy() - ) - } - }; - - let target = dirs::home_dir() - .expect("no $HOME dir") - .join("Library") - .join("LaunchAgents") - .join("com.lgug2z.komorebi.plist"); - - std::fs::write(&target, &plist)?; - - println!("Created com.lgug2z.komorebi.plist at {}", target.display()); - Command::new("launchctl") - .args(["load", &*target.to_string_lossy()]) - .output()?; - println!("Ran 'launchctl load {}'", target.display()); - - if args.bar { - let komorebi_bar_exe = current_exe.join("komorebi-bar"); - let komorebic_exe_for_bar = current_exe.join("komorebic"); - - // Create a launcher script that waits for komorebi to be healthy - let launcher_script = format!( - r#"#!/bin/sh - -# Wait for komorebi to be healthy -max_attempts=30 -attempt=0 - -while [ $attempt -lt $max_attempts ]; do - if {} state >/dev/null 2>&1; then - # komorebi is healthy, start the bar - exec {} - fi - attempt=$((attempt + 1)) - sleep 1 -done - -# If we get here, komorebi failed to start -echo "komorebi-bar: Timeout waiting for komorebi to become healthy" >&2 -exit 1 -"#, - komorebic_exe_for_bar.to_string_lossy(), - komorebi_bar_exe.to_string_lossy() - ); - - let launcher_path = DATA_DIR.join("komorebi-bar-launcher.sh"); - std::fs::write(&launcher_path, &launcher_script)?; - - // Make the script executable - #[cfg(unix)] - { - use std::os::unix::fs::PermissionsExt; - let mut perms = std::fs::metadata(&launcher_path)?.permissions(); - perms.set_mode(0o755); - std::fs::set_permissions(&launcher_path, perms)?; - } - - let bar_plist = format!( - r#" - - - - EnvironmentVariables - - PATH - $HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - - RunAtLoad - - KeepAlive - - SuccessfulExit - - - Label - com.lgug2z.komorebi-bar - ProcessType - Interactive - ProgramArguments - - {} - - StandardOutPath - /tmp/komorebi-bar.out.log - StandardErrorPath - /tmp/komorebi-bar.err.log - -"#, - launcher_path.to_string_lossy() - ); - - let bar_target = dirs::home_dir() - .expect("no $HOME dir") - .join("Library") - .join("LaunchAgents") - .join("com.lgug2z.komorebi-bar.plist"); - - std::fs::write(&bar_target, &bar_plist)?; - println!( - "Created com.lgug2z.komorebi-bar.plist at {}", - bar_target.display() - ); - - Command::new("launchctl") - .args(["load", &*bar_target.to_string_lossy()]) - .output()?; - println!("Ran 'launchctl load {}'", bar_target.display()); - } - } - MacosCommands::DisableAutostart => { - let target = dirs::home_dir() - .expect("no $HOME dir") - .join("Library") - .join("LaunchAgents") - .join("com.lgug2z.komorebi.plist"); - - Command::new("launchctl") - .args(["unload", &*target.to_string_lossy()]) - .output()?; - println!("Ran 'launchctl unload {}'", target.display()); - std::fs::remove_file(&target)?; - println!("Deleted {}", target.display()); - - // Also remove bar plist if it exists - let bar_target = dirs::home_dir() - .expect("no $HOME dir") - .join("Library") - .join("LaunchAgents") - .join("com.lgug2z.komorebi-bar.plist"); - - if bar_target.exists() { - Command::new("launchctl") - .args(["unload", &*bar_target.to_string_lossy()]) - .output()?; - println!("Ran 'launchctl unload {}'", bar_target.display()); - std::fs::remove_file(&bar_target)?; - println!("Deleted {}", bar_target.display()); - } - - // Clean up launcher script if it exists - let launcher_path = DATA_DIR.join("komorebi-bar-launcher.sh"); - if launcher_path.exists() { - std::fs::remove_file(&launcher_path)?; - println!("Deleted {}", launcher_path.display()); - } - } - MacosCommands::Start(args) => { - let mut launcher = MacosLauncher { - args: &args, - system: sysinfo::System::new_all(), - }; - - if !launcher::start(&mut launcher)? { - return Ok(()); - } - - if args.bar { - let mut command = &mut Command::new("komorebi-bar"); - - command = command - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .stdin(Stdio::null()); - - command.spawn()?; - } - - println!("\nThank you for using komorebi!\n"); - println!("# Commercial Use License"); - if let Ok((mdm, server)) = splash::mdm_enrollment() - && mdm - { - if let Some(server) = server { - println!( - "* It looks like you are using a corporate device enrolled in mobile device management ({server})" - ); - } else { - println!( - "* It looks like you are using a corporate device enrolled in mobile device management" - ); - } - } - println!( - "* View licensing options https://lgug2z.com/software/komorebi - A commercial use license is required to use komorebi at work" - ); - println!("\n# Personal Use Sponsorship"); - println!( - "* Become a sponsor https://github.com/sponsors/LGUG2Z - $10/month makes a big difference" - ); - println!( - "* Leave a tip https://ko-fi.com/lgug2z - An alternative to GitHub Sponsors" - ); - println!("\n# Community"); - println!( - "* Join the Discord https://discord.gg/mGkn66PHkx - Chat, ask questions, share your desktops" - ); - println!( - "* Subscribe to https://youtube.com/@LGUG2Z - Development videos, feature previews and release overviews" - ); - println!( - "* Explore the Awesome Komorebi list https://github.com/LGUG2Z/awesome-komorebi - Projects in the komorebi ecosystem" - ); - println!("\n# Documentation"); - println!( - "* Read the docs https://lgug2z.github.io/komorebi - Quickly search through all komorebic commands" - ); - } - MacosCommands::Stop(args) => { - send_message(&launcher::stop_message(args.ignore_restore))?; - - if args.bar { - Command::new("pkill").arg("komorebi-bar").spawn()?; - } - - // TODO: see if we need a force quit sometimes like we do on Windows - // let mut system = sysinfo::System::new_all(); - // system.refresh_processes(ProcessesToUpdate::All, true); - // - // let running = system.processes_by_exact_name("komorebi".as_ref()).next(); - // - // if let Some(process) = running { - // process.kill_with(Signal::Interrupt); - // } - } - MacosCommands::Configuration => { - let static_config = HOME_DIR.join("komorebi.json"); - - if static_config.exists() { - println!("{}", static_config.display()); - } - } - MacosCommands::DataDirectory => { - let dir = &*DATA_DIR; - if dir.exists() { - println!("{}", dir.display()); - } - } - MacosCommands::Log => { - let timestamp = Utc::now().format("%Y-%m-%d").to_string(); - let color_log = DATA_DIR.join(format!("komorebi.log.{timestamp}")); - let file = TailedFile::new(File::open(color_log)?); - let locked = file.lock(); - #[allow(clippy::significant_drop_in_scrutinee, clippy::lines_filter_map_ok)] - for line in locked.lines().flatten() { - println!("{line}"); - } - } - MacosCommands::FetchAppSpecificConfiguration => { - let content = reqwest::blocking::get("https://raw.githubusercontent.com/LGUG2Z/komorebi-application-specific-configuration/master/applications.mac.json")? - .text()?; - - let output_file = HOME_DIR.join("applications.json"); - - let mut file = OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(&output_file)?; - - file.write_all(content.as_bytes())?; - - println!( - "Latest version of applications.mac.json from https://github.com/LGUG2Z/komorebi-application-specific-configuration downloaded\n" - ); - println!( - "You can add this to your komorebi.json static configuration file like this: \n\n\"app_specific_configuration_path\": \"{}\"", - output_file.display().to_string().replace("\\", "/") - ); - } - MacosCommands::Pan(args) => { - // a flag that has a default counts as given, so what only goes with --stream - // cannot be left to the parser to say - if !args.stream && (args.sensitivity.is_some() || args.reversed || args.paging) { - command::(&META) - .error( - clap::error::ErrorKind::ArgumentConflict, - "--sensitivity, --reversed and --paging can only be used with --stream", - ) - .exit(); - } - - if args.stream { - pan::run( - BufReader::new(io::stdin()), - pan::Options { - sensitivity: args.sensitivity.unwrap_or(1.0), - reversed: args.reversed, - paging: args.paging, - }, - &mut pan::Socket::new(|| komorebi_client::Connection::open().map(PanLink)), - )?; - } else if let Some(direction) = args.direction { - send_message(&SocketMessage::Pan(direction))?; - } - } - MacosCommands::LayoutRatios(args) => { - if args.columns.is_none() && args.rows.is_none() { - println!( - "No ratios provided, nothing to change. Use --columns or --rows to specify ratios." - ); - } else { - send_message(&SocketMessage::LayoutRatios(args.columns, args.rows))?; - } - } - MacosCommands::ApplicationSpecificConfigurationSchema => { - #[cfg(feature = "schemars")] - { - let schema = komorebi_config::schema::view::< - komorebi_client::ApplicationSpecificConfiguration, - >(komorebi_config::schema::Platform::CURRENT); - print!("{schema}"); - } - } - MacosCommands::NotificationSchema => { - #[cfg(feature = "schemars")] - { - let notification = schemars::schema_for!(komorebi_client::Notification); - let schema = serde_json::to_string_pretty(¬ification)?; - println!("{schema}"); - } - } - MacosCommands::SocketSchema => { - #[cfg(feature = "schemars")] - { - let socket_message = schemars::schema_for!(SocketMessage); - let schema = serde_json::to_string_pretty(&socket_message)?; - println!("{schema}"); - } - } - MacosCommands::StaticConfigSchema => { - #[cfg(feature = "schemars")] - { - let schema = komorebi_config::schema::view::< - komorebi_config::static_config::StaticConfig, - >(komorebi_config::schema::Platform::CURRENT); - print!("{schema}"); - } - } - MacosCommands::GenerateStaticConfig => { - print_query(&SocketMessage::GenerateStaticConfig); - } - }, - } - - Ok(()) +fn main() -> color_eyre::eyre::Result<()> { + macos::main() } diff --git a/komorebi-for-mac/version/Cargo.toml b/komorebi-for-mac/version/Cargo.toml index ac610fad..31b36a45 100644 --- a/komorebi-for-mac/version/Cargo.toml +++ b/komorebi-for-mac/version/Cargo.toml @@ -1,10 +1,13 @@ [package] -name = "version" +name = "version-macos" edition = "2024" -version.workspace = true +version = "0.1.0" [dependencies] -shadow-rs = { workspace = true } +shadow-rs = { version = "1" } [build-dependencies] -shadow-rs = { workspace = true } +shadow-rs = { version = "1" } + +[lib] +name = "version" diff --git a/komorebi/Cargo.toml b/komorebi/Cargo.toml index 01d4685c..af0163d1 100644 --- a/komorebi/Cargo.toml +++ b/komorebi/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "komorebi" +name = "komorebi-windows" version = "0.1.42" description = "A tiling window manager for Windows" repository = "https://github.com/LGUG2Z/komorebi" @@ -79,3 +79,10 @@ schemars = [ "komorebi-layouts/schemars", "komorebi-protocol/schemars", ] + +[lib] +name = "komorebi" + +[[bin]] +name = "komorebi" +path = "src/main.rs" diff --git a/komorebi/src/main.rs b/komorebi/src/main.rs index 9b4f12d3..76d858ce 100644 --- a/komorebi/src/main.rs +++ b/komorebi/src/main.rs @@ -172,7 +172,7 @@ enum LogLevel { } #[derive(Parser)] -#[clap(author, about, version = komorebi::build::CLAP_LONG_VERSION)] +#[clap(name = "komorebi", author, about, version = komorebi::build::CLAP_LONG_VERSION)] struct Opts { /// Allow the use of komorebi's custom focus-follows-mouse implementation #[clap(short, long = "ffm")] diff --git a/komorebic/Cargo.toml b/komorebic/Cargo.toml index a264aae8..97d0a08d 100644 --- a/komorebic/Cargo.toml +++ b/komorebic/Cargo.toml @@ -1,31 +1,37 @@ [package] name = "komorebic" version = "0.1.42" -description = "The command-line interface for Komorebi, a tiling window manager for Windows" +description = "The command-line interface for Komorebi, a tiling window manager for Windows, KDE Plasma and macOS" repository = "https://github.com/LGUG2Z/komorebi" edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +# The dependencies of each platform are in its own table, so that a build for one target compiles +# nothing of the others. A dependency key can only have one path, so the Linux and macOS crates +# are renamed (`komorebi-client-linux`, ...) and main.rs gives them the names the modules use. + [dependencies] -komorebi-config = { path = "../crates/komorebi-config", default-features = false } komorebi-client = { path = "../komorebi-client", default-features = false } +komorebi-config = { path = "../crates/komorebi-config", default-features = false } komorebic-core = { path = "../crates/komorebic-core" } chrono = { workspace = true } clap = { workspace = true } color-eyre = { workspace = true } dirs = { workspace = true } -dunce = { workspace = true } fs-tail = "0.1" lazy_static = { workspace = true } +schemars = { workspace = true, optional = true } +serde_json = { workspace = true } + +[target.'cfg(windows)'.dependencies] +dunce = { workspace = true } miette = { version = "7", features = ["fancy"] } open = "5" powershell_script = "1.0" reqwest = { version = "0.12", features = ["blocking"] } -schemars = { workspace = true, optional = true } serde = { workspace = true } -serde_json = { workspace = true } shadow-rs = { workspace = true } sysinfo = { workspace = true } thiserror = "2" @@ -33,13 +39,29 @@ which = { workspace = true } win-msgbox = "0.2" windows = { workspace = true } -[build-dependencies] +[target.'cfg(target_os = "linux")'.dependencies] +komorebi-linux = { package = "komorebi-linux", path = "../komorebi-for-kde/komorebi", default-features = false } +komorebi-hotkeys = { path = "../komorebi-for-kde/komorebi-hotkeys" } +version-linux = { package = "version-linux", path = "../komorebi-for-kde/version" } +clap_complete = "4" +sysinfo = "0.40" + +[target.'cfg(target_os = "macos")'.dependencies] +version-macos = { package = "version-macos", path = "../komorebi-for-mac/version" } +clap_complete = "4" reqwest = { version = "0.12", features = ["blocking"] } +sysinfo = "0.38" + +[build-dependencies] shadow-rs = { workspace = true } [features] default = ["schemars"] -schemars = ["dep:schemars", "komorebi-client/default", "komorebi-config/schemars"] +schemars = [ + "dep:schemars", + "komorebi-client/default", + "komorebi-config/schemars", +] [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(FALSE)'] } diff --git a/komorebic/applications.json b/komorebic/applications.json new file mode 100644 index 00000000..d78ff166 --- /dev/null +++ b/komorebic/applications.json @@ -0,0 +1,3299 @@ +{ + "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/master/schema.asc.json", + "1Password": { + "ignore": [ + { + "kind": "Exe", + "id": "1Password.exe", + "matching_strategy": "Equals" + } + ] + }, + "Ableton Live": { + "ignore": [ + { + "kind": "Class", + "id": "AbletonVstPlugClass", + "matching_strategy": "Legacy" + }, + { + "kind": "Class", + "id": "Vst3PlugWindow", + "matching_strategy": "Legacy" + }, + [ + { + "kind": "Class", + "id": "Ableton Live Window Class", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Ableton", + "matching_strategy": "DoesNotContain" + } + ] + ] + }, + "Adobe Creative Cloud": { + "tray_and_multi_window": [ + { + "kind": "Class", + "id": "CreativeCloudDesktopWindowClass", + "matching_strategy": "Legacy" + } + ] + }, + "Adobe Photoshop": { + "ignore": [ + { + "kind": "Class", + "id": "PSDialogBox", + "matching_strategy": "Equals" + } + ] + }, + "Adobe Premiere Pro": { + "ignore": [ + { + "kind": "Class", + "id": "DroverLord - Window Class", + "matching_strategy": "Equals" + } + ] + }, + "Affinity Designer 2": { + "ignore": [ + { + "kind": "Exe", + "id": "Designer.exe", + "matching_strategy": "Equals" + } + ], + "manage": [ + { + "kind": "Title", + "id": "Affinity Designer 2", + "matching_strategy": "Equals" + } + ] + }, + "Affinity Photo 2": { + "ignore": [ + { + "kind": "Exe", + "id": "Photo.exe", + "matching_strategy": "Equals" + } + ], + "manage": [ + { + "kind": "Title", + "id": "Affinity Photo 2", + "matching_strategy": "Equals" + } + ] + }, + "Affinity Publisher 2": { + "ignore": [ + { + "kind": "Exe", + "id": "Publisher.exe", + "matching_strategy": "Equals" + } + ], + "manage": [ + { + "kind": "Title", + "id": "Affinity Publisher 2", + "matching_strategy": "Equals" + } + ] + }, + "Akiflow": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Akiflow.exe", + "matching_strategy": "Equals" + } + ] + }, + "Amazon Chime": { + "ignore": [ + { + "kind": "Title", + "id": "Meeting Controls", + "matching_strategy": "EndsWith" + } + ] + }, + "Android Studio": { + "object_name_change": [ + { + "kind": "Exe", + "id": "studio64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Anki": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Anki.exe", + "matching_strategy": "Equals" + } + ], + "floating": [ + [ + { + "kind": "Exe", + "id": "Anki.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "- Anki", + "matching_strategy": "DoesNotEndWith" + } + ] + ] + }, + "ApplicationFrameHost": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ApplicationFrameHost.exe", + "matching_strategy": "Equals" + } + ] + }, + "Arc Browser": { + "ignore": [ + { + "kind": "Title", + "id": "Arc picture in picture", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Arc extension popup", + "matching_strategy": "Equals" + } + ] + }, + "ArmCord": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ArmCord.exe", + "matching_strategy": "Equals" + } + ] + }, + "AutoDesk AutoCAD Suite": { + "ignore": [ + [ + { + "kind": "Class", + "id": "Afx:", + "matching_strategy": "Contains" + }, + { + "kind": "Exe", + "id": "acad.exe", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Class", + "id": "HwndWrapper[DefaultDomain", + "matching_strategy": "StartsWith" + }, + { + "kind": "Exe", + "id": "acad.exe", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Class", + "id": "WindowsForms10.Window", + "matching_strategy": "StartsWith" + }, + { + "kind": "Exe", + "id": "acad.exe", + "matching_strategy": "Equals" + } + ] + ] + }, + "AutoHotkey": { + "ignore": [ + { + "kind": "Title", + "id": "Window Spy", + "matching_strategy": "StartsWith" + }, + { + "kind": "Exe", + "id": "AutoHotkeyUX.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "AutoHotkeyU64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Ayugram": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ayugram.exe", + "matching_strategy": "Equals" + } + ] + }, + "Balabolka": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "balabolka.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "TBalabolkaForm", + "matching_strategy": "DoesNotEqual" + } + ] + ] + }, + "Barrier": { + "floating": [ + { + "kind": "Exe", + "id": "barrier.exe", + "matching_strategy": "Equals" + } + ] + }, + "Battlestate Games Launcher": { + "floating": [ + { + "kind": "Exe", + "id": "BsgLauncher.exe", + "matching_strategy": "Equals" + } + ] + }, + "Beeper": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Beeper.exe", + "matching_strategy": "Equals" + } + ] + }, + "Bitwarden": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Bitwarden.exe", + "matching_strategy": "Equals" + } + ] + }, + "Blender": { + "floating": [ + [ + { + "kind": "Exe", + "id": "blender.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Blender", + "matching_strategy": "DoesNotContain" + } + ] + ], + "slow_application": [ + { + "kind": "Exe", + "id": "blender.exe", + "matching_strategy": "Equals" + } + ] + }, + "Blitz": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Blitz.exe", + "matching_strategy": "Equals" + } + ] + }, + "Bloxstrap": { + "ignore": [ + { + "kind": "Exe", + "id": "Bloxstrap.exe", + "matching_strategy": "Equals" + } + ] + }, + "Brave Browser": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "brave.exe", + "matching_strategy": "Equals" + } + ] + }, + "Browser Tamer": { + "ignore": [ + { + "kind": "Exe", + "id": "bt.exe", + "matching_strategy": "Equals" + } + ] + }, + "Calculator": { + "ignore": [ + { + "kind": "Title", + "id": "Calculator", + "matching_strategy": "Equals" + } + ] + }, + "Citrix Receiver": { + "ignore": [ + { + "kind": "Exe", + "id": "SelfService.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "SelfService.exe", + "matching_strategy": "Equals" + } + ] + }, + "Clash Verge": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Clash Verge.exe", + "matching_strategy": "Equals" + } + ] + }, + "Clementine": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "clementine.exe", + "matching_strategy": "Equals" + } + ] + }, + "CLion": { + "ignore": [ + { + "kind": "Class", + "id": "SunAwtDialog", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "clion64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "clion64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Clumsy": { + "floating": [ + { + "kind": "Exe", + "id": "clumsy.exe", + "matching_strategy": "Equals" + } + ] + }, + "CopyQ": { + "ignore": [ + { + "kind": "Exe", + "id": "copyq.exe", + "matching_strategy": "Equals" + } + ] + }, + "Core Temp": { + "ignore": [ + { + "kind": "Exe", + "id": "Core Temp.exe", + "matching_strategy": "Equals" + } + ] + }, + "Credential Manager UI Host": { + "ignore": [ + { + "kind": "Exe", + "id": "CredentialUIBroker.exe", + "matching_strategy": "Equals" + } + ] + }, + "Cron": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Cron.exe", + "matching_strategy": "Equals" + } + ] + }, + "DataGrip": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "datagrip64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "datagrip64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Dell Display Manager": { + "ignore": [ + { + "kind": "Exe", + "id": "DDM.exe", + "matching_strategy": "Equals" + } + ] + }, + "Delphi applications": { + "ignore": [ + { + "kind": "Class", + "id": "TApplication", + "matching_strategy": "Legacy" + }, + { + "kind": "Class", + "id": "TWizardForm", + "matching_strategy": "Legacy" + } + ] + }, + "DesktopMate": { + "ignore": [ + { + "kind": "Exe", + "id": "DesktopMate.exe", + "matching_strategy": "Equals" + } + ] + }, + "Discord": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Discord.exe", + "matching_strategy": "Equals" + } + ], + "layered": [ + { + "kind": "Exe", + "id": "Discord.exe", + "matching_strategy": "Equals" + } + ] + }, + "DiscordCanary": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "DiscordCanary.exe", + "matching_strategy": "Equals" + } + ], + "layered": [ + { + "kind": "Exe", + "id": "DiscordCanary.exe", + "matching_strategy": "Equals" + } + ] + }, + "DiscordDevelopment": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "DiscordDevelopment.exe", + "matching_strategy": "Equals" + } + ], + "layered": [ + { + "kind": "Exe", + "id": "DiscordDevelopment.exe", + "matching_strategy": "Equals" + } + ] + }, + "DiscordPTB": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "DiscordPTB.exe", + "matching_strategy": "Equals" + } + ], + "layered": [ + { + "kind": "Exe", + "id": "DiscordPTB.exe", + "matching_strategy": "Equals" + } + ] + }, + "Dropbox": { + "ignore": [ + { + "kind": "Exe", + "id": "Dropbox.exe", + "matching_strategy": "Equals" + } + ] + }, + "DS4Windows": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "DS4Windows.exe", + "matching_strategy": "Equals" + } + ] + }, + "EA Desktop": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "EADesktop.exe", + "matching_strategy": "Equals" + } + ] + }, + "Eagle": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Eagle.exe", + "matching_strategy": "Equals" + } + ] + }, + "Eclipse SWT": { + "object_name_change": [ + { + "kind": "Class", + "id": "SWT_Window", + "matching_strategy": "StartsWith" + } + ] + }, + "ElectronMail": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ElectronMail.exe", + "matching_strategy": "Equals" + } + ] + }, + "Electrum": { + "ignore": [ + { + "kind": "Title", + "id": "Create/Restore wallet", + "matching_strategy": "Equals" + } + ] + }, + "Element": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Element.exe", + "matching_strategy": "Equals" + } + ] + }, + "Elephicon": { + "ignore": [ + { + "kind": "Exe", + "id": "Elephicon.exe", + "matching_strategy": "Equals" + } + ] + }, + "ElevenClock": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ElevenClock.exe", + "matching_strategy": "Equals" + } + ] + }, + "Elgato Camera Hub": { + "ignore": [ + { + "kind": "Exe", + "id": "Camera Hub.exe", + "matching_strategy": "Equals" + } + ] + }, + "Elgato Control Center": { + "ignore": [ + { + "kind": "Exe", + "id": "ControlCenter.exe", + "matching_strategy": "Equals" + } + ] + }, + "Elgato Wave Link": { + "ignore": [ + { + "kind": "Exe", + "id": "WaveLink.exe", + "matching_strategy": "Equals" + } + ] + }, + "Epic Games Launcher": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "EpicGamesLauncher.exe", + "matching_strategy": "Equals" + } + ] + }, + "Everything": { + "tray_and_multi_window": [ + { + "kind": "Class", + "id": "EVERYTHING", + "matching_strategy": "Legacy" + } + ] + }, + "Everything1.5a": { + "manage": [ + { + "kind": "Class", + "id": "EVERYTHING_(1.5a)", + "matching_strategy": "Legacy" + } + ], + "tray_and_multi_window": [ + { + "kind": "Class", + "id": "EVERYTHING_(1.5a)", + "matching_strategy": "Legacy" + } + ] + }, + "f.lux": { + "ignore": [ + { + "kind": "Exe", + "id": "flux.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "flux.exe", + "matching_strategy": "Equals" + } + ] + }, + "FFMetrics": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "FFMetrics.exe", + "matching_strategy": "Equals" + } + ] + }, + "Files": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Files.exe", + "matching_strategy": "Equals" + } + ] + }, + "Fork": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Fork.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Fork -", + "matching_strategy": "DoesNotStartWith" + } + ] + ] + }, + "FreeCAD": { + "floating": [ + [ + { + "kind": "Exe", + "id": "freecad.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "Qt51515QWindowIcon", + "matching_strategy": "Equals" + } + ] + ] + }, + "FreeTube": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "FreeTube.exe", + "matching_strategy": "Equals" + } + ], + "ignore": [ + [ + { + "kind": "Exe", + "id": "FreeTube.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Picture in picture", + "matching_strategy": "Equals" + } + ] + ] + }, + "GIMP": { + "floating": [ + [ + { + "kind": "Exe", + "id": "gimp", + "matching_strategy": "StartsWith" + }, + { + "kind": "Title", + "id": "GNU", + "matching_strategy": "DoesNotContain" + }, + { + "kind": "Title", + "id": "GIMP", + "matching_strategy": "DoesNotEndWith" + } + ], + [ + { + "kind": "Exe", + "id": "gimp", + "matching_strategy": "StartsWith" + }, + { + "kind": "Title", + "id": "About GIMP", + "matching_strategy": "Equals" + } + ] + ] + }, + "GitHub Credential Manager": { + "ignore": [ + { + "kind": "Exe", + "id": "git-credential-manager.exe", + "matching_strategy": "Equals" + } + ] + }, + "Godot Engine": { + "object_name_change": [ + { + "kind": "Exe", + "id": "Godot_v", + "matching_strategy": "StartsWith" + } + ] + }, + "Godot Manager": { + "manage": [ + { + "kind": "Exe", + "id": "GodotManager.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "GodotManager.exe", + "matching_strategy": "Equals" + } + ] + }, + "GOG Galaxy": { + "ignore": [ + { + "kind": "Class", + "id": "Chrome_RenderWidgetHostHWND", + "matching_strategy": "Legacy" + } + ], + "manage": [ + { + "kind": "Exe", + "id": "GalaxyClient.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "GalaxyClient.exe", + "matching_strategy": "Equals" + } + ] + }, + "GoLand": { + "ignore": [ + { + "kind": "Class", + "id": "SunAwtDialog", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "goland64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "goland64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Golden Dict": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "GoldenDict.exe", + "matching_strategy": "Equals" + } + ] + }, + "Google Chrome": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "chrome.exe", + "matching_strategy": "Equals" + } + ] + }, + "Google Drive": { + "ignore": [ + { + "kind": "Exe", + "id": "GoogleDriveFS.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "GoogleDriveFS.exe", + "matching_strategy": "Equals" + } + ] + }, + "Google Earth Pro": { + "ignore": [ + [ + { + "kind": "Class", + "id": "Qt5QWindowToolSaveBits", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "googleearth.exe", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Class", + "id": "Qt5QWindowIcon", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Google Earth Pro", + "matching_strategy": "DoesNotEqual" + }, + { + "kind": "Exe", + "id": "googleearth.exe", + "matching_strategy": "Equals" + } + ] + ] + }, + "GoPro Webcam": { + "tray_and_multi_window": [ + { + "kind": "Class", + "id": "GoPro Webcam", + "matching_strategy": "Legacy" + } + ] + }, + "Grayjay": { + "manage": [ + [ + { + "kind": "Exe", + "id": "dotcefnative.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Grayjay", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "dotcefnative.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Grayjay (Sub)", + "matching_strategy": "Equals" + } + ] + ] + }, + "Guitar Rig 7": { + "ignore": [ + { + "kind": "Exe", + "id": "Guitar Rig 7.exe", + "matching_strategy": "Equals" + } + ] + }, + "Hammer": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "hammer.exe", + "matching_strategy": "Equals" + } + ], + "ignore": [ + [ + { + "kind": "Exe", + "id": "hammer.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "Afx:", + "matching_strategy": "StartsWith" + } + ] + ], + "slow_application": [ + { + "kind": "Exe", + "id": "hammer.exe", + "matching_strategy": "Equals" + } + ] + }, + "Honkai Star Rail": { + "manage": [ + { + "kind": "Exe", + "id": "StarRail.Exe", + "matching_strategy": "Equals" + } + ] + }, + "HWiNFO64": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "HWiNFO64.EXE", + "matching_strategy": "Equals" + } + ] + }, + "HxD": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "HxD.exe", + "matching_strategy": "Equals" + } + ], + "ignore": [ + [ + { + "kind": "Exe", + "id": "HxD.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "TFormHexView", + "matching_strategy": "Equals" + } + ] + ] + }, + "IDA": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ida.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "ida64.exe", + "matching_strategy": "Equals" + } + ], + "floating": [ + [ + { + "kind": "Exe", + "id": "ida.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "IDA -", + "matching_strategy": "DoesNotStartWith" + }, + { + "kind": "Title", + "id": "IDA v", + "matching_strategy": "DoesNotStartWith" + } + ], + [ + { + "kind": "Exe", + "id": "ida64.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "IDA -", + "matching_strategy": "DoesNotStartWith" + }, + { + "kind": "Title", + "id": "IDA v", + "matching_strategy": "DoesNotStartWith" + } + ] + ] + }, + "IntelliJ IDEA": { + "ignore": [ + { + "kind": "Class", + "id": "SunAwtDialog", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "idea64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "idea64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Itch.io": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "itch.exe", + "matching_strategy": "Equals" + } + ] + }, + "JavaFX": { + "object_name_change": [ + { + "kind": "Class", + "id": "GlassWndClass-GlassWindowClass", + "matching_strategy": "StartsWith" + } + ] + }, + "JetBrains Client": { + "ignore": [ + { + "kind": "Class", + "id": "SunAwtDialog", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "jetbrains_client64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "jetbrains_client64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Keyviz": { + "ignore": [ + { + "kind": "Exe", + "id": "keyviz.exe", + "matching_strategy": "Equals" + } + ] + }, + "Kleopatra": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "kleopatra.exe", + "matching_strategy": "Equals" + } + ] + }, + "komorebi-bar": { + "ignore": [ + { + "kind": "Exe", + "id": "komorebi-bar.exe", + "matching_strategy": "Equals" + } + ] + }, + "komorebi-gui": { + "ignore": [ + { + "kind": "Exe", + "id": "komorebi-gui.exe", + "matching_strategy": "Equals" + } + ] + }, + "KOOK": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "KOOK.exe", + "matching_strategy": "Equals" + } + ] + }, + "Kotatogram": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Kotatogram.exe", + "matching_strategy": "Equals" + } + ] + }, + "Lens": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Lens.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Loading", + "matching_strategy": "Equals" + } + ] + ] + }, + "Libre Hardware Monitor": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "LibreHardwareMonitor.exe", + "matching_strategy": "Equals" + } + ] + }, + "LibreCAD": { + "ignore": [ + [ + { + "kind": "Title", + "id": "LibreCAD", + "matching_strategy": "DoesNotStartWith" + }, + { + "kind": "Exe", + "id": "LibreCAD.exe", + "matching_strategy": "Equals" + } + ] + ] + }, + "LibreOffice": { + "object_name_change": [ + { + "kind": "Exe", + "id": "soffice.bin", + "matching_strategy": "Equals" + } + ] + }, + "Line": { + "floating": [ + { + "kind": "Exe", + "id": "LineMediaPlayer.exe", + "matching_strategy": "Equals" + } + ] + }, + "LocalSend": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "localsend_app.exe", + "matching_strategy": "Equals" + } + ] + }, + "Logi Bolt": { + "ignore": [ + { + "kind": "Exe", + "id": "LogiBolt.exe", + "matching_strategy": "Equals" + } + ] + }, + "Logitech G HUB": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "lghub.exe", + "matching_strategy": "Equals" + } + ] + }, + "Logitech Options": { + "ignore": [ + { + "kind": "Exe", + "id": "LogiOptionsUI.exe", + "matching_strategy": "Equals" + } + ] + }, + "LogiTune": { + "ignore": [ + { + "kind": "Exe", + "id": "LogiTune.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "LogiTune.exe", + "matching_strategy": "Equals" + } + ] + }, + "MacType": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "MacTray.exe", + "matching_strategy": "Equals" + } + ] + }, + "Mailspring": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "mailspring.exe", + "matching_strategy": "Equals" + } + ] + }, + "ManicTime": { + "manage": [ + { + "kind": "Exe", + "id": "ManicTimeClient.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ManicTimeClient.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "ManicTimeClient.exe", + "matching_strategy": "Equals" + } + ] + }, + "ManyCam": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ManyCam.exe", + "matching_strategy": "Equals" + } + ] + }, + "Mattermost": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Mattermost.exe", + "matching_strategy": "Equals" + } + ] + }, + "MaxxAudioPro": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "ApplicationFrameHost.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "MaxxAudioPro", + "matching_strategy": "Equals" + } + ] + ] + }, + "MicMute": { + "floating": [ + { + "kind": "Exe", + "id": "MicMute.exe", + "matching_strategy": "Equals" + } + ] + }, + "Microsoft Active Accessibility": { + "ignore": [ + { + "kind": "Class", + "id": "#32770", + "matching_strategy": "Legacy" + } + ] + }, + "Microsoft Edge": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "msedge.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "Chrome_WidgetWin_2", + "matching_strategy": "Equals" + } + ] + ] + }, + "Microsoft Excel": { + "ignore": [ + { + "kind": "Class", + "id": "_WwB", + "matching_strategy": "Legacy" + } + ], + "layered": [ + { + "kind": "Exe", + "id": "EXCEL.EXE", + "matching_strategy": "Equals" + } + ] + }, + "Microsoft IME Pad": { + "floating": [ + { + "kind": "Exe", + "id": "IMEPADSV.EXE", + "matching_strategy": "Equals" + } + ] + }, + "Microsoft Outlook": { + "ignore": [ + { + "kind": "Class", + "id": "_WwB", + "matching_strategy": "Legacy" + }, + { + "kind": "Class", + "id": "MsoSplash", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "OUTLOOK.EXE", + "matching_strategy": "Equals" + } + ], + "layered": [ + { + "kind": "Exe", + "id": "OUTLOOK.EXE", + "matching_strategy": "Equals" + } + ] + }, + "Microsoft PC Manager": { + "ignore": [ + { + "kind": "Exe", + "id": "MSPCManager.exe", + "matching_strategy": "Equals" + } + ] + }, + "Microsoft PowerPoint": { + "ignore": [ + { + "kind": "Class", + "id": "_WwB", + "matching_strategy": "Legacy" + } + ], + "layered": [ + { + "kind": "Exe", + "id": "POWERPNT.EXE", + "matching_strategy": "Equals" + } + ] + }, + "Microsoft SQL Server Management Studio": { + "floating": [ + [ + { + "kind": "Exe", + "id": "Ssms.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "WindowsForms10.Window.8.app", + "matching_strategy": "StartsWith" + } + ] + ] + }, + "Microsoft Teams": { + "tray_and_multi_window": [ + { + "kind": "Class", + "id": "TeamsWebView", + "matching_strategy": "Equals" + } + ] + }, + "Microsoft Teams classic": { + "ignore": [ + { + "kind": "Title", + "id": "Microsoft Teams Notification", + "matching_strategy": "Legacy" + }, + { + "kind": "Title", + "id": "Microsoft Teams Call", + "matching_strategy": "Legacy" + } + ] + }, + "Microsoft Terminal Services Client": { + "ignore": [ + { + "kind": "Class", + "id": "OPContainerClass", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "IHWindowClass", + "matching_strategy": "Equals" + } + ] + }, + "Microsoft Word": { + "ignore": [ + { + "kind": "Class", + "id": "_WwB", + "matching_strategy": "Legacy" + } + ], + "layered": [ + { + "kind": "Exe", + "id": "WINWORD.EXE", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "WINWORD.exe", + "matching_strategy": "Equals" + } + ] + }, + "MobaXterm": { + "manage": [ + [ + { + "kind": "Exe", + "id": "MobaXterm.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "TMobaXtermForm", + "matching_strategy": "Equals" + } + ] + ] + }, + "Mod Organizer 2": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "ModOrganizer.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Extracting files", + "matching_strategy": "Equals" + } + ] + ] + }, + "Modern Flyouts": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ModernFlyoutsHost.exe", + "matching_strategy": "Equals" + } + ] + }, + "MOTU M-Series": { + "floating": [ + { + "kind": "Exe", + "id": "MOTUMSeries.exe", + "matching_strategy": "Equals" + } + ] + }, + "Mozilla Firefox": { + "ignore": [ + { + "kind": "Class", + "id": "MozillaDialogClass", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "MozillaTaskbarPreviewClass", + "matching_strategy": "Legacy" + }, + [ + { + "kind": "Title", + "id": "Picture-in-Picture", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "firefox.exe", + "matching_strategy": "Equals" + } + ] + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "firefox.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "firefox.exe", + "matching_strategy": "Equals" + } + ], + "slow_application": [ + { + "kind": "Exe", + "id": "firefox.exe", + "matching_strategy": "Equals" + } + ] + }, + "mpv": { + "object_name_change": [ + { + "kind": "Class", + "id": "mpv", + "matching_strategy": "Legacy" + } + ] + }, + "mpv.net": { + "object_name_change": [ + { + "kind": "Exe", + "id": "mpvnet.exe", + "matching_strategy": "Equals" + } + ] + }, + "NetEase Cloud Music": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "cloudmusic.exe", + "matching_strategy": "Equals" + } + ] + }, + "NiceHash Miner": { + "manage": [ + { + "kind": "Exe", + "id": "nhm_app.exe", + "matching_strategy": "Equals" + } + ] + }, + "NohBoard": { + "ignore": [ + { + "kind": "Exe", + "id": "NohBoard.exe", + "matching_strategy": "Equals" + } + ] + }, + "Notion": { + "ignore": [ + { + "kind": "Title", + "id": "Notion - Command Search", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Notion.exe", + "matching_strategy": "Equals" + } + ] + }, + "Notion Calendar": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Notion Calendar.exe", + "matching_strategy": "Equals" + } + ] + }, + "Notion Enhanced": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Notion Enhanced.exe", + "matching_strategy": "Equals" + } + ] + }, + "NZXT CAM": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "NZXT CAM.exe", + "matching_strategy": "Equals" + } + ] + }, + "OBS Studio (32-bit)": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "obs32.exe", + "matching_strategy": "Equals" + } + ] + }, + "OBS Studio (64-bit)": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "obs64.exe", + "matching_strategy": "Equals" + } + ] + }, + "OneDrive": { + "ignore": [ + { + "kind": "Class", + "id": "OneDriveReactNativeWin32WindowClass", + "matching_strategy": "Legacy" + } + ] + }, + "OneQuick": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "OneQuick.exe", + "matching_strategy": "Equals" + } + ] + }, + "ONLYOFFICE Editors": { + "tray_and_multi_window": [ + { + "kind": "Class", + "id": "DocEditorsWindowClass", + "matching_strategy": "Legacy" + } + ] + }, + "OpenRGB": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "OpenRGB.exe", + "matching_strategy": "Equals" + } + ] + }, + "paint.net": { + "ignore": [ + { + "kind": "Exe", + "id": "paintdotnet.exe", + "matching_strategy": "Equals" + } + ] + }, + "Paradox Launcher": { + "ignore": [ + { + "kind": "Exe", + "id": "Paradox Launcher.exe", + "matching_strategy": "Equals" + } + ] + }, + "PAYDAY 2": { + "ignore": [ + { + "kind": "Exe", + "id": "payday2_win32_release.exe", + "matching_strategy": "Equals" + } + ] + }, + "PhpStorm": { + "ignore": [ + { + "kind": "Class", + "id": "SunAwtDialog", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "phpstorm64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "phpstorm64.exe", + "matching_strategy": "Equals" + } + ] + }, + "pinentry": { + "ignore": [ + { + "kind": "Exe", + "id": "pinentry.exe", + "matching_strategy": "Equals" + } + ] + }, + "Playnite": { + "ignore": [ + { + "kind": "Exe", + "id": "Playnite.FullscreenApp.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Playnite.DesktopApp.exe", + "matching_strategy": "Equals" + } + ] + }, + "PowerToys": { + "ignore": [ + { + "kind": "Exe", + "id": "PowerToys.ColorPickerUI.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "PowerToys.CropAndLock.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "PowerToys.ImageResizer.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "PowerToys.Peek.UI.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "PowerToys.PowerLauncher.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "PowerToys.PowerAccent.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "PowerToys.AdvancedPaste.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "PowerToys.FileLocksmithUI.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "PowerToys.QuickAccess.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "Microsoft.CmdPal.UI.exe", + "matching_strategy": "Equals" + } + ] + }, + "Prime95": { + "floating": [ + { + "kind": "Exe", + "id": "prime95.exe", + "matching_strategy": "Equals" + } + ] + }, + "Prism Launcher": { + "floating": [ + [ + { + "kind": "Exe", + "id": "prismlauncher.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "- Prism Launcher", + "matching_strategy": "Contains" + } + ] + ] + }, + "Process Hacker": { + "ignore": [ + { + "kind": "Exe", + "id": "ProcessHacker.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ProcessHacker.exe", + "matching_strategy": "Equals" + } + ] + }, + "ProtonDrive": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ProtonDrive.exe", + "matching_strategy": "Equals" + } + ] + }, + "ProtonVPN": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ProtonVPN.exe", + "matching_strategy": "Equals" + } + ] + }, + "PyCharm": { + "ignore": [ + { + "kind": "Class", + "id": "SunAwtDialog", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "pycharm64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "pycharm64.exe", + "matching_strategy": "Equals" + } + ] + }, + "qBittorrent": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "qbittorrent.exe", + "matching_strategy": "Equals" + } + ], + "ignore": [ + [ + { + "kind": "Exe", + "id": "qbittorrent.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Exiting qBittorrent", + "matching_strategy": "Equals" + } + ] + ] + }, + "QGIS": { + "floating": [ + [ + { + "kind": "Exe", + "id": "qgis-bin.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "QGIS", + "matching_strategy": "DoesNotContain" + } + ], + [ + { + "kind": "Exe", + "id": "qgis-ltr-bin.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "QGIS", + "matching_strategy": "DoesNotContain" + } + ] + ] + }, + "QQ": { + "ignore": [ + { + "kind": "Title", + "id": "图片查看器", + "matching_strategy": "Legacy" + }, + { + "kind": "Title", + "id": "群聊的聊天记录", + "matching_strategy": "Legacy" + }, + { + "kind": "Title", + "id": "语音通话", + "matching_strategy": "Legacy" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "QQ.exe", + "matching_strategy": "Equals" + } + ] + }, + "QtScrcpy": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "QtScrcpy.exe", + "matching_strategy": "Equals" + } + ] + }, + "QuickLook": { + "ignore": [ + { + "kind": "Exe", + "id": "QuickLook.exe", + "matching_strategy": "Equals" + } + ] + }, + "RepoZ": { + "ignore": [ + { + "kind": "Exe", + "id": "RepoZ.exe", + "matching_strategy": "Equals" + } + ] + }, + "Rider": { + "ignore": [ + { + "kind": "Class", + "id": "SunAwtDialog", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "PopupMessageWindow", + "matching_strategy": "Legacy" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "rider64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "rider64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Roblox FPS Unlocker": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "rbxfpsunlocker.exe", + "matching_strategy": "Equals" + } + ] + }, + "RoundedTB": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "RoundedTB.exe", + "matching_strategy": "Equals" + } + ] + }, + "RustRover": { + "ignore": [ + { + "kind": "Class", + "id": "SunAwtDialog", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "rustrover64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "rustrover64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Sandboxie Plus": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "SandMan.exe", + "matching_strategy": "Equals" + } + ] + }, + "ShareX": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ShareX.exe", + "matching_strategy": "Equals" + } + ] + }, + "Sideloadly": { + "ignore": [ + { + "kind": "Exe", + "id": "sideloadly.exe", + "matching_strategy": "Equals" + } + ] + }, + "Signal": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Signal.exe", + "matching_strategy": "Equals" + } + ] + }, + "SiriKali": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "sirikali.exe", + "matching_strategy": "Equals" + } + ] + }, + "Slack": { + "ignore": [ + { + "kind": "Class", + "id": "Chrome_RenderWidgetHostHWND", + "matching_strategy": "Legacy" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "slack.exe", + "matching_strategy": "Equals" + } + ] + }, + "Smart Install Maker": { + "ignore": [ + { + "kind": "Class", + "id": "obj_App", + "matching_strategy": "Legacy" + }, + { + "kind": "Class", + "id": "obj_Form", + "matching_strategy": "Legacy" + } + ] + }, + "SnippingTool": { + "ignore": [ + { + "kind": "Exe", + "id": "SnippingTool.exe", + "matching_strategy": "Equals" + } + ] + }, + "SoulseekQt": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "SoulseekQt.exe", + "matching_strategy": "Equals" + } + ] + }, + "Spotify": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Spotify.exe", + "matching_strategy": "Equals" + } + ] + }, + "Steam": { + "layered": [ + { + "kind": "Exe", + "id": "steam.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "steam.exe", + "matching_strategy": "Equals" + } + ], + "ignore": [ + [ + { + "kind": "Exe", + "id": "steamwebhelper.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Steam", + "matching_strategy": "DoesNotEqual" + } + ] + ], + "floating": [ + [ + { + "kind": "Exe", + "id": "steam.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "BootstrapUpdateUIClass", + "matching_strategy": "Equals" + } + ] + ] + }, + "Steam Beta": { + "ignore": [ + { + "kind": "Title", + "id": "notificationtoasts_", + "matching_strategy": "Legacy" + } + ], + "tray_and_multi_window": [ + { + "kind": "Class", + "id": "SDL_app", + "matching_strategy": "Legacy" + } + ] + }, + "Stremio": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "stremio.exe", + "matching_strategy": "Equals" + } + ] + }, + "Stremio Desktop Community": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "stremio-shell-ng.exe", + "matching_strategy": "Equals" + } + ] + }, + "System Informer": { + "ignore": [ + { + "kind": "Exe", + "id": "SystemInformer.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "SystemInformer.exe", + "matching_strategy": "Equals" + } + ] + }, + "SystemSettings": { + "ignore": [ + { + "kind": "Class", + "id": "Shell_Dialog", + "matching_strategy": "Legacy" + } + ] + }, + "Tabby": { + "manage": [ + [ + { + "kind": "Class", + "id": "Chrome_WidgetWin_1", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "Tabby.exe", + "matching_strategy": "Equals" + } + ] + ] + }, + "TablePlus": { + "object_name_change": [ + { + "kind": "Exe", + "id": "TablePlus.exe", + "matching_strategy": "Equals" + } + ] + }, + "Task Manager": { + "ignore": [ + { + "kind": "Class", + "id": "TaskManagerWindow", + "matching_strategy": "Legacy" + } + ] + }, + "Telegram": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Telegram.exe", + "matching_strategy": "Equals" + } + ] + }, + "TeraCopy": { + "ignore": [ + { + "kind": "Exe", + "id": "TeraCopy.exe", + "matching_strategy": "Equals" + } + ] + }, + "TickTick": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "TickTick.exe", + "matching_strategy": "Equals" + } + ] + }, + "Tobit.Team": { + "tray_and_multi_window": [ + { + "kind": "Class", + "id": "TobitTeamFrame", + "matching_strategy": "Equals" + } + ] + }, + "Total Commander": { + "ignore": [ + { + "kind": "Class", + "id": "TDLG2FILEACTIONMIN", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "TFindFile", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "TLister", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "TCHANGETREEDLG", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "TCONNECT", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "TSEARCHTEXT", + "matching_strategy": "Equals" + } + ] + }, + "TouchCursor": { + "ignore": [ + { + "kind": "Exe", + "id": "tcconfig.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "tcconfig.exe", + "matching_strategy": "Equals" + } + ] + }, + "TranslucentTB": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "TranslucentTB.exe", + "matching_strategy": "Equals" + } + ] + }, + "ueli": { + "ignore": [ + { + "kind": "Exe", + "id": "ueli.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "ueli.exe", + "matching_strategy": "Equals" + } + ] + }, + "UniGetUI": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "UniGetUI.exe", + "matching_strategy": "Equals" + } + ] + }, + "Unity": { + "ignore": [ + { + "kind": "Class", + "id": "UnityWndClass", + "matching_strategy": "Equals" + } + ] + }, + "Unity Editor": { + "transparency_ignore": [ + { + "kind": "Exe", + "id": "Unity.exe", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Unity.exe", + "matching_strategy": "Equals" + } + ] + }, + "Unity Hub": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "Unity Hub.exe", + "matching_strategy": "Equals" + } + ] + }, + "Unreal Editor": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "UnrealEditor.exe", + "matching_strategy": "Equals" + } + ], + "floating": [ + [ + { + "kind": "Exe", + "id": "UnrealEditor.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "- Unreal Editor", + "matching_strategy": "DoesNotEndWith" + } + ] + ] + }, + "Unreal Engine": { + "ignore": [ + { + "kind": "Class", + "id": "UnrealWindow", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "SplashScreenGuard", + "matching_strategy": "Equals" + } + ] + }, + "visio": { + "ignore": [ + { + "kind": "Class", + "id": "VISIOS", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "VISIOQ", + "matching_strategy": "Equals" + } + ], + "manage": [ + { + "kind": "Class", + "id": "VISIOA", + "matching_strategy": "Equals" + } + ] + }, + "Visual Studio": { + "object_name_change": [ + { + "kind": "Exe", + "id": "devenv.exe", + "matching_strategy": "Equals" + } + ], + "floating": [ + [ + { + "kind": "Exe", + "id": "devenv.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "QuickWatch", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "devenv.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": " - Microsoft Visual Studio", + "matching_strategy": "DoesNotContain" + } + ], + [ + { + "kind": "Exe", + "id": "DevHub.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "ThreadedWaitDialog", + "matching_strategy": "Equals" + } + ] + ], + "ignore": [ + { + "kind": "Exe", + "id": "VsDebugConsole.exe", + "matching_strategy": "Equals" + }, + [ + { + "kind": "Exe", + "id": "iisexpresstray.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "WindowsForms10.Window", + "matching_strategy": "StartsWith" + } + ], + { + "kind": "Title", + "id": "WindowsFormsParkingWindow", + "matching_strategy": "Equals" + }, + [ + { + "kind": "Exe", + "id": "devenv.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Move files to a new location?", + "matching_strategy": "Equals" + } + ], + { + "kind": "Exe", + "id": "ServiceHub.ThreadedWaitDialog.exe", + "matching_strategy": "Equals" + } + ] + }, + "VLC": { + "object_name_change": [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + } + ], + "ignore": [ + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Open URL", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "About", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Preferences", + "matching_strategy": "Contains" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Adjustments and Effects", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Open Media", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Current Media Information", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Messages", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "VLC media player updates", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Help", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Plugins and extensions", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "vlc.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Building font cache", + "matching_strategy": "Equals" + } + ] + ] + }, + "VMware Horizon Client": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "vmware-view.exe", + "matching_strategy": "Equals" + } + ] + }, + "Voice.ai": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "VoiceAI.exe", + "matching_strategy": "Equals" + } + ] + }, + "VRCX": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "VRCX.exe", + "matching_strategy": "Equals" + } + ] + }, + "WebStorm": { + "ignore": [ + { + "kind": "Class", + "id": "SunAwtDialog", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "webstorm64.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "webstorm64.exe", + "matching_strategy": "Equals" + } + ] + }, + "WebTorrent Desktop": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "WebTorrent.exe", + "matching_strategy": "Equals" + } + ] + }, + "WeChat": { + "ignore": [ + { + "kind": "Class", + "id": "WeChatLoginWndForPC", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "FileListMgrWnd", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "CWebviewControlHostWnd", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "ChatWnd", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "EmotionTipWnd", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "ChatContactMenu", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "WeChatAppEx.exe", + "matching_strategy": "Equals" + } + ], + "manage": [ + { + "kind": "Class", + "id": "WeChatMainWndForPC", + "matching_strategy": "Equals" + } + ], + "tray_and_multi_window": [ + { + "kind": "Class", + "id": "WeChatMainWndForPC", + "matching_strategy": "Equals" + } + ] + }, + "WinCompose": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "wincompose.exe", + "matching_strategy": "Equals" + } + ] + }, + "Windows Console (conhost.exe)": { + "manage": [ + { + "kind": "Class", + "id": "ConsoleWindowClass", + "matching_strategy": "Equals" + } + ] + }, + "Windows Explorer": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "explorer.exe", + "matching_strategy": "Equals" + } + ], + "ignore": [ + { + "kind": "Class", + "id": "NativeHWNDHost", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "OperationStatusWindow", + "matching_strategy": "Legacy" + }, + { + "kind": "Title", + "id": "Control Panel", + "matching_strategy": "Legacy" + } + ] + }, + "Windows Installer": { + "ignore": [ + { + "kind": "Exe", + "id": "msiexec.exe", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "MsiDialogCloseClass", + "matching_strategy": "Equals" + } + ] + }, + "Windows Subsystem for Android": { + "ignore": [ + { + "kind": "Class", + "id": "android(splash)", + "matching_strategy": "Legacy" + } + ] + }, + "Windows Terminal": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "WindowsTerminal.exe", + "matching_strategy": "Equals" + } + ] + }, + "Windows Update Standalone Installer": { + "ignore": [ + { + "kind": "Exe", + "id": "wusa.exe", + "matching_strategy": "Equals" + } + ] + }, + "WingetUI": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "wingetui.exe", + "matching_strategy": "Equals" + } + ] + }, + "WinZip (32-bit)": { + "ignore": [ + { + "kind": "Exe", + "id": "winzip32.exe", + "matching_strategy": "Equals" + } + ] + }, + "WinZip (64-bit)": { + "ignore": [ + { + "kind": "Exe", + "id": "winzip64.exe", + "matching_strategy": "Equals" + } + ] + }, + "Wox": { + "ignore": [ + { + "kind": "Title", + "id": "Hotkey sink", + "matching_strategy": "Legacy" + } + ] + }, + "XAMPP Control Panel": { + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "xampp-control.exe", + "matching_strategy": "Equals" + } + ] + }, + "Zebar": { + "ignore": [ + { + "kind": "Exe", + "id": "zebar.exe", + "matching_strategy": "Equals" + } + ] + }, + "Zed": { + "layered": [ + { + "kind": "Exe", + "id": "zed.exe", + "matching_strategy": "Equals" + } + ] + }, + "Zen Browser": { + "ignore": [ + { + "kind": "Class", + "id": "MozillaDialogClass", + "matching_strategy": "Equals" + }, + { + "kind": "Class", + "id": "MozillaTaskbarPreviewClass", + "matching_strategy": "Legacy" + }, + [ + { + "kind": "Title", + "id": "Picture-in-Picture", + "matching_strategy": "Equals" + }, + { + "kind": "Exe", + "id": "zen.exe", + "matching_strategy": "Equals" + } + ] + ], + "tray_and_multi_window": [ + { + "kind": "Exe", + "id": "zen.exe", + "matching_strategy": "Equals" + } + ], + "object_name_change": [ + { + "kind": "Exe", + "id": "zen.exe", + "matching_strategy": "Equals" + } + ], + "slow_application": [ + { + "kind": "Exe", + "id": "zen.exe", + "matching_strategy": "Equals" + } + ] + }, + "Zoom": { + "ignore": [ + { + "kind": "Exe", + "id": "Zoom.exe", + "matching_strategy": "Equals" + } + ] + } +} diff --git a/komorebic/build.rs b/komorebic/build.rs index 7e67434c..44fad00f 100644 --- a/komorebic/build.rs +++ b/komorebic/build.rs @@ -1,12 +1,5 @@ use shadow_rs::ShadowBuilder; fn main() { - if std::fs::metadata("applications.json").is_err() { - let applications_json = reqwest::blocking::get( - "https://raw.githubusercontent.com/LGUG2Z/komorebi-application-specific-configuration/master/applications.json" - ).unwrap().text().unwrap(); - std::fs::write("applications.json", applications_json).unwrap(); - } - ShadowBuilder::builder().build().unwrap(); } diff --git a/komorebi-for-kde/komorebic/applications.json b/komorebic/src/linux/applications.json similarity index 100% rename from komorebi-for-kde/komorebic/applications.json rename to komorebic/src/linux/applications.json diff --git a/komorebi-for-kde/komorebic/src/hotkeys.rs b/komorebic/src/linux/hotkeys.rs similarity index 99% rename from komorebi-for-kde/komorebic/src/hotkeys.rs rename to komorebic/src/linux/hotkeys.rs index d0ddd6a7..8f855c75 100644 --- a/komorebi-for-kde/komorebic/src/hotkeys.rs +++ b/komorebic/src/linux/hotkeys.rs @@ -13,7 +13,7 @@ //! its key binding file again (`ReloadHotkeys`), and `hotkeys release` unregisters every key //! komorebi registered ([`komorebi::kwin::hotkeys::release`]), with or without a daemon. -use crate::HOME_DIR; +use super::HOME_DIR; use clap::Parser; use clap::Subcommand; use clap::ValueEnum; diff --git a/komorebic/src/linux/mod.rs b/komorebic/src/linux/mod.rs new file mode 100644 index 00000000..510a2faa --- /dev/null +++ b/komorebic/src/linux/mod.rs @@ -0,0 +1,789 @@ +//! `komorebic`, the command line interface of komorebi for KDE Plasma. +//! +//! A subcommand that asks something of the daemon is one message on its socket: an order, such as +//! `stop` or `retile`, is written and `komorebic` exits; a question, such as `state` or `query`, +//! is written and the answer is printed. The messages are [`komorebi_client::SocketMessage`]s, +//! sent with [`komorebi_client::send_message`] and [`komorebi_client::send_query`]. +//! +//! The orders that change what the daemon tiles: +//! +//! - `focus` and `cycle-focus` give the focus to another window of the focused workspace, and +//! `mouse-follows-focus` and `toggle-mouse-follows-focus` set whether the pointer goes with it. +//! - `move` and `cycle-move` move the focused window to another tile. +//! - `change-layout`, `cycle-layout` and `flip-layout` change the layout of the focused +//! workspace, `scrolling-layout-columns` and `layout-ratios` tune it, `toggle-tiling` turns its +//! tiling off and on, and `preselect-direction` and `cancel-preselect` reserve the place of the +//! next window and give it up. +//! - `consume`, `expel` and `toggle-column-stack` put windows in the same column of the Scrolling +//! layout and take them out, `scrolling-layout-full-width`, `center-focus` and `expand` make the +//! focused column as wide as the screen, put it in the middle and fill the room that is left, +//! and `pan` moves the view along the strip without moving the focus. +//! - `stack` puts the focused window in one container with the window on one side of it, so that +//! they share a tile and only one is in sight, `unstack` takes it out again, and `stack-all` and +//! `unstack-all` do it for the whole workspace and for the focused stack. `cycle-stack` brings +//! the next or the previous window of the focused stack to the front, `cycle-stack-index` moves +//! the front window along the stack, and `focus-stack-window` brings the window at an index to +//! the front. `toggle-window-container-behaviour` and +//! `toggle-workspace-window-container-behaviour` make a window that opens join the focused +//! container instead of getting a tile, and `toggle-float-override` and +//! `toggle-workspace-float-override` make it float. +//! - `promote`, `promote-swap`, `promote-focus` and `promote-window` bring a window to the largest +//! tile, or the focus to it. +//! - `toggle-float` takes the focused window out of the layout, or puts it back, +//! `toggle-workspace-layer` switches the focused workspace between its tiled windows and its +//! floating ones, and `toggle-lock` locks the focused container at its index, or unlocks it. +//! - `toggle-monocle` gives the focused container the whole work area, or puts it back, and +//! `monocle-focus-behaviour` and `toggle-monocle-focus-behaviour` set what focusing in a +//! direction does meanwhile. `toggle-maximize` has KWin maximize the focused window, which +//! leaves the layout, and restores it. +//! - `focused-workspace-padding`, `focused-workspace-container-padding`, `workspace-padding`, +//! `container-padding` and the two `adjust-*-padding` set the padding around the tiles and +//! between them, and `global-work-area-offset`, `monitor-work-area-offset`, +//! `workspace-work-area-offset` and `toggle-window-based-work-area-offset` keep parts of the work +//! area free of tiles. +//! - `minimize` and `close` minimize and close the focused window, `unmanage` takes it out of +//! the layout until `manage` takes it back, `unmanaged-window-operation-behaviour` sets whether +//! the daemon carries out an order while the focused window is not one it tiles, and +//! `toggle-pause` pauses the daemon and resumes it. +//! - `resize-edge` and `resize-axis` resize the focused window by the `resize-delta`, and +//! `quick-save-resize`, `quick-load-resize`, `save-resize` and `load-resize` save the sizes of +//! the tiles of the focused workspace and load them back. +//! - `focus-workspace` shows another workspace of the focused monitor, `move-to-workspace` moves +//! the focused window to a workspace and shows it, and `send-to-workspace` moves it there and +//! stays. A workspace is KWin's virtual desktop of the same number, counted from 0. +//! `cycle-workspace`, `cycle-empty-workspace`, `cycle-move-to-workspace` and +//! `cycle-send-to-workspace` go to the next or the previous workspace, `focus-last-workspace`, +//! `move-to-last-workspace` and `send-to-last-workspace` to the one that was in front before, +//! `focus-workspaces` shows a workspace on every monitor, and `new-workspace` and +//! `close-workspace` add a workspace and remove an empty one. +//! - `focus-monitor`, `cycle-monitor` and `focus-monitor-at-cursor` focus another monitor, and +//! `focus-monitor-workspace` a workspace of another monitor; `move-to-monitor`, +//! `send-to-monitor`, their `cycle-` forms, `move-to-monitor-workspace`, +//! `send-to-monitor-workspace`, `move-to-named-workspace` and `send-to-named-workspace` take the +//! focused window to another monitor; `move-workspace-to-monitor`, +//! `cycle-move-workspace-to-monitor` and `swap-workspaces-with-monitor` take workspaces there; +//! `cross-monitor-move-behaviour` and `toggle-cross-monitor-move-behaviour` set what `move` does +//! at the edge of a monitor, and `display-index-preference` gives a monitor an index. +//! `eager-focus` focuses the first window of an executable, on any workspace of any monitor. +//! - `workspace-name` names a workspace, which `focus-named-workspace`, `named-workspace-layout`, +//! `named-workspace-tiling`, `named-workspace-padding` and `named-workspace-container-padding` +//! find by its name; `workspace-layout` and `workspace-tiling` set the layout and the tiling of +//! a workspace by its index, and `ensure-workspaces` and `ensure-named-workspaces` give a +//! monitor workspaces up to a number, or with names. +//! - `border` sets whether the compositor draws a border around each window, `border-colour` the +//! color of the border of a kind of window, and `border-width` and `border-offset` the room the +//! layout leaves for it. +//! - `focus-follows-mouse` and `toggle-focus-follows-mouse` set whether KWin gives the focus to the +//! window under the pointer, as the pointer moves. +//! - `transparency` and `toggle-transparency` set whether the windows that do not have the focus +//! are see-through, and `transparency-alpha` how opaque they are. +//! - `animation`, `animation-duration` and `animation-style` set whether windows are animated going +//! to their places, for how long and with what easing, and `animation-fps` the frame rate that +//! is stored and ignored. +//! +//! `ignore-rule` and `manage-rule` add a rule that keeps an application out of the layout or +//! always in it, `session-float-rule` floats the focused window and every window like it until the +//! daemon stops, `session-float-rules` shows those rules and `clear-session-float-rules` removes +//! them, and `global-state` shows the rules the daemon has. `visible-windows` shows the windows +//! that can be seen on the workspace each monitor shows. +//! +//! `initial-workspace-rule`, `initial-named-workspace-rule`, `workspace-rule` and +//! `named-workspace-rule` send the windows of an application to a workspace, when they open or +//! always, `clear-workspace-rules`, `clear-named-workspace-rules` and `clear-all-workspace-rules` +//! take those rules away, and `enforce-workspace-rules` applies them to the windows that are open. +//! +//! `workspace-layout-rule` and `named-workspace-layout-rule` make a workspace change layout once +//! it has so many windows, and `clear-workspace-layout-rules` and +//! `clear-named-workspace-layout-rules` take those rules away. `generate-static-config` prints the +//! settings of the daemon as a `komorebi.json`, and `replace-configuration` makes the daemon +//! start over with another one. +//! +//! `subscribe-socket` and `unsubscribe-socket` add and remove a subscriber: a program that listens +//! on a socket in the daemon's data directory, to which the daemon sends a notification after each +//! event and each message it handles. +//! +//! The others work without the daemon: `quickstart` writes an example `komorebi.json`, +//! `applications.json` and `skhdrc` in the config home, `enable-autostart` and `disable-autostart` write and +//! remove the entry that has Plasma start komorebi at login, `start` runs `komorebi` in the +//! background, with the `komorebi.json` it is given with `--config`, `check` reads the +//! `komorebi.json` the daemon would and the key binding file, looks at the desktop, and reports +//! what is wrong, exiting with status 1 if something is an error, `configuration` shows the path +//! of the `komorebi.json` the daemon reads, `log` follows its log, `data-directory` shows where its +//! socket is, `completions` prints a completion script for a shell, and `static-config-schema`, +//! `application-specific-configuration-schema`, `notification-schema` and `socket-schema` print +//! the JSON Schema of `komorebi.json`, of an `applications.json`, of a notification and of a +//! message. The hidden `docgen` writes the help of every subcommand as Markdown, wrapped +//! at 100 columns whatever the width of the terminal, which is how `docs/cli` is made. +//! +//! `export-kde-shortcuts` and `hotkeys compile` read a key binding file (an skhdrc, a whkdrc or an +//! sxhkdrc) and write the bindings KDE can run by itself as shortcut files. `hotkeys state`, +//! `hotkeys reload` and `hotkeys release` look after the keys the daemon registers with KDE; the +//! [`hotkeys`] module has the details. + +use chrono::Utc; +use clap::Parser; +use clap::Subcommand; +use color_eyre::eyre; +use fs_tail::TailedFile; +use komorebi_client::FocusFollowsMouseImplementation; +use komorebi_client::PanDirection; +use komorebi_client::PathExt; +use komorebi_client::SocketMessage; +use komorebi_client::WindowKind; +use komorebi_client::replace_env_in_path; +use komorebi_client::send_message; +use komorebi_client::send_query; +use komorebic_core::args::BooleanState; +use komorebic_core::args::OneEnum; +use komorebic_core::cli::Cmd; +use komorebic_core::cli::Meta; +use komorebic_core::cli::command; +use komorebic_core::docgen::DocFormat; +use komorebic_core::launcher; +use komorebic_core::launcher::Launcher; +use komorebic_core::messages::Messages; +use lazy_static::lazy_static; +use std::fs::File; +use std::io::BufRead; +use std::io::Write; +use std::num::NonZeroUsize; +use std::path::PathBuf; +use std::process::Command; +use std::process::Stdio; +use std::sync::atomic::AtomicBool; +use std::sync::atomic::Ordering; +use sysinfo::ProcessesToUpdate; + +mod hotkeys; + +lazy_static! { + static ref HAS_CUSTOM_CONFIG_HOME: AtomicBool = AtomicBool::new(false); + static ref HOME_DIR: PathBuf = { + std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( + |_| dirs::home_dir().expect("there is no home directory").join(".config").join("komorebi"), + |home_path| { + let home = home_path.replace_env(); + if home.as_path().is_dir() { + HAS_CUSTOM_CONFIG_HOME.store(true, Ordering::SeqCst); + home + } else { + panic!( + "$KOMOREBI_CONFIG_HOME is set to \"{home_path}\", which is not a valid directory", + ); + } + }, + ) + }; +} + +#[derive(Parser)] +struct MonocleFocusBehaviour { + /// Desired monocle focus behavior + #[clap(value_enum)] + behaviour: komorebi_client::MonocleFocusBehaviour, +} + +#[derive(Parser)] +#[allow(clippy::struct_excessive_bools)] +struct Start { + /// Path to a static configuration JSON file + #[clap(short, long)] + #[clap(value_parser = replace_env_in_path)] + config: Option, + /// Arguments to pass to komorebi, after a `--`: `komorebic start -- --log-level debug` + #[clap(last = true)] + komorebi_args: Vec, +} + +#[derive(Parser)] +struct Stop { + /// Do not restore windows after stopping komorebi + #[clap(long, hide = true)] + ignore_restore: bool, +} + +#[derive(Parser)] +struct EnableAutostart { + /// Path to a static configuration JSON file + #[clap(action, short, long)] + #[clap(value_parser = replace_env_in_path)] + config: Option, +} + +#[derive(Parser)] +struct EagerFocus { + /// Case-sensitive exe identifier + exe: String, +} + +#[derive(Parser)] +struct ScrollingLayoutColumns { + /// Desired number of visible columns + count: NonZeroUsize, +} + +#[derive(Parser)] +struct Pan { + /// The way that the view goes + #[clap(value_enum)] + direction: PanDirection, +} + +#[derive(Parser)] +struct LayoutRatios { + /// Column width ratios (space-separated values between 0.1 and 0.9) + #[clap(short, long, num_args = 1..)] + columns: Option>, + /// Row height ratios (space-separated values between 0.1 and 0.9) + #[clap(short, long, num_args = 1..)] + rows: Option>, +} + +#[derive(Parser)] +struct BorderColour { + #[clap(value_enum, short, long, default_value = "single")] + window_kind: WindowKind, + /// Red + r: u32, + /// Green + g: u32, + /// Blue + b: u32, +} + +#[derive(Parser)] +struct TransparencyAlpha { + /// Alpha + alpha: u8, +} + +#[derive(Parser)] +struct FocusFollowsMouse { + /// On KDE both are KWin's own focus policy + #[clap(value_enum, short, long, default_value = "windows")] + implementation: FocusFollowsMouseImplementation, + #[clap(value_enum)] + boolean_state: BooleanState, +} + +#[derive(Parser)] +struct ToggleFocusFollowsMouse { + /// On KDE both are KWin's own focus policy + #[clap(value_enum, short, long, default_value = "windows")] + implementation: FocusFollowsMouseImplementation, +} + +#[derive(Parser)] +struct Animation { + #[clap(value_enum)] + boolean_state: BooleanState, + /// Animation type to apply the state to. If not specified, sets global state + #[clap(value_enum, short, long)] + animation_type: Option, +} + +#[derive(Parser)] +struct AnimationDuration { + /// Desired animation durations in ms + duration: u64, + /// Animation type to apply the duration to. If not specified, sets global duration + #[clap(value_enum, short, long)] + animation_type: Option, +} + +#[derive(Parser)] +struct AnimationStyle { + /// Desired ease function for animation + #[clap(value_enum, short, long, default_value = "linear")] + style: komorebi_client::AnimationStyle, + /// Animation type to apply the style to. If not specified, sets global style + #[clap(value_enum, short, long)] + animation_type: Option, +} + +#[derive(Parser)] +struct Docgen { + /// Output directory for generated documentation files + #[clap(short, long)] + output: Option, +} + +#[derive(Parser)] +struct Check { + /// Path to a static configuration JSON file + #[clap(action, short, long)] + #[clap(value_parser = replace_env_in_path)] + komorebi_config: Option, + /// Look at the configuration and the key bindings only, not at the desktop + #[clap(long)] + configuration_only: bool, +} + +#[derive(Parser)] +struct Completions { + #[clap(value_enum)] + shell: clap_complete::Shell, +} + +#[derive(Subcommand)] +enum KdeCommands { + #[clap(hide = true)] + Docgen(Docgen), + /// Generate komorebic CLI completions for the target shell + #[clap(arg_required_else_help = true)] + Completions(Completions), + /// Gather example configurations for a new-user quickstart + Quickstart, + /// Turn an skhdrc into KDE global shortcuts (they work over RDP, unlike evdev hotkey daemons) + ExportKdeShortcuts(hotkeys::ExportKdeShortcuts), + /// Key bindings: KDE global shortcuts from a key binding file, and the keys of the daemon + #[clap(arg_required_else_help = true)] + Hotkeys(hotkeys::Hotkeys), + /// Start komorebi as a background process + Start(Start), + /// Stop the komorebi process + Stop(Stop), + /// Check komorebi configuration and the desktop it runs on for common errors + Check(Check), + /// Show the path to komorebi.json + #[clap(alias = "config")] + Configuration, + /// Show the path to komorebi's data directory, which has its socket + #[clap(alias = "datadir")] + DataDirectory, + // /// Subscribe to komorebi events using a Named Pipe + // #[clap(arg_required_else_help = true)] + // #[clap(alias = "subscribe")] + // SubscribePipe(SubscribePipe), + // /// Unsubscribe from komorebi events + // #[clap(arg_required_else_help = true)] + // #[clap(alias = "unsubscribe")] + // UnsubscribePipe(UnsubscribePipe), + /// Tail komorebi's process logs (cancel with Ctrl-C) + Log, + // /// Forcibly focus the window at the cursor with a left mouse click + // ForceFocus, + // /// Set the invisible border dimensions around each window + // #[clap(arg_required_else_help = true)] + // InvisibleBorders(InvisibleBorders), + /// Move the view of the Scrolling layout a column to the left or the right, which does + /// nothing in any other layout + #[clap(arg_required_else_help = true)] + Pan(Pan), + /// Set the layout column and row ratios for the focused workspace + LayoutRatios(LayoutRatios), + // /// Load a custom layout from file for the focused workspace + // #[clap(hide = true)] + // #[clap(arg_required_else_help = true)] + // LoadCustomLayout(LoadCustomLayout), + // /// Set the monitor index preference for a monitor identified using its size + // #[clap(arg_required_else_help = true)] + // MonitorIndexPreference(MonitorIndexPreference), + // /// Set a custom layout for the specified workspace + // #[clap(hide = true)] + // #[clap(arg_required_else_help = true)] + // WorkspaceCustomLayout(WorkspaceCustomLayout), + // /// Set a custom layout for the specified workspace + // #[clap(hide = true)] + // #[clap(arg_required_else_help = true)] + // NamedWorkspaceCustomLayout(NamedWorkspaceCustomLayout), + // /// Add a dynamic custom layout for the specified workspace + // #[clap(hide = true)] + // #[clap(arg_required_else_help = true)] + // WorkspaceCustomLayoutRule(WorkspaceCustomLayoutRule), + // /// Add a dynamic custom layout for the specified workspace + // #[clap(hide = true)] + // #[clap(arg_required_else_help = true)] + // NamedWorkspaceCustomLayoutRule(NamedWorkspaceCustomLayoutRule), + /// Toggle the compositor's maximization for the focused window + ToggleMaximize, + // /// Set the border style + // #[clap(arg_required_else_help = true)] + // BorderStyle(BorderStyle), + // /// Set the border implementation + // #[clap(arg_required_else_help = true)] + // BorderImplementation(BorderImplementation), + /// Enable or disable transparency for unfocused windows + #[clap(arg_required_else_help = true)] + Transparency(OneEnum), + /// Set the alpha value for unfocused window transparency + #[clap(arg_required_else_help = true)] + TransparencyAlpha(TransparencyAlpha), + /// Toggle transparency for unfocused windows + ToggleTransparency, + /// Enable or disable focus follows mouse (KWin's own focus policy) + #[clap(arg_required_else_help = true)] + FocusFollowsMouse(FocusFollowsMouse), + /// Toggle focus follows mouse (KWin's own focus policy) + ToggleFocusFollowsMouse(ToggleFocusFollowsMouse), + /// Generate a JSON Schema for applications.json + #[clap(alias = "asc-schema")] + ApplicationSpecificConfigurationSchema, + /// Generate a JSON Schema of subscription notifications + NotificationSchema, + /// Generate a JSON Schema of socket messages + SocketSchema, + /// Generate a JSON Schema of the static configuration file + StaticConfigSchema, + /// Generates a static configuration JSON file based on the current window manager state + GenerateStaticConfig, + /// Writes an XDG autostart entry so komorebi starts with the Plasma session + EnableAutostart(EnableAutostart), + /// Removes the XDG autostart entry + DisableAutostart, +} + +/// `~/.config/autostart/komorebi.desktop`, which Plasma runs at login +fn autostart_entry() -> PathBuf { + dirs::config_dir() + .expect("there is no config directory") + .join("autostart") + .join("komorebi.desktop") +} + +fn print_query(message: &SocketMessage) { + match send_query(message) { + Ok(response) => println!("{response}"), + Err(error) => panic!("{}", error), + } +} + +/// Starting `komorebi` for `komorebic start`: a `Command` for the daemon, found among the +/// processes by its exact name. +struct KdeLauncher<'a> { + args: &'a Start, + system: sysinfo::System, +} + +impl Launcher for KdeLauncher<'_> { + fn daemon_name(&self) -> &str { + "komorebi" + } + + fn spawn(&mut self) -> eyre::Result<()> { + let mut command = Command::new("komorebi"); + + if let Some(config) = &self.args.config { + command.args(["--config", &config.display().to_string()]); + } + + command + .args(&self.args.komorebi_args) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .stdin(Stdio::null()) + .spawn()?; + + Ok(()) + } + + fn is_running(&mut self) -> eyre::Result { + self.system.refresh_processes(ProcessesToUpdate::All, true); + + Ok(self + .system + .processes_by_exact_name("komorebi".as_ref()) + .next() + .is_some()) + } + + fn diagnose(&mut self) -> eyre::Result<()> { + let mut command = Command::new("komorebi"); + + if let Some(config) = &self.args.config { + command.args(["--config", &config.display().to_string()]); + } + + if let Ok(output) = command.args(&self.args.komorebi_args).output() { + println!("{}", String::from_utf8(output.stderr)?); + } + + Ok(()) + } +} + +/// What the top of the help and `--version` say. +const META: Meta = Meta { + name: "komorebic", + about: "The command-line interface for Komorebi, a tiling window manager for KDE Plasma", + author: env!("CARGO_PKG_AUTHORS"), + version: version::LONG_VERSION, +}; + +/// Write a message to the daemon's socket, or, if the daemon answers it, print the answer. +fn send_or_query(messages: Messages) -> eyre::Result<()> { + let query = messages.is_query(); + let message = SocketMessage::from(messages); + if query { + print_query(&message); + } else { + send_message(&message)?; + } + Ok(()) +} + +pub fn main() -> eyre::Result<()> { + let opts = komorebic_core::cli::parse::(&META); + + match opts.cmd { + Cmd::Messages(messages) => send_or_query(messages)?, + Cmd::Platform(platform) => match platform { + KdeCommands::Docgen(args) => { + let output_dir = args.output.unwrap_or_else(|| PathBuf::from("docs/cli")); + let pages = komorebic_core::docgen::write( + command::(&META), + &DocFormat::KDE, + &output_dir, + )?; + for page in pages { + println!("{}", page.display()); + } + } + KdeCommands::Completions(args) => { + let mut cli = command::(&META); + clap_complete::generate(args.shell, &mut cli, "komorebic", &mut std::io::stdout()); + } + KdeCommands::ExportKdeShortcuts(args) => hotkeys::export_kde_shortcuts(args)?, + KdeCommands::Hotkeys(args) => hotkeys::hotkeys(args)?, + KdeCommands::Quickstart => { + fn write_file_with_prompt( + path: &PathBuf, + content: &str, + created_files: &mut Vec, + ) -> eyre::Result<()> { + if path.exists() { + print!( + "{} will be overwritten, do you want to continue? (y/N): ", + path.display() + ); + std::io::stdout().flush()?; + let mut input = String::new(); + std::io::stdin().read_line(&mut input)?; + let trimmed = input.trim().to_lowercase(); + if trimmed == "y" || trimmed == "yes" { + std::fs::write(path, content)?; + created_files.push(path.display().to_string()); + } else { + println!("Skipping {}", path.display()); + } + } else { + std::fs::write(path, content)?; + created_files.push(path.display().to_string()); + } + Ok(()) + } + + std::fs::create_dir_all(&*HOME_DIR)?; + std::fs::create_dir_all(&*komorebi_client::DATA_DIR)?; + + let komorebi_json = include_str!("../../../komorebi-for-kde/docs/komorebi.example.json").to_string(); + let komorebi_path = HOME_DIR.join("komorebi.json"); + let applications_path = HOME_DIR.join("applications.json"); + let skhdrc_path = HOME_DIR.join("skhdrc"); + + let mut written_files = Vec::new(); + + write_file_with_prompt(&komorebi_path, &komorebi_json, &mut written_files)?; + + let applications_json = include_str!("applications.json"); + write_file_with_prompt(&applications_path, applications_json, &mut written_files)?; + + let skhdrc = include_str!("../../../komorebi-for-kde/docs/skhdrc.sample"); + write_file_with_prompt(&skhdrc_path, skhdrc, &mut written_files)?; + if written_files.is_empty() { + println!("\nNo files were written.") + } else { + println!( + "\nThe following example files were written:\n{}", + written_files.join("\n") + ); + } + + println!("\nYou can now run: komorebic start"); + } + KdeCommands::EnableAutostart(args) => { + let exec = match args.config { + None => String::from("komorebi"), + Some(config) => format!("komorebi --config \"{}\"", config.display()), + }; + + let target = autostart_entry(); + if let Some(dir) = target.parent() { + std::fs::create_dir_all(dir)?; + } + + std::fs::write( + &target, + format!( + "[Desktop Entry]\nType=Application\nName=komorebi\nComment=A tiling window manager for KDE Plasma\nExec={exec}\nX-KDE-autostart-after=plasma-workspace\nTerminal=false\n" + ), + )?; + + println!("Wrote {}", target.display()); + } + KdeCommands::DisableAutostart => { + let target = autostart_entry(); + if target.exists() { + std::fs::remove_file(&target)?; + println!("Deleted {}", target.display()); + } else { + println!("There is no autostart entry at {}", target.display()); + } + } + KdeCommands::Check(args) => { + use komorebi_client::check::Finding; + use komorebi_client::check::Report; + + let mut report = Report::default(); + + // where komorebi looks + let mut place = vec![]; + if std::env::var_os("KOMOREBI_CONFIG_HOME").is_some() { + place.push(Finding::note(format!( + "KOMOREBI_CONFIG_HOME is set: looking in {}", + HOME_DIR.display() + ))); + } else { + place.push(Finding::note(format!( + "KOMOREBI_CONFIG_HOME is not set: looking in {}", + HOME_DIR.display() + ))); + } + + let static_config = match args.komorebi_config { + Some(path) => { + place.push(Finding::note(format!( + "using the configuration file given with --komorebi-config: {}", + path.display() + ))); + path + } + None => HOME_DIR.join("komorebi.json"), + }; + + let (findings, wants) = komorebi_client::check::check_configuration(&static_config); + place.extend(findings); + report.push("Configuration", place); + + report.push("Key bindings", hotkeys::check(&HOME_DIR)); + + if !args.configuration_only { + report.push( + "The desktop", + komorebi_client::check::check_environment(&wants), + ); + } + + print!("{}", report.render()); + + if report.has_errors() { + std::process::exit(1); + } + } + KdeCommands::Start(args) => { + launcher::start(&mut KdeLauncher { + args: &args, + system: sysinfo::System::new_all()?, + })?; + } + KdeCommands::Stop(args) => { + send_message(&launcher::stop_message(args.ignore_restore))?; + } + KdeCommands::Configuration => { + let static_config = HOME_DIR.join("komorebi.json"); + + if static_config.exists() { + println!("{}", static_config.display()); + } + } + KdeCommands::DataDirectory => { + let dir = &*komorebi_client::DATA_DIR; + if dir.exists() { + println!("{}", dir.display()); + } + } + KdeCommands::Log => { + let timestamp = Utc::now().format("%Y-%m-%d").to_string(); + let color_log = komorebi_client::LOG_DIR.join(format!("komorebi.log.{timestamp}")); + let file = TailedFile::new(File::open(color_log)?); + let locked = file.lock(); + #[allow(clippy::significant_drop_in_scrutinee, clippy::lines_filter_map_ok)] + for line in locked.lines().flatten() { + println!("{line}"); + } + } + KdeCommands::ToggleMaximize => { + send_message(&SocketMessage::ToggleMaximize)?; + } + KdeCommands::Pan(args) => { + send_message(&SocketMessage::Pan(args.direction))?; + } + KdeCommands::LayoutRatios(args) => { + if args.columns.is_none() && args.rows.is_none() { + println!( + "No ratios provided, nothing to change. Use --columns or --rows to specify ratios." + ); + } else { + send_message(&SocketMessage::LayoutRatios(args.columns, args.rows))?; + } + } + KdeCommands::ApplicationSpecificConfigurationSchema => { + #[cfg(feature = "schemars")] + { + let schema = komorebi_config::schema::view::< + komorebi_client::ApplicationSpecificConfiguration, + >(komorebi_config::schema::Platform::CURRENT); + print!("{schema}"); + } + } + KdeCommands::NotificationSchema => { + #[cfg(feature = "schemars")] + { + let notification = schemars::schema_for!(komorebi_client::Notification); + let schema = serde_json::to_string_pretty(¬ification)?; + println!("{schema}"); + } + } + KdeCommands::SocketSchema => { + #[cfg(feature = "schemars")] + { + let socket_message = schemars::schema_for!(SocketMessage); + let schema = serde_json::to_string_pretty(&socket_message)?; + println!("{schema}"); + } + } + KdeCommands::StaticConfigSchema => { + #[cfg(feature = "schemars")] + { + let schema = komorebi_config::schema::view::< + komorebi_config::static_config::StaticConfig, + >(komorebi_config::schema::Platform::CURRENT); + print!("{schema}"); + } + } + KdeCommands::GenerateStaticConfig => { + print_query(&SocketMessage::GenerateStaticConfig); + } + KdeCommands::Transparency(args) => { + send_message(&SocketMessage::Transparency(args.value.into()))?; + } + KdeCommands::TransparencyAlpha(args) => { + send_message(&SocketMessage::TransparencyAlpha(args.alpha))?; + } + KdeCommands::ToggleTransparency => { + send_message(&SocketMessage::ToggleTransparency)?; + } + KdeCommands::FocusFollowsMouse(args) => { + send_message(&SocketMessage::FocusFollowsMouse( + args.implementation, + args.boolean_state.into(), + ))?; + } + KdeCommands::ToggleFocusFollowsMouse(args) => { + send_message(&SocketMessage::ToggleFocusFollowsMouse(args.implementation))?; + } + }, + } + + Ok(()) +} diff --git a/komorebic/src/macos/applications.json b/komorebic/src/macos/applications.json new file mode 100644 index 00000000..e00e8b12 --- /dev/null +++ b/komorebic/src/macos/applications.json @@ -0,0 +1,286 @@ +{ + "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi-for-mac/master/schema.asc.json", + "Archive Utility": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Archive Utility", + "matching_strategy": "Equals" + } + ] + ] + }, + "Cloudflare Warp": { + "ignore": [ + { + "kind": "Exe", + "id": "Updater", + "matching_strategy": "Equals" + }, + [ + { + "kind": "Exe", + "id": "Cloudflare WARP", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Updating Cloudflare WARP", + "matching_strategy": "Equals" + } + ] + ] + }, + "Control Center": { + "ignore": [ + { + "kind": "Exe", + "id": "Control Center", + "matching_strategy": "Equals" + } + ] + }, + "Discord": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Discord", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "DiscordUpdater", + "matching_strategy": "Equals" + } + ] + ] + }, + "Finder": { + "tabbed": [ + { + "kind": "Exe", + "id": "Finder", + "matching_strategy": "Equals" + } + ], + "ignore": [ + [ + { + "kind": "Exe", + "id": "Finder", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Info", + "matching_strategy": "EndsWith" + } + ], + [ + { + "kind": "Exe", + "id": "Finder", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Copy", + "matching_strategy": "Equals" + } + ] + ] + }, + "Ghostty": { + "tabbed": [ + { + "kind": "Exe", + "id": "Ghostty", + "matching_strategy": "Equals" + } + ], + "titleless": [ + { + "kind": "Exe", + "id": "Ghostty", + "matching_strategy": "Equals" + } + ] + }, + "Installer": { + "ignore": [ + { + "kind": "Exe", + "id": "Installer", + "matching_strategy": "Equals" + } + ] + }, + "MobileDeviceUpdater": { + "ignore": [ + { + "kind": "Exe", + "id": "MobileDeviceUpdater", + "matching_strategy": "Equals" + } + ] + }, + "Notification Center": { + "ignore": [ + { + "kind": "Exe", + "id": "Notification Center", + "matching_strategy": "Equals" + } + ] + }, + "Photos": { + "titleless": [ + { + "kind": "Exe", + "id": "Photos", + "matching_strategy": "Equals" + } + ] + }, + "RustRover": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "java", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Update", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "RustRover", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "–", + "matching_strategy": "DoesNotContain" + } + ] + ] + }, + "SecurityAgent": { + "ignore": [ + { + "kind": "Exe", + "id": "SecurityAgent", + "matching_strategy": "Equals" + } + ] + }, + "System Information": { + "ignore": [ + { + "kind": "Exe", + "id": "System Information", + "matching_strategy": "Equals" + } + ] + }, + "System Settings": { + "ignore": [ + { + "kind": "Exe", + "id": "System Settings", + "matching_strategy": "Equals" + } + ] + }, + "Tailscale": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Tailscale", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Software Update", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "Tailscale", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Updating Tailscale", + "matching_strategy": "Equals" + } + ] + ] + }, + "Zed": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Zed", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Open", + "matching_strategy": "Equals" + } + ] + ] + }, + "Zen": { + "ignore": [ + [ + { + "kind": "Exe", + "id": "Zen", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "File Upload", + "matching_strategy": "Equals" + } + ], + [ + { + "kind": "Exe", + "id": "Zen", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Enter name of file to save to", + "matching_strategy": "StartsWith" + } + ], + [ + { + "kind": "Exe", + "id": "Zen", + "matching_strategy": "Equals" + }, + { + "kind": "Title", + "id": "Picture-in-Picture", + "matching_strategy": "Equals" + } + ] + ] + } +} diff --git a/komorebic/src/macos/mod.rs b/komorebic/src/macos/mod.rs new file mode 100644 index 00000000..d85b6767 --- /dev/null +++ b/komorebic/src/macos/mod.rs @@ -0,0 +1,807 @@ +#![warn(clippy::all)] + +use chrono::Utc; +use color_eyre::eyre; +use fs_tail::TailedFile; +use komorebi_client::PathExt; +use komorebi_client::SocketMessage; +use komorebi_client::send_message; +use komorebi_client::send_query; +use komorebi_client::splash; +use komorebi_client::splash::ValidationFeedback; +use komorebic_core::cli::Cmd; +use komorebic_core::cli::Meta; +use komorebic_core::cli::command; +use komorebic_core::docgen::DocFormat; +use komorebic_core::launcher; +use komorebic_core::launcher::Launcher; +use komorebic_core::messages::Messages; +use komorebic_core::pan; +use komorebic_core::platform::macos::*; +use lazy_static::lazy_static; +use std::fs::File; +use std::fs::OpenOptions; +use std::io; +use std::io::BufRead; +use std::io::BufReader; +use std::io::Write; +use std::path::PathBuf; +use std::process::Command; +use std::process::Stdio; +use std::sync::atomic::AtomicBool; +use std::sync::atomic::Ordering; +use sysinfo::ProcessesToUpdate; + +lazy_static! { + static ref HAS_CUSTOM_CONFIG_HOME: AtomicBool = AtomicBool::new(false); + static ref HOME_DIR: PathBuf = { + std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( + |_| dirs::home_dir().expect("there is no home directory").join(".config").join("komorebi"), + |home_path| { + let home = home_path.replace_env(); + if home.as_path().is_dir() { + HAS_CUSTOM_CONFIG_HOME.store(true, Ordering::SeqCst); + home + } else { + panic!( + "$KOMOREBI_CONFIG_HOME is set to \"{home_path}\", which is not a valid directory", + ); + } + }, + ) + }; + static ref DATA_DIR: PathBuf = dirs::data_local_dir() + .expect("there is no local data directory") + .join("komorebi"); +} + +fn print_query(message: &SocketMessage) { + match send_query(message) { + Ok(response) => println!("{response}"), + Err(error) => panic!("{}", error), + } +} + +/// Starting `komorebi` for `komorebic start`: a `Command` for the daemon, found among the +/// processes by its exact name. +struct MacosLauncher<'a> { + args: &'a Start, + system: sysinfo::System, +} + +impl Launcher for MacosLauncher<'_> { + fn daemon_name(&self) -> &str { + "komorebi" + } + + fn spawn(&mut self) -> eyre::Result<()> { + let mut command = Command::new("komorebi"); + + if let Some(config) = &self.args.config { + command.args(["--config", &format!("'--config=\"{}\"'", config.display())]); + } + + command + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .stdin(Stdio::null()) + .spawn()?; + + Ok(()) + } + + fn is_running(&mut self) -> eyre::Result { + self.system.refresh_processes(ProcessesToUpdate::All, true); + + Ok(self + .system + .processes_by_exact_name("komorebi".as_ref()) + .next() + .is_some()) + } + + fn diagnose(&mut self) -> eyre::Result<()> { + let mut command = Command::new("komorebi"); + + if let Some(config) = &self.args.config { + command.arg(format!("'--config=\"{}\"'", config.display())); + } + + if let Ok(output) = command.output() { + println!("{}", String::from_utf8(output.stderr)?); + } + + Ok(()) + } +} + +/// What the top of the help and `--version` say. +const META: Meta = Meta { + name: "komorebic", + about: "The command-line interface for Komorebi, a tiling window manager for macOS", + author: env!("CARGO_PKG_AUTHORS"), + version: version::LONG_VERSION, +}; + +/// Write a message to the daemon's socket, or, if the daemon answers it, print the answer. +fn send_or_query(messages: Messages) -> eyre::Result<()> { + let query = messages.is_query(); + let message = SocketMessage::from(messages); + if query { + print_query(&message); + } else { + send_message(&message)?; + } + Ok(()) +} + +/// The connection to the daemon that the gesture stream tells what the fingers do over. +struct PanLink(komorebi_client::Connection); + +impl pan::Link for PanLink { + fn send(&mut self, message: &SocketMessage) -> io::Result<()> { + self.0.send(message) + } +} + +pub fn main() -> eyre::Result<()> { + let opts = komorebic_core::cli::parse::(&META); + + match opts.cmd { + Cmd::Messages(messages) => send_or_query(messages)?, + Cmd::Platform(platform) => match platform { + MacosCommands::Docgen(args) => { + let output_dir = args.output.unwrap_or_else(|| PathBuf::from("docs/cli")); + let pages = komorebic_core::docgen::write( + command::(&META), + &DocFormat::PLAIN, + &output_dir, + )?; + for page in pages { + println!("{}", page.display()); + } + } + MacosCommands::Splash(args) => { + splash::show(args.mdm_server)?; + } + MacosCommands::Completions(args) => { + let mut cli = command::(&META); + clap_complete::generate(args.shell, &mut cli, "komorebic", &mut std::io::stdout()); + } + MacosCommands::License(args) => { + let _ = std::fs::remove_file(DATA_DIR.join("icul.validation")); + std::fs::write(DATA_DIR.join("icul"), &args.email)?; + match splash::should()? { + ValidationFeedback::Successful(icul_validation) => { + println!("Individual commercial use license validation successful"); + println!( + "Local validation file saved to {}", + icul_validation.display() + ); + println!("\n{}", std::fs::read_to_string(&icul_validation)?); + } + ValidationFeedback::Unsuccessful(invalid_payload) => { + println!( + "No active individual commercial use license found for {}", + args.email + ); + println!("\n{invalid_payload}"); + println!( + "\nYou can purchase an individual commercial use license at https://lgug2z.com/software/komorebi" + ); + } + ValidationFeedback::NoEmail => {} + ValidationFeedback::NoConnectivity => { + println!( + "Could not make a connection to validate an individual commercial use license for {}", + args.email + ); + } + } + } + MacosCommands::Permissions => { + let mut current_exe = std::env::current_exe().expect("unable to get exec path"); + current_exe.pop(); + let komorebi_exe = current_exe.join("komorebi"); + + let term_program = std::env::var("TERM_PROGRAM") + .unwrap_or_else(|_| String::from("this terminal emulator")); + + println!( + "\nPlease grant Accessibility permissions to \"{}\" and \"{term_program}\"", + komorebi_exe.display() + ); + println!( + "Accessibility permissions are required for komorebi to to manage windows" + ); + Command::new("open") + .arg( + "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility", + ) + .spawn()?; + + println!("\nHit return when done..."); + std::io::stdout().flush()?; + let mut input = String::new(); + std::io::stdin().read_line(&mut input)?; + + println!( + "Please grant Screen Recording permissions to \"{}\" and \"{term_program}\"", + komorebi_exe.display() + ); + println!( + "Screen Recording permissions are required to for komorebi to read window titles" + ); + Command::new("open") + .arg( + "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture", + ) + .spawn()?; + + println!("\nHit return when done..."); + std::io::stdout().flush()?; + let mut input = String::new(); + std::io::stdin().read_line(&mut input)?; + } + MacosCommands::Quickstart => { + fn write_file_with_prompt( + path: &PathBuf, + content: &str, + created_files: &mut Vec, + ) -> eyre::Result<()> { + if path.exists() { + print!( + "{} will be overwritten, do you want to continue? (y/N): ", + path.display() + ); + std::io::stdout().flush()?; + let mut input = String::new(); + std::io::stdin().read_line(&mut input)?; + let trimmed = input.trim().to_lowercase(); + if trimmed == "y" || trimmed == "yes" { + std::fs::write(path, content)?; + created_files.push(path.display().to_string()); + } else { + println!("Skipping {}", path.display()); + } + } else { + std::fs::write(path, content)?; + created_files.push(path.display().to_string()); + } + Ok(()) + } + + let local_appdata_dir = + dirs::data_local_dir().expect("could not find localdata dir"); + let data_dir = local_appdata_dir.join("komorebi"); + std::fs::create_dir_all(&*HOME_DIR)?; + std::fs::create_dir_all(data_dir)?; + + let mut komorebi_json = + include_str!("../../../komorebi-for-mac/docs/komorebi.example.json").to_string(); + let komorebi_bar_json = + include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json").to_string(); + + if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() { + komorebi_json = + komorebi_json.replace("Env:USERPROFILE", "Env:KOMOREBI_CONFIG_HOME"); + } + + let komorebi_path = HOME_DIR.join("komorebi.json"); + let bar_path = HOME_DIR.join("komorebi.bar.json"); + let applications_path = HOME_DIR.join("applications.json"); + let skhdrc_path = HOME_DIR.join("skhdrc"); + + let mut written_files = Vec::new(); + + write_file_with_prompt(&komorebi_path, &komorebi_json, &mut written_files)?; + write_file_with_prompt(&bar_path, &komorebi_bar_json, &mut written_files)?; + + let applications_json = include_str!("applications.json"); + write_file_with_prompt(&applications_path, applications_json, &mut written_files)?; + + let whkdrc = include_str!("../../../komorebi-for-mac/docs/skhdrc.sample"); + write_file_with_prompt(&skhdrc_path, whkdrc, &mut written_files)?; + if written_files.is_empty() { + println!("\nNo files were written.") + } else { + println!( + "\nThe following example files were written:\n{}", + written_files.join("\n") + ); + } + + let mut current_exe = std::env::current_exe().expect("unable to get exec path"); + current_exe.pop(); + let komorebi_exe = current_exe.join("komorebi"); + + let term_program = std::env::var("TERM_PROGRAM") + .unwrap_or_else(|_| String::from("this terminal emulator")); + + println!( + "\nPlease grant Accessibility permissions to \"{}\" and \"{term_program}\"", + komorebi_exe.display() + ); + println!( + "Accessibility permissions are required for komorebi to to manage windows" + ); + Command::new("open") + .arg( + "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility", + ) + .spawn()?; + + println!("\nHit return when done..."); + std::io::stdout().flush()?; + let mut input = String::new(); + std::io::stdin().read_line(&mut input)?; + + println!( + "Please grant Screen Recording permissions to \"{}\" and \"{term_program}\"", + komorebi_exe.display() + ); + println!( + "Screen Recording permissions are required to for komorebi to read window titles" + ); + Command::new("open") + .arg( + "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture", + ) + .spawn()?; + + println!("\nHit return when done..."); + std::io::stdout().flush()?; + let mut input = String::new(); + std::io::stdin().read_line(&mut input)?; + + if let Ok((mdm, server)) = splash::mdm_enrollment() + && mdm + { + if let Some(server) = server { + println!( + "It looks like you are using a corporate device enrolled in mobile device management ({server})\n" + ); + } else { + println!( + "It looks like you are using a corporate device enrolled in mobile device management\n" + ); + } + println!("The Komorebi License does not permit any kind of commercial use\n"); + println!( + "A dedicated Individual Commercial Use License is available if you wish to use this software at work\n" + ); + println!( + "You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement\n" + ); + println!( + "If you already have a license, you can run \"komorebic license \" with the email address your license is associated with\n" + ); + } + + println!("You can now run: komorebic start"); + println!( + "\nIf you have skhd hotkey daemon installed, you can also run: skhd --config {}", + skhdrc_path.display() + ); + } + MacosCommands::EnableAutostart(args) => { + let mut current_exe = std::env::current_exe().expect("unable to get exec path"); + current_exe.pop(); + let komorebic_exe = current_exe.join("komorebi"); + + let plist = match args.config { + None => { + format!( + r#" + + + + + EnvironmentVariables + + PATH + $HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin + + RunAtLoad + + KeepAlive + + Label + com.lgug2z.komorebi + ProcessType + Interactive + ProgramArguments + + {} + + StandardOutPath + /tmp/komorebi.out.log + StandardErrorPath + /tmp/komorebi.err.log + +"#, + komorebic_exe.to_string_lossy() + ) + } + Some(config) => { + format!( + r#" + + + + + EnvironmentVariables + + PATH + $HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin + + RunAtLoad + + KeepAlive + + Label + com.lgug2z.komorebi + ProcessType + Interactive + ProgramArguments + + {} + --config + {} + + StandardOutPath + /tmp/komorebi.out.log + StandardErrorPath + /tmp/komorebi.err.log + +"#, + komorebic_exe.to_string_lossy(), + config.to_string_lossy() + ) + } + }; + + let target = dirs::home_dir() + .expect("no $HOME dir") + .join("Library") + .join("LaunchAgents") + .join("com.lgug2z.komorebi.plist"); + + std::fs::write(&target, &plist)?; + + println!("Created com.lgug2z.komorebi.plist at {}", target.display()); + Command::new("launchctl") + .args(["load", &*target.to_string_lossy()]) + .output()?; + println!("Ran 'launchctl load {}'", target.display()); + + if args.bar { + let komorebi_bar_exe = current_exe.join("komorebi-bar"); + let komorebic_exe_for_bar = current_exe.join("komorebic"); + + // Create a launcher script that waits for komorebi to be healthy + let launcher_script = format!( + r#"#!/bin/sh + +# Wait for komorebi to be healthy +max_attempts=30 +attempt=0 + +while [ $attempt -lt $max_attempts ]; do + if {} state >/dev/null 2>&1; then + # komorebi is healthy, start the bar + exec {} + fi + attempt=$((attempt + 1)) + sleep 1 +done + +# If we get here, komorebi failed to start +echo "komorebi-bar: Timeout waiting for komorebi to become healthy" >&2 +exit 1 +"#, + komorebic_exe_for_bar.to_string_lossy(), + komorebi_bar_exe.to_string_lossy() + ); + + let launcher_path = DATA_DIR.join("komorebi-bar-launcher.sh"); + std::fs::write(&launcher_path, &launcher_script)?; + + // Make the script executable + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + let mut perms = std::fs::metadata(&launcher_path)?.permissions(); + perms.set_mode(0o755); + std::fs::set_permissions(&launcher_path, perms)?; + } + + let bar_plist = format!( + r#" + + + + EnvironmentVariables + + PATH + $HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin + + RunAtLoad + + KeepAlive + + SuccessfulExit + + + Label + com.lgug2z.komorebi-bar + ProcessType + Interactive + ProgramArguments + + {} + + StandardOutPath + /tmp/komorebi-bar.out.log + StandardErrorPath + /tmp/komorebi-bar.err.log + +"#, + launcher_path.to_string_lossy() + ); + + let bar_target = dirs::home_dir() + .expect("no $HOME dir") + .join("Library") + .join("LaunchAgents") + .join("com.lgug2z.komorebi-bar.plist"); + + std::fs::write(&bar_target, &bar_plist)?; + println!( + "Created com.lgug2z.komorebi-bar.plist at {}", + bar_target.display() + ); + + Command::new("launchctl") + .args(["load", &*bar_target.to_string_lossy()]) + .output()?; + println!("Ran 'launchctl load {}'", bar_target.display()); + } + } + MacosCommands::DisableAutostart => { + let target = dirs::home_dir() + .expect("no $HOME dir") + .join("Library") + .join("LaunchAgents") + .join("com.lgug2z.komorebi.plist"); + + Command::new("launchctl") + .args(["unload", &*target.to_string_lossy()]) + .output()?; + println!("Ran 'launchctl unload {}'", target.display()); + std::fs::remove_file(&target)?; + println!("Deleted {}", target.display()); + + // Also remove bar plist if it exists + let bar_target = dirs::home_dir() + .expect("no $HOME dir") + .join("Library") + .join("LaunchAgents") + .join("com.lgug2z.komorebi-bar.plist"); + + if bar_target.exists() { + Command::new("launchctl") + .args(["unload", &*bar_target.to_string_lossy()]) + .output()?; + println!("Ran 'launchctl unload {}'", bar_target.display()); + std::fs::remove_file(&bar_target)?; + println!("Deleted {}", bar_target.display()); + } + + // Clean up launcher script if it exists + let launcher_path = DATA_DIR.join("komorebi-bar-launcher.sh"); + if launcher_path.exists() { + std::fs::remove_file(&launcher_path)?; + println!("Deleted {}", launcher_path.display()); + } + } + MacosCommands::Start(args) => { + let mut launcher = MacosLauncher { + args: &args, + system: sysinfo::System::new_all(), + }; + + if !launcher::start(&mut launcher)? { + return Ok(()); + } + + if args.bar { + let mut command = &mut Command::new("komorebi-bar"); + + command = command + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .stdin(Stdio::null()); + + command.spawn()?; + } + + println!("\nThank you for using komorebi!\n"); + println!("# Commercial Use License"); + if let Ok((mdm, server)) = splash::mdm_enrollment() + && mdm + { + if let Some(server) = server { + println!( + "* It looks like you are using a corporate device enrolled in mobile device management ({server})" + ); + } else { + println!( + "* It looks like you are using a corporate device enrolled in mobile device management" + ); + } + } + println!( + "* View licensing options https://lgug2z.com/software/komorebi - A commercial use license is required to use komorebi at work" + ); + println!("\n# Personal Use Sponsorship"); + println!( + "* Become a sponsor https://github.com/sponsors/LGUG2Z - $10/month makes a big difference" + ); + println!( + "* Leave a tip https://ko-fi.com/lgug2z - An alternative to GitHub Sponsors" + ); + println!("\n# Community"); + println!( + "* Join the Discord https://discord.gg/mGkn66PHkx - Chat, ask questions, share your desktops" + ); + println!( + "* Subscribe to https://youtube.com/@LGUG2Z - Development videos, feature previews and release overviews" + ); + println!( + "* Explore the Awesome Komorebi list https://github.com/LGUG2Z/awesome-komorebi - Projects in the komorebi ecosystem" + ); + println!("\n# Documentation"); + println!( + "* Read the docs https://lgug2z.github.io/komorebi - Quickly search through all komorebic commands" + ); + } + MacosCommands::Stop(args) => { + send_message(&launcher::stop_message(args.ignore_restore))?; + + if args.bar { + Command::new("pkill").arg("komorebi-bar").spawn()?; + } + + // TODO: see if we need a force quit sometimes like we do on Windows + // let mut system = sysinfo::System::new_all(); + // system.refresh_processes(ProcessesToUpdate::All, true); + // + // let running = system.processes_by_exact_name("komorebi".as_ref()).next(); + // + // if let Some(process) = running { + // process.kill_with(Signal::Interrupt); + // } + } + MacosCommands::Configuration => { + let static_config = HOME_DIR.join("komorebi.json"); + + if static_config.exists() { + println!("{}", static_config.display()); + } + } + MacosCommands::DataDirectory => { + let dir = &*DATA_DIR; + if dir.exists() { + println!("{}", dir.display()); + } + } + MacosCommands::Log => { + let timestamp = Utc::now().format("%Y-%m-%d").to_string(); + let color_log = DATA_DIR.join(format!("komorebi.log.{timestamp}")); + let file = TailedFile::new(File::open(color_log)?); + let locked = file.lock(); + #[allow(clippy::significant_drop_in_scrutinee, clippy::lines_filter_map_ok)] + for line in locked.lines().flatten() { + println!("{line}"); + } + } + MacosCommands::FetchAppSpecificConfiguration => { + let content = reqwest::blocking::get("https://raw.githubusercontent.com/LGUG2Z/komorebi-application-specific-configuration/master/applications.mac.json")? + .text()?; + + let output_file = HOME_DIR.join("applications.json"); + + let mut file = OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .open(&output_file)?; + + file.write_all(content.as_bytes())?; + + println!( + "Latest version of applications.mac.json from https://github.com/LGUG2Z/komorebi-application-specific-configuration downloaded\n" + ); + println!( + "You can add this to your komorebi.json static configuration file like this: \n\n\"app_specific_configuration_path\": \"{}\"", + output_file.display().to_string().replace("\\", "/") + ); + } + MacosCommands::Pan(args) => { + // a flag that has a default counts as given, so what only goes with --stream + // cannot be left to the parser to say + if !args.stream && (args.sensitivity.is_some() || args.reversed || args.paging) { + command::(&META) + .error( + clap::error::ErrorKind::ArgumentConflict, + "--sensitivity, --reversed and --paging can only be used with --stream", + ) + .exit(); + } + + if args.stream { + pan::run( + BufReader::new(io::stdin()), + pan::Options { + sensitivity: args.sensitivity.unwrap_or(1.0), + reversed: args.reversed, + paging: args.paging, + }, + &mut pan::Socket::new(|| komorebi_client::Connection::open().map(PanLink)), + )?; + } else if let Some(direction) = args.direction { + send_message(&SocketMessage::Pan(direction))?; + } + } + MacosCommands::LayoutRatios(args) => { + if args.columns.is_none() && args.rows.is_none() { + println!( + "No ratios provided, nothing to change. Use --columns or --rows to specify ratios." + ); + } else { + send_message(&SocketMessage::LayoutRatios(args.columns, args.rows))?; + } + } + MacosCommands::ApplicationSpecificConfigurationSchema => { + #[cfg(feature = "schemars")] + { + let schema = komorebi_config::schema::view::< + komorebi_client::ApplicationSpecificConfiguration, + >(komorebi_config::schema::Platform::CURRENT); + print!("{schema}"); + } + } + MacosCommands::NotificationSchema => { + #[cfg(feature = "schemars")] + { + let notification = schemars::schema_for!(komorebi_client::Notification); + let schema = serde_json::to_string_pretty(¬ification)?; + println!("{schema}"); + } + } + MacosCommands::SocketSchema => { + #[cfg(feature = "schemars")] + { + let socket_message = schemars::schema_for!(SocketMessage); + let schema = serde_json::to_string_pretty(&socket_message)?; + println!("{schema}"); + } + } + MacosCommands::StaticConfigSchema => { + #[cfg(feature = "schemars")] + { + let schema = komorebi_config::schema::view::< + komorebi_config::static_config::StaticConfig, + >(komorebi_config::schema::Platform::CURRENT); + print!("{schema}"); + } + } + MacosCommands::GenerateStaticConfig => { + print_query(&SocketMessage::GenerateStaticConfig); + } + }, + } + + Ok(()) +} diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index 2277d1ff..97ddef85 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -1,1467 +1,28 @@ -#![warn(clippy::all)] -#![allow(clippy::missing_errors_doc, clippy::doc_markdown)] -#![allow(unused_assignments)] // false positives for the error reporter +//! `komorebic`, the command line interface of komorebi, for Windows, KDE Plasma and macOS. +//! +//! The platform is the target OS: each of the three modules is the CLI of one platform, with the +//! subcommands that platform has, and `main` runs the one that was compiled in. The code they share +//! is `komorebic-core`. The Linux and macOS modules are still in their own trees and are included +//! from there. -use chrono::Utc; -use komorebi_client::PathExt; -use komorebi_client::splash; - -use std::fs::File; -use std::fs::OpenOptions; -use std::io; -use std::io::BufRead; -use std::io::BufReader; -use std::io::Write; -use std::path::PathBuf; -use std::process::Command; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::Ordering; - -use color_eyre::eyre; -use color_eyre::eyre::OptionExt; -use color_eyre::eyre::bail; -use fs_tail::TailedFile; -use komorebi_client::AppSpecificConfigurationPath; -use komorebi_client::ApplicationSpecificConfiguration; -use komorebi_client::send_message; -use komorebi_client::send_query; -use komorebic_core::cli::Cmd; -use komorebic_core::cli::Meta; -use komorebic_core::cli::command; -use komorebic_core::docgen::DocFormat; -use komorebic_core::launcher; -use komorebic_core::launcher::Launcher; -use komorebic_core::messages::Messages; -use komorebic_core::pan; -use komorebic_core::platform::windows::*; -use lazy_static::lazy_static; -use miette::NamedSource; -use miette::Report; -use miette::SourceOffset; -use miette::SourceSpan; -use serde::Deserialize; -use sysinfo::ProcessesToUpdate; -use which::which; -use win_msgbox::OkayCancel; -use windows::Win32::Foundation::HWND; -use windows::Win32::UI::WindowsAndMessaging::SHOW_WINDOW_CMD; -use windows::Win32::UI::WindowsAndMessaging::SW_RESTORE; -use windows::Win32::UI::WindowsAndMessaging::ShowWindow; - -use komorebi_client::ApplicationConfigurationGenerator; -use komorebi_client::ApplicationIdentifier; -use komorebi_client::Rect; -use komorebi_client::SocketMessage; -use komorebi_client::StaticConfig; -use komorebi_client::splash::ValidationFeedback; - -lazy_static! { - static ref HAS_CUSTOM_CONFIG_HOME: AtomicBool = AtomicBool::new(false); - static ref HOME_DIR: PathBuf = { - std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( - |_| dirs::home_dir().expect("there is no home directory"), - |home_path| { - let home = home_path.replace_env(); - if home.as_path().is_dir() { - HAS_CUSTOM_CONFIG_HOME.store(true, Ordering::SeqCst); - home - } else { - panic!( - "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory", - ); - } - }, - ) - }; - static ref DATA_DIR: PathBuf = dirs::data_local_dir() - .expect("there is no local data directory") - .join("komorebi"); - static ref WHKD_CONFIG_DIR: PathBuf = { - std::env::var("WHKD_CONFIG_HOME").map_or_else( - |_| { - dirs::home_dir() - .expect("there is no home directory") - .join(".config") - }, - |home_path| { - let whkd_config_home = home_path.replace_env(); - - assert!( - whkd_config_home.is_dir(), - "$Env:WHKD_CONFIG_HOME is set to '{home_path}', which is not a valid directory" - ); - - whkd_config_home - }, - ) - }; -} - -shadow_rs::shadow!(build); - -#[derive(thiserror::Error, Debug, miette::Diagnostic)] -#[error("{message}")] -#[diagnostic(code(komorebi::configuration), help("try fixing this syntax error"))] -struct ConfigurationError { - message: String, - #[source_code] - src: NamedSource, - #[label("This bit here")] - bad_bit: SourceSpan, -} - -// print_query is a helper that queries komorebi and prints the response. -// panics on error. -fn print_query(message: &SocketMessage) { - match send_query(message) { - Ok(response) => println!("{response}"), - Err(error) => panic!("{}", error), +cfg_select! { + target_os = "windows" => { + mod windows; + use windows as platform; + } + target_os = "linux" => { + extern crate komorebi_linux as komorebi; + extern crate version_linux as version; + mod linux; + use linux as platform; + } + target_os = "macos" => { + extern crate version_macos as version; + mod macos; + use macos as platform; } } -fn startup_dir() -> eyre::Result { - let startup = dirs::home_dir() - .expect("unable to obtain user's home folder") - .join("AppData") - .join("Roaming") - .join("Microsoft") - .join("Windows") - .join("Start Menu") - .join("Programs") - .join("Startup"); - - if !startup.is_dir() { - std::fs::create_dir_all(&startup)?; - } - - Ok(startup) -} - -#[allow(clippy::too_many_lines, clippy::cognitive_complexity)] -/// Starting `komorebi.exe` for `komorebic start`: a PowerShell script that starts the daemon with -/// its flags, found among the processes by its name. -struct WindowsLauncher { - script: String, - config: Option, - system: sysinfo::System, -} - -impl Launcher for WindowsLauncher { - fn daemon_name(&self) -> &str { - "komorebi.exe" - } - - fn spawn(&mut self) -> eyre::Result<()> { - match powershell_script::run(&self.script) { - Ok(_) => { - println!("{}", self.script); - } - Err(error) => { - println!("Error: {error}"); - } - } - - Ok(()) - } - - fn is_running(&mut self) -> eyre::Result { - self.system.refresh_processes(ProcessesToUpdate::All, true); - - Ok(self - .system - .processes_by_name("komorebi.exe".as_ref()) - .next() - .is_some()) - } - - fn diagnose(&mut self) -> eyre::Result<()> { - if let Some(config) = &self.config { - if let Ok(output) = Command::new("komorebi.exe") - .arg(format!("'--config=\"{}\"'", config.display())) - .output() - { - println!("{}", String::from_utf8(output.stderr)?); - } - } else if let Ok(output) = Command::new("komorebi.exe").output() { - println!("{}", String::from_utf8(output.stderr)?); - } - - Ok(()) - } -} - -/// What the top of the help and `--version` say. -const META: Meta = Meta { - name: "komorebic", - about: env!("CARGO_PKG_DESCRIPTION"), - author: env!("CARGO_PKG_AUTHORS"), - version: build::CLAP_LONG_VERSION, -}; - -/// Write a message to the daemon's socket, or, if the daemon answers it, print the answer. -fn send_or_query(messages: Messages) -> eyre::Result<()> { - let query = messages.is_query(); - let message = SocketMessage::from(messages); - if query { - print_query(&message); - } else { - send_message(&message)?; - } - Ok(()) -} - -/// The connection to the daemon that the gesture stream tells what the fingers do over. -struct PanLink(komorebi_client::Connection); - -impl pan::Link for PanLink { - fn send(&mut self, message: &SocketMessage) -> io::Result<()> { - self.0.send(message) - } -} - -fn main() -> eyre::Result<()> { - let opts = komorebic_core::cli::parse::(&META); - - match opts.cmd { - Cmd::Messages(messages) => send_or_query(messages)?, - Cmd::Platform(platform) => match platform { - WindowsCommands::Docgen(args) => { - let output_dir = args.output.unwrap_or_else(|| PathBuf::from("docs/cli")); - let pages = komorebic_core::docgen::write( - command::(&META), - &DocFormat::PLAIN, - &output_dir, - )?; - for page in pages { - println!("{}", page.display()); - } - } - WindowsCommands::Splash(args) => { - let informative_text = match args.mdm_server { - None => { - "It looks like you are using a corporate device enrolled in mobile device management\n\n\ - The Komorebi License does not permit any kind of commercial use\n\n\ - A dedicated Individual Commercial Use License is available if you wish to use this software at work\n\n\ - You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement\n\n\ - To remove this popup in the future, run \"komorebic license \" using the email address associated with your license\n\n\ - If you are a student using komorebi on a laptop provided by your school, you can email me from your educational email account to remove this popup".to_string() - } - Some(server) => { - format!( - "It looks like you are using a corporate device enrolled in mobile device management ({server})\n\n\ - The Komorebi License does not permit any kind of commercial use\n\n\ - A dedicated Individual Commercial Use License is available if you wish to use this software at work\n\n\ - You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement\n\n\ - To remove this popup in the future you can run \"komorebic license \" using the email address associated with your license\n\n - If you are a student using komorebi on a laptop provided by your school, you can email me from your educational email account to remove this popup" - ) - } - }; - - if let Ok(response) = win_msgbox::error::(&informative_text) - .title("MDM Enrollment Detected") - .topmost() - .icon(win_msgbox::Icon::Warning) - .set_foreground() - .show() - { - match response { - OkayCancel::Okay => { - open::that("https://lgug2z.com/software/komorebi")?; - } - OkayCancel::Cancel => {} - } - } - } - WindowsCommands::License(args) => { - let _ = std::fs::remove_file(DATA_DIR.join("icul.validation")); - std::fs::write(DATA_DIR.join("icul"), &args.email)?; - match splash::should()? { - ValidationFeedback::Successful(icul_validation) => { - println!("Individual commercial use license validation successful"); - println!( - "Local validation file saved to {}", - icul_validation.display() - ); - println!("\n{}", std::fs::read_to_string(&icul_validation)?); - } - ValidationFeedback::Unsuccessful(invalid_payload) => { - println!( - "No active individual commercial use license found for {}", - args.email - ); - println!("\n{invalid_payload}"); - println!( - "\nYou can purchase an individual commercial use license at https://lgug2z.com/software/komorebi" - ); - } - ValidationFeedback::NoEmail => {} - ValidationFeedback::NoConnectivity => { - println!( - "Could not make a connection to validate an individual commercial use license for {}", - args.email - ); - } - } - } - WindowsCommands::Quickstart => { - fn write_file_with_prompt( - path: &PathBuf, - content: &str, - created_files: &mut Vec, - ) -> eyre::Result<()> { - if path.exists() { - print!( - "{} will be overwritten, do you want to continue? (y/N): ", - path.display() - ); - io::stdout().flush()?; - let mut input = String::new(); - io::stdin().read_line(&mut input)?; - let trimmed = input.trim().to_lowercase(); - if trimmed == "y" || trimmed == "yes" { - std::fs::write(path, content)?; - created_files.push(path.display().to_string()); - } else { - println!("Skipping {}", path.display()); - } - } else { - std::fs::write(path, content)?; - created_files.push(path.display().to_string()); - } - Ok(()) - } - - let local_appdata_dir = - dirs::data_local_dir().expect("could not find localdata dir"); - let data_dir = local_appdata_dir.join("komorebi"); - std::fs::create_dir_all(&*WHKD_CONFIG_DIR)?; - std::fs::create_dir_all(&*HOME_DIR)?; - std::fs::create_dir_all(data_dir)?; - - let mut komorebi_json = - include_str!("../../docs/komorebi.example.json").to_string(); - let komorebi_bar_json = - include_str!("../../docs/komorebi.bar.example.json").to_string(); - - if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() { - komorebi_json = - komorebi_json.replace("Env:USERPROFILE", "Env:KOMOREBI_CONFIG_HOME"); - } - - let komorebi_path = HOME_DIR.join("komorebi.json"); - let bar_path = HOME_DIR.join("komorebi.bar.json"); - let applications_path = HOME_DIR.join("applications.json"); - let whkdrc_path = WHKD_CONFIG_DIR.join("whkdrc"); - - let mut written_files = Vec::new(); - - write_file_with_prompt(&komorebi_path, &komorebi_json, &mut written_files)?; - write_file_with_prompt(&bar_path, &komorebi_bar_json, &mut written_files)?; - - let applications_json = include_str!("../applications.json"); - write_file_with_prompt(&applications_path, applications_json, &mut written_files)?; - - let whkdrc = include_str!("../../docs/whkdrc.sample"); - write_file_with_prompt(&whkdrc_path, whkdrc, &mut written_files)?; - if written_files.is_empty() { - println!("\nNo files were written.") - } else { - println!( - "\nThe following example files were written:\n{}", - written_files.join("\n") - ); - } - - if let Ok((mdm, server)) = splash::mdm_enrollment() - && mdm - { - if let Some(server) = server { - println!( - "\nIt looks like you are using a corporate device enrolled in mobile device management ({server})" - ); - } else { - println!( - "\nIt looks like you are using a corporate device enrolled in mobile device management" - ); - } - println!("The Komorebi License does not permit any kind of commercial use"); - println!( - "A dedicated Individual Commercial Use License is available if you wish to use this software at work" - ); - println!( - "You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement" - ); - println!( - "If you already have a license, you can run \"komorebic license \" with the email address your license is associated with" - ); - } - - println!("\nYou can now run komorebic start --whkd --bar"); - } - WindowsCommands::EnableAutostart(args) => { - if args.ahk { - println!( - "EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes" - ); - } - - let mut current_exe = std::env::current_exe().expect("unable to get exec path"); - current_exe.pop(); - let komorebic_exe = current_exe.join("komorebic-no-console.exe"); - let komorebic_exe = dunce::simplified(&komorebic_exe); - - let startup_dir = startup_dir()?; - let shortcut_file = startup_dir.join("komorebi.lnk"); - let shortcut_file = dunce::simplified(&shortcut_file); - - let mut arguments = String::from("start"); - - if let Some(config) = args.config { - arguments.push_str(" --config "); - arguments.push_str(&config.to_string_lossy()); - } - - if args.ffm { - arguments.push_str(" --ffm"); - } - - if args.bar { - arguments.push_str(" --bar"); - } - - if args.whkd { - arguments.push_str(" --whkd"); - } else if args.ahk { - arguments.push_str(" --ahk"); - } - - if args.masir { - arguments.push_str(" --masir"); - } - - Command::new("powershell") - .arg("-c") - .arg("$WshShell = New-Object -comObject WScript.Shell; $Shortcut = $WshShell.CreateShortcut($env:SHORTCUT_PATH); $Shortcut.TargetPath = $env:TARGET_PATH; $Shortcut.Arguments = $env:TARGET_ARGS; $Shortcut.Save()") - .env("SHORTCUT_PATH", shortcut_file.as_os_str()) - .env("TARGET_PATH", komorebic_exe.as_os_str()) - .env("TARGET_ARGS", arguments) - .output()?; - - println!( - "NOTE: If your komorebi.json file contains a reference to $Env:KOMOREBI_CONFIG_HOME," - ); - println!( - "you need to add this to System Properties > Environment Variables > User Variables" - ); - println!("in order for the autostart command to work properly"); - } - WindowsCommands::DisableAutostart => { - let startup_dir = startup_dir()?; - let shortcut_file = startup_dir.join("komorebi.lnk"); - - if shortcut_file.is_file() { - std::fs::remove_file(shortcut_file)?; - } - } - WindowsCommands::Check(args) => { - let home_display = HOME_DIR.display(); - if HAS_CUSTOM_CONFIG_HOME.load(Ordering::SeqCst) { - println!("KOMOREBI_CONFIG_HOME detected: {home_display}\n"); - } else { - println!( - "No KOMOREBI_CONFIG_HOME detected, defaulting to {}\n", - dirs::home_dir() - .expect("could not find home dir") - .to_string_lossy() - ); - } - - println!("Looking for configuration files in {home_display}\n"); - - let static_config = if let Some(static_config) = args.komorebi_config { - println!( - "Using an arbitrary configuration file passed to --komorebi-config flag\n" - ); - static_config - } else { - HOME_DIR.join("komorebi.json") - }; - - let config_pwsh = HOME_DIR.join("komorebi.ps1"); - let config_ahk = HOME_DIR.join("komorebi.ahk"); - let config_whkd = WHKD_CONFIG_DIR.join("whkdrc"); - - if static_config.exists() { - let config_source = std::fs::read_to_string(&static_config)?; - let lines: Vec<_> = config_source.lines().collect(); - let parsed_config = serde_json::from_str::(&config_source); - if let Err(serde_error) = &parsed_config { - let line = lines[serde_error.line() - 2]; - - let offset = SourceOffset::from_location( - config_source.clone(), - serde_error.line() - 1, - line.len(), - ); - - let error_string = serde_error.to_string(); - let msgs: Vec<_> = error_string.split(" at ").collect(); - - let diagnostic = ConfigurationError { - message: msgs[0].to_string(), - src: NamedSource::new("komorebi.json", config_source.clone()), - bad_bit: SourceSpan::new(offset, 2), - }; - - println!("{:?}", Report::new(diagnostic)); - } - - println!( - "Found komorebi.json; this file can be passed to the start command with the --config flag\n" - ); - - if let Ok(config) = StaticConfig::read(&static_config) { - match config.app_specific_configuration_path { - None => { - println!( - "Application specific configuration file path has not been set. Try running 'komorebic fetch-asc'\n" - ); - } - Some(AppSpecificConfigurationPath::Single(path)) if !path.exists() => { - println!( - "Application specific configuration file path '{}' does not exist. Try running 'komorebic fetch-asc'\n", - path.display() - ); - } - _ => {} - } - } - - // Check that this file adheres to the schema static config schema as the last step, - // so that more basic errors above can be shown to the error before schema-specific - // errors - let _ = serde_json::from_str::(&config_source)?; - - let raw = std::fs::read_to_string(static_config)?; - StaticConfig::aliases(&raw); - StaticConfig::deprecated(&raw); - StaticConfig::end_of_life(&raw); - - if config_whkd.exists() { - println!( - "Found {}; key bindings will be loaded from here when whkd is started, and you can start it automatically using the --whkd flag\n", - config_whkd.to_string_lossy() - ); - } else { - println!( - "No ~/.config/whkdrc found; you may not be able to control komorebi with your keyboard\n" - ); - } - } else if config_pwsh.exists() { - println!("Found komorebi.ps1; this file will be autoloaded by komorebi\n"); - if config_whkd.exists() { - println!( - "Found {}; key bindings will be loaded from here when whkd is started\n", - config_whkd.to_string_lossy() - ); - } else { - println!( - "No ~/.config/whkdrc found; you may not be able to control komorebi with your keyboard\n" - ); - } - } else if config_ahk.exists() { - println!("Found komorebi.ahk; this file will be autoloaded by komorebi\n"); - } else { - println!("No komorebi configuration found in {home_display}\n"); - println!( - "If running 'komorebic start --await-configuration', you will manually have to call the following command to begin tiling: komorebic complete-configuration\n" - ); - } - - let client = reqwest::blocking::Client::new(); - - if let Ok(response) = client - .get("https://api.github.com/repos/LGUG2Z/komorebi/releases/latest") - .header("User-Agent", "komorebic-version-checker") - .send() - { - let version = env!("CARGO_PKG_VERSION"); - - #[derive(Deserialize)] - struct Release { - tag_name: String, - } - - if let Ok(release) = - serde_json::from_str::(&response.text().unwrap_or_default()) - { - let trimmed = release.tag_name.trim_start_matches("v"); - if trimmed > version { - println!( - "An updated version of komorebi is available! https://github.com/LGUG2Z/komorebi/releases/v{trimmed}" - ); - } - } - } - } - WindowsCommands::Configuration => { - let static_config = HOME_DIR.join("komorebi.json"); - - if static_config.exists() { - println!("{}", static_config.display()); - } - } - WindowsCommands::BarConfiguration => { - let static_config = HOME_DIR.join("komorebi.bar.json"); - - if static_config.exists() { - println!("{}", static_config.display()); - } - } - WindowsCommands::Whkdrc => { - let whkdrc = WHKD_CONFIG_DIR.join("whkdrc"); - - if whkdrc.exists() { - println!("{}", whkdrc.display()); - } - } - WindowsCommands::DataDirectory => { - let dir = &*DATA_DIR; - if dir.exists() { - println!("{}", dir.display()); - } - } - WindowsCommands::Log => { - let timestamp = Utc::now().format("%Y-%m-%d").to_string(); - let color_log = std::env::temp_dir().join(format!("komorebi.log.{timestamp}")); - let file = TailedFile::new(File::open(color_log)?); - let locked = file.lock(); - #[allow(clippy::significant_drop_in_scrutinee, clippy::lines_filter_map_ok)] - for line in locked.lines().flatten() { - println!("{line}"); - } - } - WindowsCommands::ForceFocus => { - send_message(&SocketMessage::ForceFocus)?; - } - WindowsCommands::InvisibleBorders(args) => { - send_message(&SocketMessage::InvisibleBorders(Rect { - left: args.left, - top: args.top, - right: args.right, - bottom: args.bottom, - }))?; - } - WindowsCommands::ToggleFocusFollowsMouse(args) => { - send_message(&SocketMessage::ToggleFocusFollowsMouse(args.implementation))?; - } - WindowsCommands::ToggleMaximize => { - send_message(&SocketMessage::ToggleMaximize)?; - } - WindowsCommands::WorkspaceCustomLayout(args) => { - send_message(&SocketMessage::WorkspaceLayoutCustom( - args.monitor, - args.workspace, - args.path, - ))?; - } - WindowsCommands::NamedWorkspaceCustomLayout(args) => { - send_message(&SocketMessage::NamedWorkspaceLayoutCustom( - args.workspace, - args.path, - ))?; - } - WindowsCommands::WorkspaceCustomLayoutRule(args) => { - send_message(&SocketMessage::WorkspaceLayoutCustomRule( - args.monitor, - args.workspace, - args.at_container_count, - args.path, - ))?; - } - WindowsCommands::NamedWorkspaceCustomLayoutRule(args) => { - send_message(&SocketMessage::NamedWorkspaceLayoutCustomRule( - args.workspace, - args.at_container_count, - args.path, - ))?; - } - WindowsCommands::Start(args) => { - if args.ahk { - println!( - "EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes" - ); - } - - let mut ahk: String = String::from("autohotkey.exe"); - - if let Ok(komorebi_ahk_exe) = std::env::var("KOMOREBI_AHK_EXE") - && which(&komorebi_ahk_exe).is_ok() - { - ahk = komorebi_ahk_exe; - } - - if args.whkd && which("whkd").is_err() { - bail!( - "could not find whkd, please make sure it is installed before using the --whkd flag" - ); - } - - if args.masir && which("masir").is_err() { - bail!( - "could not find masir, please make sure it is installed before using the --masir flag" - ); - } - - if args.ahk && which(&ahk).is_err() { - bail!( - "could not find autohotkey, please make sure it is installed before using the --ahk flag" - ); - } - - let mut buf: PathBuf; - - // The komorebi.ps1 shim will only exist in the Path if installed by Scoop - let exec = - if let Ok(output) = Command::new("where.exe").arg("komorebi.ps1").output() { - let stdout = String::from_utf8(output.stdout)?; - match stdout.trim() { - "" => None, - // It's possible that a komorebi.ps1 config will be in %USERPROFILE% - ignore this - stdout if !stdout.contains("scoop") => None, - stdout => { - buf = PathBuf::from(stdout); - buf.pop(); // %USERPROFILE%\scoop\shims - buf.pop(); // %USERPROFILE%\scoop - buf.push("apps\\komorebi\\current\\komorebi.exe"); //%USERPROFILE%\scoop\komorebi\current\komorebi.exe - Some(buf.to_str().ok_or_eyre( - "cannot create a string from the scoop komorebi path", - )?) - } - } - } else { - None - }; - - let mut flags = vec![]; - if let Some(config) = &args.config { - if !config.is_file() { - bail!("could not find file: {}", config.display()); - } - - let config = dunce::simplified(config); - flags.push(format!("'--config=\"{}\"'", config.display())); - } - - if args.ffm { - flags.push("'--ffm'".to_string()); - } - - if args.await_configuration { - flags.push("'--await-configuration'".to_string()); - } - - if let Some(port) = args.tcp_port { - flags.push(format!("'--tcp-port={port}'")); - } - - if args.clean_state { - flags.push("'--clean-state'".to_string()); - } - - let exec = exec.unwrap_or("komorebi.exe"); - let script = if flags.is_empty() { - format!("Start-Process '{exec}' -WindowStyle hidden",) - } else { - let argument_list = flags.join(","); - format!( - "Start-Process '{exec}' -ArgumentList {argument_list} -WindowStyle hidden", - ) - }; - - let mut launcher = WindowsLauncher { - script, - config: args.config.clone(), - system: sysinfo::System::new_all(), - }; - - if !launcher::start(&mut launcher)? { - return Ok(()); - } - - if args.whkd { - let script = r" -if (!(Get-Process whkd -ErrorAction SilentlyContinue)) -{ - Start-Process whkd -WindowStyle hidden -} - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - if args.ahk { - let config_ahk = HOME_DIR.join("komorebi.ahk"); - let config_ahk = dunce::simplified(&config_ahk); - - let script = format!( - r#" - Start-Process '"{ahk}"' '"{config}"' -WindowStyle hidden - "#, - config = config_ahk.display() - ); - - match powershell_script::run(&script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - let static_config = args.config.clone().or_else(|| { - let komorebi_json = HOME_DIR.join("komorebi.json"); - komorebi_json.is_file().then_some(komorebi_json) - }); - - if args.bar { - let mut fallthrough = false; - match static_config { - None => { - fallthrough = true; - } - Some(ref config) => { - let mut config = StaticConfig::read(config)?; - if let Some(display_bar_configurations) = &mut config.bar_configurations - { - for config_file_path in &mut *display_bar_configurations { - let script = format!( - r#"Start-Process "komorebi-bar" '"--config" "{}"' -WindowStyle hidden"#, - config_file_path.to_string_lossy() - ); - - match powershell_script::run(&script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - } else { - fallthrough = true; - } - } - } - - if fallthrough { - let script = r" -if (!(Get-Process komorebi-bar -ErrorAction SilentlyContinue)) -{ - Start-Process komorebi-bar -WindowStyle hidden -} - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - } - - if args.masir { - let script = r" -if (!(Get-Process masir -ErrorAction SilentlyContinue)) -{ - Start-Process masir -WindowStyle hidden -} - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - println!("\nThank you for using komorebi!\n"); - println!("# Commercial Use License"); - println!( - "* View licensing options https://lgug2z.com/software/komorebi - A commercial use license is required to use komorebi at work" - ); - println!("\n# Personal Use Sponsorship"); - println!( - "* Become a sponsor https://github.com/sponsors/LGUG2Z - $5/month makes a big difference" - ); - println!( - "* Leave a tip https://ko-fi.com/lgug2z - An alternative to GitHub Sponsors" - ); - println!("\n# Community"); - println!( - "* Join the Discord https://discord.gg/mGkn66PHkx - Chat, ask questions, share your desktops" - ); - println!( - "* Subscribe to https://youtube.com/@LGUG2Z - Development videos, feature previews and release overviews" - ); - println!( - "* Explore the Awesome Komorebi list https://github.com/LGUG2Z/awesome-komorebi - Projects in the komorebi ecosystem" - ); - println!("\n# Documentation"); - println!( - "* Read the docs https://lgug2z.github.io/komorebi - Quickly search through all komorebic commands" - ); - - let bar_config = args.config.or_else(|| { - let bar_json = HOME_DIR.join("komorebi.bar.json"); - bar_json.is_file().then_some(bar_json) - }); - - if let Some(config) = &static_config { - let raw = std::fs::read_to_string(config)?; - StaticConfig::aliases(&raw); - StaticConfig::deprecated(&raw); - StaticConfig::end_of_life(&raw); - } - - if bar_config.is_some() { - let output = Command::new("komorebi-bar.exe").arg("--aliases").output()?; - let stdout = String::from_utf8(output.stdout)?; - println!("{stdout}"); - } - - let client = reqwest::blocking::Client::new(); - - if let Ok(response) = client - .get("https://api.github.com/repos/LGUG2Z/komorebi/releases/latest") - .header("User-Agent", "komorebic-version-checker") - .send() - { - let version = env!("CARGO_PKG_VERSION"); - - #[derive(Deserialize)] - struct Release { - tag_name: String, - } - - if let Ok(release) = - serde_json::from_str::(&response.text().unwrap_or_default()) - { - let trimmed = release.tag_name.trim_start_matches("v"); - if trimmed > version { - println!( - "An updated version of komorebi is available! https://github.com/LGUG2Z/komorebi/releases/v{trimmed}" - ); - } - } - } - } - WindowsCommands::Stop(args) => { - if args.ahk { - println!( - "EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes" - ); - } - - if args.whkd { - let script = r" -Stop-Process -Name:whkd -ErrorAction SilentlyContinue - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - if args.bar { - let script = r" -Stop-Process -Name:komorebi-bar -ErrorAction SilentlyContinue - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - if args.masir { - let script = r" -Stop-Process -Name:masir -ErrorAction SilentlyContinue - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - if args.ahk { - let script = r#" -if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) { - (Get-CimInstance Win32_Process | Where-Object { - ($_.CommandLine -like '*komorebi.ahk"') -and - ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe', 'AutoHotkeyUX.exe')) - } | Select-Object -First 1) | ForEach-Object { - Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue - } -} else { - (Get-WmiObject Win32_Process | Where-Object { - ($_.CommandLine -like '*komorebi.ahk"') -and - ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe', 'AutoHotkeyUX.exe')) - } | Select-Object -First 1) | ForEach-Object { - Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue - } -} -"#; - - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - send_message(&launcher::stop_message(args.ignore_restore))?; - let mut system = sysinfo::System::new_all(); - system.refresh_processes(ProcessesToUpdate::All, true); - - if system.processes_by_name("komorebi.exe".as_ref()).count() >= 1 { - println!("komorebi is still running, attempting to force-quit"); - - let script = r" -Stop-Process -Name:komorebi -ErrorAction SilentlyContinue - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - - let hwnd_json = DATA_DIR.join("komorebi.hwnd.json"); - - let file = File::open(hwnd_json)?; - let reader = BufReader::new(file); - let hwnds: Vec = serde_json::from_reader(reader)?; - - for hwnd in hwnds { - restore_window(hwnd); - } - } - Err(error) => { - println!("Error: {error}"); - } - } - } - } - WindowsCommands::Kill(args) => { - if args.ahk { - println!( - "EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes" - ); - } - - if args.whkd { - let script = r" -Stop-Process -Name:whkd -ErrorAction SilentlyContinue - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - if args.bar { - let script = r" -Stop-Process -Name:komorebi-bar -ErrorAction SilentlyContinue - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - if args.masir { - let script = r" -Stop-Process -Name:masir -ErrorAction SilentlyContinue - "; - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - - if args.ahk { - let script = r#" -if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) { - (Get-CimInstance Win32_Process | Where-Object { - ($_.CommandLine -like '*komorebi.ahk"') -and - ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe', 'AutoHotkeyUX.exe')) - } | Select-Object -First 1) | ForEach-Object { - Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue - } -} else { - (Get-WmiObject Win32_Process | Where-Object { - ($_.CommandLine -like '*komorebi.ahk"') -and - ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe', 'AutoHotkeyUX.exe')) - } | Select-Object -First 1) | ForEach-Object { - Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue - } -} -"#; - - match powershell_script::run(script) { - Ok(_) => { - println!("{script}"); - } - Err(error) => { - println!("Error: {error}"); - } - } - } - } - WindowsCommands::Pan(args) => { - // a flag that has a default counts as given, so what only goes with --stream - // cannot be left to the parser to say - if !args.stream && (args.sensitivity.is_some() || args.reversed || args.paging) { - command::(&META) - .error( - clap::error::ErrorKind::ArgumentConflict, - "--sensitivity, --reversed and --paging can only be used with --stream", - ) - .exit(); - } - - if args.stream { - pan::run( - BufReader::new(io::stdin()), - pan::Options { - sensitivity: args.sensitivity.unwrap_or(1.0), - reversed: args.reversed, - paging: args.paging, - }, - &mut pan::Socket::new(|| komorebi_client::Connection::open().map(PanLink)), - )?; - } else if let Some(direction) = args.direction { - send_message(&SocketMessage::Pan(direction))?; - } - } - WindowsCommands::LayoutRatios(args) => { - if args.columns.is_none() && args.rows.is_none() { - println!( - "No ratios provided, nothing to change. Use --columns or --rows to specify ratios." - ); - } else { - send_message(&SocketMessage::LayoutRatios(args.columns, args.rows))?; - } - } - WindowsCommands::LoadCustomLayout(args) => { - send_message(&SocketMessage::ChangeLayoutCustom(args.path))?; - } - WindowsCommands::MonitorIndexPreference(args) => { - send_message(&SocketMessage::MonitorIndexPreference( - args.index_preference, - args.left, - args.top, - args.right, - args.bottom, - ))?; - } - WindowsCommands::Gui => { - Command::new("komorebi-gui").spawn()?; - } - WindowsCommands::ToggleShortcuts => { - let output = Command::new("taskkill") - .args(["/F", "/IM", "komorebi-shortcuts.exe"]) - .output()?; - - if !output.status.success() { - Command::new("komorebi-shortcuts.exe").spawn()?; - } - } - WindowsCommands::RestoreWindows => { - let hwnd_json = DATA_DIR.join("komorebi.hwnd.json"); - - let file = File::open(hwnd_json)?; - let reader = BufReader::new(file); - let hwnds: Vec = serde_json::from_reader(reader)?; - - for hwnd in hwnds { - restore_window(hwnd); - } - } - WindowsCommands::FocusFollowsMouse(args) => { - send_message(&SocketMessage::FocusFollowsMouse( - args.implementation, - args.boolean_state.into(), - ))?; - } - WindowsCommands::ReloadConfiguration => { - send_message(&SocketMessage::ReloadConfiguration)?; - } - WindowsCommands::WatchConfiguration(args) => { - send_message(&SocketMessage::WatchConfiguration(args.value.into()))?; - } - WindowsCommands::CompleteConfiguration => { - send_message(&SocketMessage::CompleteConfiguration)?; - } - WindowsCommands::IdentifyObjectNameChangeApplication(target) => { - send_message(&SocketMessage::IdentifyObjectNameChangeApplication( - target.identifier, - target.id, - ))?; - } - WindowsCommands::IdentifyTrayApplication(target) => { - send_message(&SocketMessage::IdentifyTrayApplication( - target.identifier, - target.id, - ))?; - } - WindowsCommands::IdentifyLayeredApplication(target) => { - send_message(&SocketMessage::IdentifyLayeredApplication( - target.identifier, - target.id, - ))?; - } - WindowsCommands::RemoveTitleBar(target) => { - match target.identifier { - ApplicationIdentifier::Exe => {} - _ => { - bail!("this command requires applications to be identified by their exe"); - } - } - - send_message(&SocketMessage::RemoveTitleBar(target.identifier, target.id))?; - } - WindowsCommands::ToggleTitleBars => { - send_message(&SocketMessage::ToggleTitleBars)?; - } - WindowsCommands::SubscribePipe(args) => { - send_message(&SocketMessage::AddSubscriberPipe(args.named_pipe))?; - } - WindowsCommands::UnsubscribePipe(args) => { - send_message(&SocketMessage::RemoveSubscriberPipe(args.named_pipe))?; - } - WindowsCommands::BorderStyle(args) => { - send_message(&SocketMessage::BorderStyle(args.style))?; - } - WindowsCommands::BorderImplementation(args) => { - send_message(&SocketMessage::BorderImplementation(args.style))?; - } - WindowsCommands::StackbarMode(args) => { - send_message(&SocketMessage::StackbarMode(args.mode))?; - } - WindowsCommands::Transparency(args) => { - send_message(&SocketMessage::Transparency(args.boolean_state.into()))?; - } - WindowsCommands::TransparencyAlpha(args) => { - send_message(&SocketMessage::TransparencyAlpha(args.alpha))?; - } - WindowsCommands::ToggleTransparency => { - send_message(&SocketMessage::ToggleTransparency)?; - } - - WindowsCommands::WindowHidingBehaviour(args) => { - send_message(&SocketMessage::WindowHidingBehaviour(args.value))?; - } - WindowsCommands::AhkAppSpecificConfiguration(args) => { - let content = std::fs::read_to_string(args.path)?; - let lines = if let Some(override_path) = args.override_path { - let override_content = std::fs::read_to_string(override_path)?; - - ApplicationConfigurationGenerator::generate_ahk( - &content, - Option::from(override_content.as_str()), - )? - } else { - ApplicationConfigurationGenerator::generate_ahk(&content, None)? - }; - - let generated_config = HOME_DIR.join("komorebi.generated.ahk"); - let mut file = OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(&generated_config)?; - - file.write_all(lines.join("\n").as_bytes())?; - - println!( - "\nApplication-specific generated configuration written to {}", - generated_config.display() - ); - } - WindowsCommands::PwshAppSpecificConfiguration(args) => { - let content = std::fs::read_to_string(args.path)?; - let lines = if let Some(override_path) = args.override_path { - let override_content = std::fs::read_to_string(override_path)?; - - ApplicationConfigurationGenerator::generate_pwsh( - &content, - Option::from(override_content.as_str()), - )? - } else { - ApplicationConfigurationGenerator::generate_pwsh(&content, None)? - }; - - let generated_config = HOME_DIR.join("komorebi.generated.ps1"); - let mut file = OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(&generated_config)?; - - file.write_all(lines.join("\n").as_bytes())?; - - println!( - "\nApplication-specific generated configuration written to {}", - generated_config.display() - ); - } - WindowsCommands::ConvertAppSpecificConfiguration(args) => { - let content = std::fs::read_to_string(args.path)?; - let mut asc = ApplicationConfigurationGenerator::load(&content)?; - asc.sort_by(|a, b| a.name.cmp(&b.name)); - let v2 = ApplicationSpecificConfiguration::from(asc); - println!("{}", serde_json::to_string_pretty(&v2)?); - } - WindowsCommands::FormatAppSpecificConfiguration(args) => { - let content = std::fs::read_to_string(&args.path)?; - let formatted_content = ApplicationConfigurationGenerator::format(&content)?; - - let mut file = OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(args.path)?; - - file.write_all(formatted_content.as_bytes())?; - - println!( - "File successfully formatted for PRs to https://github.com/LGUG2Z/komorebi-application-specific-configuration" - ); - } - WindowsCommands::FetchAppSpecificConfiguration => { - let content = reqwest::blocking::get("https://raw.githubusercontent.com/LGUG2Z/komorebi-application-specific-configuration/master/applications.json")? - .text()?; - - let output_file = HOME_DIR.join("applications.json"); - - let mut file = OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(&output_file)?; - - file.write_all(content.as_bytes())?; - - println!( - "Latest version of applications.json from https://github.com/LGUG2Z/komorebi-application-specific-configuration downloaded\n" - ); - println!( - "You can add this to your komorebi.json static configuration file like this: \n\n\"app_specific_configuration_path\": \"{}\"", - output_file.display().to_string().replace("\\", "/") - ); - } - WindowsCommands::ApplicationSpecificConfigurationSchema => { - #[cfg(feature = "schemars")] - { - let schema = komorebi_config::schema::view::( - komorebi_config::schema::Platform::CURRENT, - ); - print!("{schema}"); - } - } - WindowsCommands::NotificationSchema => { - #[cfg(feature = "schemars")] - { - let notification = schemars::schema_for!(komorebi_client::Notification); - let schema = serde_json::to_string_pretty(¬ification)?; - println!("{schema}"); - } - } - WindowsCommands::SocketSchema => { - #[cfg(feature = "schemars")] - { - let socket_message = schemars::schema_for!(SocketMessage); - let schema = serde_json::to_string_pretty(&socket_message)?; - println!("{schema}"); - } - } - WindowsCommands::StaticConfigSchema => { - #[cfg(feature = "schemars")] - { - let schema = komorebi_config::schema::view::< - komorebi_config::static_config::StaticConfig, - >(komorebi_config::schema::Platform::CURRENT); - print!("{schema}"); - } - } - WindowsCommands::GenerateStaticConfig => { - print_query(&SocketMessage::GenerateStaticConfig); - } - // Deprecated - #[allow(deprecated)] - WindowsCommands::AltFocusHack(_) - | WindowsCommands::IdentifyBorderOverflowApplication(_) => { - println!("Command deprecated - this is now automatically handled by komorebi! 🎉"); - } - }, - } - - Ok(()) -} - -fn show_window(hwnd: HWND, command: SHOW_WINDOW_CMD) { - // BOOL is returned but does not signify whether or not the operation was succesful - // https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow - // TODO: error handling - unsafe { - let _ = ShowWindow(hwnd, command); - }; -} - -fn remove_transparency(hwnd: isize) { - let _ = komorebi_client::Window::from(hwnd).opaque(); -} - -fn restore_window(hwnd: isize) { - show_window(HWND(hwnd as *mut core::ffi::c_void), SW_RESTORE); - remove_transparency(hwnd); +fn main() -> color_eyre::eyre::Result<()> { + platform::main() } diff --git a/komorebic/src/windows.rs b/komorebic/src/windows.rs new file mode 100644 index 00000000..2f4b58e0 --- /dev/null +++ b/komorebic/src/windows.rs @@ -0,0 +1,1467 @@ +#![warn(clippy::all)] +#![allow(clippy::missing_errors_doc, clippy::doc_markdown)] +#![allow(unused_assignments)] // false positives for the error reporter + +use chrono::Utc; +use komorebi_client::PathExt; +use komorebi_client::splash; + +use std::fs::File; +use std::fs::OpenOptions; +use std::io; +use std::io::BufRead; +use std::io::BufReader; +use std::io::Write; +use std::path::PathBuf; +use std::process::Command; +use std::sync::atomic::AtomicBool; +use std::sync::atomic::Ordering; + +use color_eyre::eyre; +use color_eyre::eyre::OptionExt; +use color_eyre::eyre::bail; +use fs_tail::TailedFile; +use komorebi_client::AppSpecificConfigurationPath; +use komorebi_client::ApplicationSpecificConfiguration; +use komorebi_client::send_message; +use komorebi_client::send_query; +use komorebic_core::cli::Cmd; +use komorebic_core::cli::Meta; +use komorebic_core::cli::command; +use komorebic_core::docgen::DocFormat; +use komorebic_core::launcher; +use komorebic_core::launcher::Launcher; +use komorebic_core::messages::Messages; +use komorebic_core::pan; +use komorebic_core::platform::windows::*; +use lazy_static::lazy_static; +use miette::NamedSource; +use miette::Report; +use miette::SourceOffset; +use miette::SourceSpan; +use serde::Deserialize; +use sysinfo::ProcessesToUpdate; +use which::which; +use win_msgbox::OkayCancel; +use windows::Win32::Foundation::HWND; +use windows::Win32::UI::WindowsAndMessaging::SHOW_WINDOW_CMD; +use windows::Win32::UI::WindowsAndMessaging::SW_RESTORE; +use windows::Win32::UI::WindowsAndMessaging::ShowWindow; + +use komorebi_client::ApplicationConfigurationGenerator; +use komorebi_client::ApplicationIdentifier; +use komorebi_client::Rect; +use komorebi_client::SocketMessage; +use komorebi_client::StaticConfig; +use komorebi_client::splash::ValidationFeedback; + +lazy_static! { + static ref HAS_CUSTOM_CONFIG_HOME: AtomicBool = AtomicBool::new(false); + static ref HOME_DIR: PathBuf = { + std::env::var("KOMOREBI_CONFIG_HOME").map_or_else( + |_| dirs::home_dir().expect("there is no home directory"), + |home_path| { + let home = home_path.replace_env(); + if home.as_path().is_dir() { + HAS_CUSTOM_CONFIG_HOME.store(true, Ordering::SeqCst); + home + } else { + panic!( + "$Env:KOMOREBI_CONFIG_HOME is set to '{home_path}', which is not a valid directory", + ); + } + }, + ) + }; + static ref DATA_DIR: PathBuf = dirs::data_local_dir() + .expect("there is no local data directory") + .join("komorebi"); + static ref WHKD_CONFIG_DIR: PathBuf = { + std::env::var("WHKD_CONFIG_HOME").map_or_else( + |_| { + dirs::home_dir() + .expect("there is no home directory") + .join(".config") + }, + |home_path| { + let whkd_config_home = home_path.replace_env(); + + assert!( + whkd_config_home.is_dir(), + "$Env:WHKD_CONFIG_HOME is set to '{home_path}', which is not a valid directory" + ); + + whkd_config_home + }, + ) + }; +} + +shadow_rs::shadow!(build); + +#[derive(thiserror::Error, Debug, miette::Diagnostic)] +#[error("{message}")] +#[diagnostic(code(komorebi::configuration), help("try fixing this syntax error"))] +struct ConfigurationError { + message: String, + #[source_code] + src: NamedSource, + #[label("This bit here")] + bad_bit: SourceSpan, +} + +// print_query is a helper that queries komorebi and prints the response. +// panics on error. +fn print_query(message: &SocketMessage) { + match send_query(message) { + Ok(response) => println!("{response}"), + Err(error) => panic!("{}", error), + } +} + +fn startup_dir() -> eyre::Result { + let startup = dirs::home_dir() + .expect("unable to obtain user's home folder") + .join("AppData") + .join("Roaming") + .join("Microsoft") + .join("Windows") + .join("Start Menu") + .join("Programs") + .join("Startup"); + + if !startup.is_dir() { + std::fs::create_dir_all(&startup)?; + } + + Ok(startup) +} + +#[allow(clippy::too_many_lines, clippy::cognitive_complexity)] +/// Starting `komorebi.exe` for `komorebic start`: a PowerShell script that starts the daemon with +/// its flags, found among the processes by its name. +struct WindowsLauncher { + script: String, + config: Option, + system: sysinfo::System, +} + +impl Launcher for WindowsLauncher { + fn daemon_name(&self) -> &str { + "komorebi.exe" + } + + fn spawn(&mut self) -> eyre::Result<()> { + match powershell_script::run(&self.script) { + Ok(_) => { + println!("{}", self.script); + } + Err(error) => { + println!("Error: {error}"); + } + } + + Ok(()) + } + + fn is_running(&mut self) -> eyre::Result { + self.system.refresh_processes(ProcessesToUpdate::All, true); + + Ok(self + .system + .processes_by_name("komorebi.exe".as_ref()) + .next() + .is_some()) + } + + fn diagnose(&mut self) -> eyre::Result<()> { + if let Some(config) = &self.config { + if let Ok(output) = Command::new("komorebi.exe") + .arg(format!("'--config=\"{}\"'", config.display())) + .output() + { + println!("{}", String::from_utf8(output.stderr)?); + } + } else if let Ok(output) = Command::new("komorebi.exe").output() { + println!("{}", String::from_utf8(output.stderr)?); + } + + Ok(()) + } +} + +/// What the top of the help and `--version` say. +const META: Meta = Meta { + name: "komorebic", + about: "The command-line interface for Komorebi, a tiling window manager for Windows", + author: env!("CARGO_PKG_AUTHORS"), + version: build::CLAP_LONG_VERSION, +}; + +/// Write a message to the daemon's socket, or, if the daemon answers it, print the answer. +fn send_or_query(messages: Messages) -> eyre::Result<()> { + let query = messages.is_query(); + let message = SocketMessage::from(messages); + if query { + print_query(&message); + } else { + send_message(&message)?; + } + Ok(()) +} + +/// The connection to the daemon that the gesture stream tells what the fingers do over. +struct PanLink(komorebi_client::Connection); + +impl pan::Link for PanLink { + fn send(&mut self, message: &SocketMessage) -> io::Result<()> { + self.0.send(message) + } +} + +pub fn main() -> eyre::Result<()> { + let opts = komorebic_core::cli::parse::(&META); + + match opts.cmd { + Cmd::Messages(messages) => send_or_query(messages)?, + Cmd::Platform(platform) => match platform { + WindowsCommands::Docgen(args) => { + let output_dir = args.output.unwrap_or_else(|| PathBuf::from("docs/cli")); + let pages = komorebic_core::docgen::write( + command::(&META), + &DocFormat::PLAIN, + &output_dir, + )?; + for page in pages { + println!("{}", page.display()); + } + } + WindowsCommands::Splash(args) => { + let informative_text = match args.mdm_server { + None => { + "It looks like you are using a corporate device enrolled in mobile device management\n\n\ + The Komorebi License does not permit any kind of commercial use\n\n\ + A dedicated Individual Commercial Use License is available if you wish to use this software at work\n\n\ + You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement\n\n\ + To remove this popup in the future, run \"komorebic license \" using the email address associated with your license\n\n\ + If you are a student using komorebi on a laptop provided by your school, you can email me from your educational email account to remove this popup".to_string() + } + Some(server) => { + format!( + "It looks like you are using a corporate device enrolled in mobile device management ({server})\n\n\ + The Komorebi License does not permit any kind of commercial use\n\n\ + A dedicated Individual Commercial Use License is available if you wish to use this software at work\n\n\ + You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement\n\n\ + To remove this popup in the future you can run \"komorebic license \" using the email address associated with your license\n\n + If you are a student using komorebi on a laptop provided by your school, you can email me from your educational email account to remove this popup" + ) + } + }; + + if let Ok(response) = win_msgbox::error::(&informative_text) + .title("MDM Enrollment Detected") + .topmost() + .icon(win_msgbox::Icon::Warning) + .set_foreground() + .show() + { + match response { + OkayCancel::Okay => { + open::that("https://lgug2z.com/software/komorebi")?; + } + OkayCancel::Cancel => {} + } + } + } + WindowsCommands::License(args) => { + let _ = std::fs::remove_file(DATA_DIR.join("icul.validation")); + std::fs::write(DATA_DIR.join("icul"), &args.email)?; + match splash::should()? { + ValidationFeedback::Successful(icul_validation) => { + println!("Individual commercial use license validation successful"); + println!( + "Local validation file saved to {}", + icul_validation.display() + ); + println!("\n{}", std::fs::read_to_string(&icul_validation)?); + } + ValidationFeedback::Unsuccessful(invalid_payload) => { + println!( + "No active individual commercial use license found for {}", + args.email + ); + println!("\n{invalid_payload}"); + println!( + "\nYou can purchase an individual commercial use license at https://lgug2z.com/software/komorebi" + ); + } + ValidationFeedback::NoEmail => {} + ValidationFeedback::NoConnectivity => { + println!( + "Could not make a connection to validate an individual commercial use license for {}", + args.email + ); + } + } + } + WindowsCommands::Quickstart => { + fn write_file_with_prompt( + path: &PathBuf, + content: &str, + created_files: &mut Vec, + ) -> eyre::Result<()> { + if path.exists() { + print!( + "{} will be overwritten, do you want to continue? (y/N): ", + path.display() + ); + io::stdout().flush()?; + let mut input = String::new(); + io::stdin().read_line(&mut input)?; + let trimmed = input.trim().to_lowercase(); + if trimmed == "y" || trimmed == "yes" { + std::fs::write(path, content)?; + created_files.push(path.display().to_string()); + } else { + println!("Skipping {}", path.display()); + } + } else { + std::fs::write(path, content)?; + created_files.push(path.display().to_string()); + } + Ok(()) + } + + let local_appdata_dir = + dirs::data_local_dir().expect("could not find localdata dir"); + let data_dir = local_appdata_dir.join("komorebi"); + std::fs::create_dir_all(&*WHKD_CONFIG_DIR)?; + std::fs::create_dir_all(&*HOME_DIR)?; + std::fs::create_dir_all(data_dir)?; + + let mut komorebi_json = + include_str!("../../docs/komorebi.example.json").to_string(); + let komorebi_bar_json = + include_str!("../../docs/komorebi.bar.example.json").to_string(); + + if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() { + komorebi_json = + komorebi_json.replace("Env:USERPROFILE", "Env:KOMOREBI_CONFIG_HOME"); + } + + let komorebi_path = HOME_DIR.join("komorebi.json"); + let bar_path = HOME_DIR.join("komorebi.bar.json"); + let applications_path = HOME_DIR.join("applications.json"); + let whkdrc_path = WHKD_CONFIG_DIR.join("whkdrc"); + + let mut written_files = Vec::new(); + + write_file_with_prompt(&komorebi_path, &komorebi_json, &mut written_files)?; + write_file_with_prompt(&bar_path, &komorebi_bar_json, &mut written_files)?; + + let applications_json = include_str!("../applications.json"); + write_file_with_prompt(&applications_path, applications_json, &mut written_files)?; + + let whkdrc = include_str!("../../docs/whkdrc.sample"); + write_file_with_prompt(&whkdrc_path, whkdrc, &mut written_files)?; + if written_files.is_empty() { + println!("\nNo files were written.") + } else { + println!( + "\nThe following example files were written:\n{}", + written_files.join("\n") + ); + } + + if let Ok((mdm, server)) = splash::mdm_enrollment() + && mdm + { + if let Some(server) = server { + println!( + "\nIt looks like you are using a corporate device enrolled in mobile device management ({server})" + ); + } else { + println!( + "\nIt looks like you are using a corporate device enrolled in mobile device management" + ); + } + println!("The Komorebi License does not permit any kind of commercial use"); + println!( + "A dedicated Individual Commercial Use License is available if you wish to use this software at work" + ); + println!( + "You are strongly encouraged to make your employer pay for your license, either directly or via reimbursement" + ); + println!( + "If you already have a license, you can run \"komorebic license \" with the email address your license is associated with" + ); + } + + println!("\nYou can now run komorebic start --whkd --bar"); + } + WindowsCommands::EnableAutostart(args) => { + if args.ahk { + println!( + "EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes" + ); + } + + let mut current_exe = std::env::current_exe().expect("unable to get exec path"); + current_exe.pop(); + let komorebic_exe = current_exe.join("komorebic-no-console.exe"); + let komorebic_exe = dunce::simplified(&komorebic_exe); + + let startup_dir = startup_dir()?; + let shortcut_file = startup_dir.join("komorebi.lnk"); + let shortcut_file = dunce::simplified(&shortcut_file); + + let mut arguments = String::from("start"); + + if let Some(config) = args.config { + arguments.push_str(" --config "); + arguments.push_str(&config.to_string_lossy()); + } + + if args.ffm { + arguments.push_str(" --ffm"); + } + + if args.bar { + arguments.push_str(" --bar"); + } + + if args.whkd { + arguments.push_str(" --whkd"); + } else if args.ahk { + arguments.push_str(" --ahk"); + } + + if args.masir { + arguments.push_str(" --masir"); + } + + Command::new("powershell") + .arg("-c") + .arg("$WshShell = New-Object -comObject WScript.Shell; $Shortcut = $WshShell.CreateShortcut($env:SHORTCUT_PATH); $Shortcut.TargetPath = $env:TARGET_PATH; $Shortcut.Arguments = $env:TARGET_ARGS; $Shortcut.Save()") + .env("SHORTCUT_PATH", shortcut_file.as_os_str()) + .env("TARGET_PATH", komorebic_exe.as_os_str()) + .env("TARGET_ARGS", arguments) + .output()?; + + println!( + "NOTE: If your komorebi.json file contains a reference to $Env:KOMOREBI_CONFIG_HOME," + ); + println!( + "you need to add this to System Properties > Environment Variables > User Variables" + ); + println!("in order for the autostart command to work properly"); + } + WindowsCommands::DisableAutostart => { + let startup_dir = startup_dir()?; + let shortcut_file = startup_dir.join("komorebi.lnk"); + + if shortcut_file.is_file() { + std::fs::remove_file(shortcut_file)?; + } + } + WindowsCommands::Check(args) => { + let home_display = HOME_DIR.display(); + if HAS_CUSTOM_CONFIG_HOME.load(Ordering::SeqCst) { + println!("KOMOREBI_CONFIG_HOME detected: {home_display}\n"); + } else { + println!( + "No KOMOREBI_CONFIG_HOME detected, defaulting to {}\n", + dirs::home_dir() + .expect("could not find home dir") + .to_string_lossy() + ); + } + + println!("Looking for configuration files in {home_display}\n"); + + let static_config = if let Some(static_config) = args.komorebi_config { + println!( + "Using an arbitrary configuration file passed to --komorebi-config flag\n" + ); + static_config + } else { + HOME_DIR.join("komorebi.json") + }; + + let config_pwsh = HOME_DIR.join("komorebi.ps1"); + let config_ahk = HOME_DIR.join("komorebi.ahk"); + let config_whkd = WHKD_CONFIG_DIR.join("whkdrc"); + + if static_config.exists() { + let config_source = std::fs::read_to_string(&static_config)?; + let lines: Vec<_> = config_source.lines().collect(); + let parsed_config = serde_json::from_str::(&config_source); + if let Err(serde_error) = &parsed_config { + let line = lines[serde_error.line() - 2]; + + let offset = SourceOffset::from_location( + config_source.clone(), + serde_error.line() - 1, + line.len(), + ); + + let error_string = serde_error.to_string(); + let msgs: Vec<_> = error_string.split(" at ").collect(); + + let diagnostic = ConfigurationError { + message: msgs[0].to_string(), + src: NamedSource::new("komorebi.json", config_source.clone()), + bad_bit: SourceSpan::new(offset, 2), + }; + + println!("{:?}", Report::new(diagnostic)); + } + + println!( + "Found komorebi.json; this file can be passed to the start command with the --config flag\n" + ); + + if let Ok(config) = StaticConfig::read(&static_config) { + match config.app_specific_configuration_path { + None => { + println!( + "Application specific configuration file path has not been set. Try running 'komorebic fetch-asc'\n" + ); + } + Some(AppSpecificConfigurationPath::Single(path)) if !path.exists() => { + println!( + "Application specific configuration file path '{}' does not exist. Try running 'komorebic fetch-asc'\n", + path.display() + ); + } + _ => {} + } + } + + // Check that this file adheres to the schema static config schema as the last step, + // so that more basic errors above can be shown to the error before schema-specific + // errors + let _ = serde_json::from_str::(&config_source)?; + + let raw = std::fs::read_to_string(static_config)?; + StaticConfig::aliases(&raw); + StaticConfig::deprecated(&raw); + StaticConfig::end_of_life(&raw); + + if config_whkd.exists() { + println!( + "Found {}; key bindings will be loaded from here when whkd is started, and you can start it automatically using the --whkd flag\n", + config_whkd.to_string_lossy() + ); + } else { + println!( + "No ~/.config/whkdrc found; you may not be able to control komorebi with your keyboard\n" + ); + } + } else if config_pwsh.exists() { + println!("Found komorebi.ps1; this file will be autoloaded by komorebi\n"); + if config_whkd.exists() { + println!( + "Found {}; key bindings will be loaded from here when whkd is started\n", + config_whkd.to_string_lossy() + ); + } else { + println!( + "No ~/.config/whkdrc found; you may not be able to control komorebi with your keyboard\n" + ); + } + } else if config_ahk.exists() { + println!("Found komorebi.ahk; this file will be autoloaded by komorebi\n"); + } else { + println!("No komorebi configuration found in {home_display}\n"); + println!( + "If running 'komorebic start --await-configuration', you will manually have to call the following command to begin tiling: komorebic complete-configuration\n" + ); + } + + let client = reqwest::blocking::Client::new(); + + if let Ok(response) = client + .get("https://api.github.com/repos/LGUG2Z/komorebi/releases/latest") + .header("User-Agent", "komorebic-version-checker") + .send() + { + let version = env!("CARGO_PKG_VERSION"); + + #[derive(Deserialize)] + struct Release { + tag_name: String, + } + + if let Ok(release) = + serde_json::from_str::(&response.text().unwrap_or_default()) + { + let trimmed = release.tag_name.trim_start_matches("v"); + if trimmed > version { + println!( + "An updated version of komorebi is available! https://github.com/LGUG2Z/komorebi/releases/v{trimmed}" + ); + } + } + } + } + WindowsCommands::Configuration => { + let static_config = HOME_DIR.join("komorebi.json"); + + if static_config.exists() { + println!("{}", static_config.display()); + } + } + WindowsCommands::BarConfiguration => { + let static_config = HOME_DIR.join("komorebi.bar.json"); + + if static_config.exists() { + println!("{}", static_config.display()); + } + } + WindowsCommands::Whkdrc => { + let whkdrc = WHKD_CONFIG_DIR.join("whkdrc"); + + if whkdrc.exists() { + println!("{}", whkdrc.display()); + } + } + WindowsCommands::DataDirectory => { + let dir = &*DATA_DIR; + if dir.exists() { + println!("{}", dir.display()); + } + } + WindowsCommands::Log => { + let timestamp = Utc::now().format("%Y-%m-%d").to_string(); + let color_log = std::env::temp_dir().join(format!("komorebi.log.{timestamp}")); + let file = TailedFile::new(File::open(color_log)?); + let locked = file.lock(); + #[allow(clippy::significant_drop_in_scrutinee, clippy::lines_filter_map_ok)] + for line in locked.lines().flatten() { + println!("{line}"); + } + } + WindowsCommands::ForceFocus => { + send_message(&SocketMessage::ForceFocus)?; + } + WindowsCommands::InvisibleBorders(args) => { + send_message(&SocketMessage::InvisibleBorders(Rect { + left: args.left, + top: args.top, + right: args.right, + bottom: args.bottom, + }))?; + } + WindowsCommands::ToggleFocusFollowsMouse(args) => { + send_message(&SocketMessage::ToggleFocusFollowsMouse(args.implementation))?; + } + WindowsCommands::ToggleMaximize => { + send_message(&SocketMessage::ToggleMaximize)?; + } + WindowsCommands::WorkspaceCustomLayout(args) => { + send_message(&SocketMessage::WorkspaceLayoutCustom( + args.monitor, + args.workspace, + args.path, + ))?; + } + WindowsCommands::NamedWorkspaceCustomLayout(args) => { + send_message(&SocketMessage::NamedWorkspaceLayoutCustom( + args.workspace, + args.path, + ))?; + } + WindowsCommands::WorkspaceCustomLayoutRule(args) => { + send_message(&SocketMessage::WorkspaceLayoutCustomRule( + args.monitor, + args.workspace, + args.at_container_count, + args.path, + ))?; + } + WindowsCommands::NamedWorkspaceCustomLayoutRule(args) => { + send_message(&SocketMessage::NamedWorkspaceLayoutCustomRule( + args.workspace, + args.at_container_count, + args.path, + ))?; + } + WindowsCommands::Start(args) => { + if args.ahk { + println!( + "EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes" + ); + } + + let mut ahk: String = String::from("autohotkey.exe"); + + if let Ok(komorebi_ahk_exe) = std::env::var("KOMOREBI_AHK_EXE") + && which(&komorebi_ahk_exe).is_ok() + { + ahk = komorebi_ahk_exe; + } + + if args.whkd && which("whkd").is_err() { + bail!( + "could not find whkd, please make sure it is installed before using the --whkd flag" + ); + } + + if args.masir && which("masir").is_err() { + bail!( + "could not find masir, please make sure it is installed before using the --masir flag" + ); + } + + if args.ahk && which(&ahk).is_err() { + bail!( + "could not find autohotkey, please make sure it is installed before using the --ahk flag" + ); + } + + let mut buf: PathBuf; + + // The komorebi.ps1 shim will only exist in the Path if installed by Scoop + let exec = + if let Ok(output) = Command::new("where.exe").arg("komorebi.ps1").output() { + let stdout = String::from_utf8(output.stdout)?; + match stdout.trim() { + "" => None, + // It's possible that a komorebi.ps1 config will be in %USERPROFILE% - ignore this + stdout if !stdout.contains("scoop") => None, + stdout => { + buf = PathBuf::from(stdout); + buf.pop(); // %USERPROFILE%\scoop\shims + buf.pop(); // %USERPROFILE%\scoop + buf.push("apps\\komorebi\\current\\komorebi.exe"); //%USERPROFILE%\scoop\komorebi\current\komorebi.exe + Some(buf.to_str().ok_or_eyre( + "cannot create a string from the scoop komorebi path", + )?) + } + } + } else { + None + }; + + let mut flags = vec![]; + if let Some(config) = &args.config { + if !config.is_file() { + bail!("could not find file: {}", config.display()); + } + + let config = dunce::simplified(config); + flags.push(format!("'--config=\"{}\"'", config.display())); + } + + if args.ffm { + flags.push("'--ffm'".to_string()); + } + + if args.await_configuration { + flags.push("'--await-configuration'".to_string()); + } + + if let Some(port) = args.tcp_port { + flags.push(format!("'--tcp-port={port}'")); + } + + if args.clean_state { + flags.push("'--clean-state'".to_string()); + } + + let exec = exec.unwrap_or("komorebi.exe"); + let script = if flags.is_empty() { + format!("Start-Process '{exec}' -WindowStyle hidden",) + } else { + let argument_list = flags.join(","); + format!( + "Start-Process '{exec}' -ArgumentList {argument_list} -WindowStyle hidden", + ) + }; + + let mut launcher = WindowsLauncher { + script, + config: args.config.clone(), + system: sysinfo::System::new_all(), + }; + + if !launcher::start(&mut launcher)? { + return Ok(()); + } + + if args.whkd { + let script = r" +if (!(Get-Process whkd -ErrorAction SilentlyContinue)) +{ + Start-Process whkd -WindowStyle hidden +} + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + if args.ahk { + let config_ahk = HOME_DIR.join("komorebi.ahk"); + let config_ahk = dunce::simplified(&config_ahk); + + let script = format!( + r#" + Start-Process '"{ahk}"' '"{config}"' -WindowStyle hidden + "#, + config = config_ahk.display() + ); + + match powershell_script::run(&script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + let static_config = args.config.clone().or_else(|| { + let komorebi_json = HOME_DIR.join("komorebi.json"); + komorebi_json.is_file().then_some(komorebi_json) + }); + + if args.bar { + let mut fallthrough = false; + match static_config { + None => { + fallthrough = true; + } + Some(ref config) => { + let mut config = StaticConfig::read(config)?; + if let Some(display_bar_configurations) = &mut config.bar_configurations + { + for config_file_path in &mut *display_bar_configurations { + let script = format!( + r#"Start-Process "komorebi-bar" '"--config" "{}"' -WindowStyle hidden"#, + config_file_path.to_string_lossy() + ); + + match powershell_script::run(&script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + } else { + fallthrough = true; + } + } + } + + if fallthrough { + let script = r" +if (!(Get-Process komorebi-bar -ErrorAction SilentlyContinue)) +{ + Start-Process komorebi-bar -WindowStyle hidden +} + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + } + + if args.masir { + let script = r" +if (!(Get-Process masir -ErrorAction SilentlyContinue)) +{ + Start-Process masir -WindowStyle hidden +} + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + println!("\nThank you for using komorebi!\n"); + println!("# Commercial Use License"); + println!( + "* View licensing options https://lgug2z.com/software/komorebi - A commercial use license is required to use komorebi at work" + ); + println!("\n# Personal Use Sponsorship"); + println!( + "* Become a sponsor https://github.com/sponsors/LGUG2Z - $5/month makes a big difference" + ); + println!( + "* Leave a tip https://ko-fi.com/lgug2z - An alternative to GitHub Sponsors" + ); + println!("\n# Community"); + println!( + "* Join the Discord https://discord.gg/mGkn66PHkx - Chat, ask questions, share your desktops" + ); + println!( + "* Subscribe to https://youtube.com/@LGUG2Z - Development videos, feature previews and release overviews" + ); + println!( + "* Explore the Awesome Komorebi list https://github.com/LGUG2Z/awesome-komorebi - Projects in the komorebi ecosystem" + ); + println!("\n# Documentation"); + println!( + "* Read the docs https://lgug2z.github.io/komorebi - Quickly search through all komorebic commands" + ); + + let bar_config = args.config.or_else(|| { + let bar_json = HOME_DIR.join("komorebi.bar.json"); + bar_json.is_file().then_some(bar_json) + }); + + if let Some(config) = &static_config { + let raw = std::fs::read_to_string(config)?; + StaticConfig::aliases(&raw); + StaticConfig::deprecated(&raw); + StaticConfig::end_of_life(&raw); + } + + if bar_config.is_some() { + let output = Command::new("komorebi-bar.exe").arg("--aliases").output()?; + let stdout = String::from_utf8(output.stdout)?; + println!("{stdout}"); + } + + let client = reqwest::blocking::Client::new(); + + if let Ok(response) = client + .get("https://api.github.com/repos/LGUG2Z/komorebi/releases/latest") + .header("User-Agent", "komorebic-version-checker") + .send() + { + let version = env!("CARGO_PKG_VERSION"); + + #[derive(Deserialize)] + struct Release { + tag_name: String, + } + + if let Ok(release) = + serde_json::from_str::(&response.text().unwrap_or_default()) + { + let trimmed = release.tag_name.trim_start_matches("v"); + if trimmed > version { + println!( + "An updated version of komorebi is available! https://github.com/LGUG2Z/komorebi/releases/v{trimmed}" + ); + } + } + } + } + WindowsCommands::Stop(args) => { + if args.ahk { + println!( + "EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes" + ); + } + + if args.whkd { + let script = r" +Stop-Process -Name:whkd -ErrorAction SilentlyContinue + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + if args.bar { + let script = r" +Stop-Process -Name:komorebi-bar -ErrorAction SilentlyContinue + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + if args.masir { + let script = r" +Stop-Process -Name:masir -ErrorAction SilentlyContinue + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + if args.ahk { + let script = r#" +if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) { + (Get-CimInstance Win32_Process | Where-Object { + ($_.CommandLine -like '*komorebi.ahk"') -and + ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe', 'AutoHotkeyUX.exe')) + } | Select-Object -First 1) | ForEach-Object { + Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue + } +} else { + (Get-WmiObject Win32_Process | Where-Object { + ($_.CommandLine -like '*komorebi.ahk"') -and + ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe', 'AutoHotkeyUX.exe')) + } | Select-Object -First 1) | ForEach-Object { + Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue + } +} +"#; + + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + send_message(&launcher::stop_message(args.ignore_restore))?; + let mut system = sysinfo::System::new_all(); + system.refresh_processes(ProcessesToUpdate::All, true); + + if system.processes_by_name("komorebi.exe".as_ref()).count() >= 1 { + println!("komorebi is still running, attempting to force-quit"); + + let script = r" +Stop-Process -Name:komorebi -ErrorAction SilentlyContinue + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + + let hwnd_json = DATA_DIR.join("komorebi.hwnd.json"); + + let file = File::open(hwnd_json)?; + let reader = BufReader::new(file); + let hwnds: Vec = serde_json::from_reader(reader)?; + + for hwnd in hwnds { + restore_window(hwnd); + } + } + Err(error) => { + println!("Error: {error}"); + } + } + } + } + WindowsCommands::Kill(args) => { + if args.ahk { + println!( + "EOL: The --ahk flag is now end-of-life and will not receive any further updates or bug fixes" + ); + } + + if args.whkd { + let script = r" +Stop-Process -Name:whkd -ErrorAction SilentlyContinue + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + if args.bar { + let script = r" +Stop-Process -Name:komorebi-bar -ErrorAction SilentlyContinue + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + if args.masir { + let script = r" +Stop-Process -Name:masir -ErrorAction SilentlyContinue + "; + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + + if args.ahk { + let script = r#" +if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) { + (Get-CimInstance Win32_Process | Where-Object { + ($_.CommandLine -like '*komorebi.ahk"') -and + ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe', 'AutoHotkeyUX.exe')) + } | Select-Object -First 1) | ForEach-Object { + Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue + } +} else { + (Get-WmiObject Win32_Process | Where-Object { + ($_.CommandLine -like '*komorebi.ahk"') -and + ($_.Name -in @('AutoHotkey.exe', 'AutoHotkey64.exe', 'AutoHotkey32.exe', 'AutoHotkeyUX.exe')) + } | Select-Object -First 1) | ForEach-Object { + Stop-Process -Id $_.ProcessId -ErrorAction SilentlyContinue + } +} +"#; + + match powershell_script::run(script) { + Ok(_) => { + println!("{script}"); + } + Err(error) => { + println!("Error: {error}"); + } + } + } + } + WindowsCommands::Pan(args) => { + // a flag that has a default counts as given, so what only goes with --stream + // cannot be left to the parser to say + if !args.stream && (args.sensitivity.is_some() || args.reversed || args.paging) { + command::(&META) + .error( + clap::error::ErrorKind::ArgumentConflict, + "--sensitivity, --reversed and --paging can only be used with --stream", + ) + .exit(); + } + + if args.stream { + pan::run( + BufReader::new(io::stdin()), + pan::Options { + sensitivity: args.sensitivity.unwrap_or(1.0), + reversed: args.reversed, + paging: args.paging, + }, + &mut pan::Socket::new(|| komorebi_client::Connection::open().map(PanLink)), + )?; + } else if let Some(direction) = args.direction { + send_message(&SocketMessage::Pan(direction))?; + } + } + WindowsCommands::LayoutRatios(args) => { + if args.columns.is_none() && args.rows.is_none() { + println!( + "No ratios provided, nothing to change. Use --columns or --rows to specify ratios." + ); + } else { + send_message(&SocketMessage::LayoutRatios(args.columns, args.rows))?; + } + } + WindowsCommands::LoadCustomLayout(args) => { + send_message(&SocketMessage::ChangeLayoutCustom(args.path))?; + } + WindowsCommands::MonitorIndexPreference(args) => { + send_message(&SocketMessage::MonitorIndexPreference( + args.index_preference, + args.left, + args.top, + args.right, + args.bottom, + ))?; + } + WindowsCommands::Gui => { + Command::new("komorebi-gui").spawn()?; + } + WindowsCommands::ToggleShortcuts => { + let output = Command::new("taskkill") + .args(["/F", "/IM", "komorebi-shortcuts.exe"]) + .output()?; + + if !output.status.success() { + Command::new("komorebi-shortcuts.exe").spawn()?; + } + } + WindowsCommands::RestoreWindows => { + let hwnd_json = DATA_DIR.join("komorebi.hwnd.json"); + + let file = File::open(hwnd_json)?; + let reader = BufReader::new(file); + let hwnds: Vec = serde_json::from_reader(reader)?; + + for hwnd in hwnds { + restore_window(hwnd); + } + } + WindowsCommands::FocusFollowsMouse(args) => { + send_message(&SocketMessage::FocusFollowsMouse( + args.implementation, + args.boolean_state.into(), + ))?; + } + WindowsCommands::ReloadConfiguration => { + send_message(&SocketMessage::ReloadConfiguration)?; + } + WindowsCommands::WatchConfiguration(args) => { + send_message(&SocketMessage::WatchConfiguration(args.value.into()))?; + } + WindowsCommands::CompleteConfiguration => { + send_message(&SocketMessage::CompleteConfiguration)?; + } + WindowsCommands::IdentifyObjectNameChangeApplication(target) => { + send_message(&SocketMessage::IdentifyObjectNameChangeApplication( + target.identifier, + target.id, + ))?; + } + WindowsCommands::IdentifyTrayApplication(target) => { + send_message(&SocketMessage::IdentifyTrayApplication( + target.identifier, + target.id, + ))?; + } + WindowsCommands::IdentifyLayeredApplication(target) => { + send_message(&SocketMessage::IdentifyLayeredApplication( + target.identifier, + target.id, + ))?; + } + WindowsCommands::RemoveTitleBar(target) => { + match target.identifier { + ApplicationIdentifier::Exe => {} + _ => { + bail!("this command requires applications to be identified by their exe"); + } + } + + send_message(&SocketMessage::RemoveTitleBar(target.identifier, target.id))?; + } + WindowsCommands::ToggleTitleBars => { + send_message(&SocketMessage::ToggleTitleBars)?; + } + WindowsCommands::SubscribePipe(args) => { + send_message(&SocketMessage::AddSubscriberPipe(args.named_pipe))?; + } + WindowsCommands::UnsubscribePipe(args) => { + send_message(&SocketMessage::RemoveSubscriberPipe(args.named_pipe))?; + } + WindowsCommands::BorderStyle(args) => { + send_message(&SocketMessage::BorderStyle(args.style))?; + } + WindowsCommands::BorderImplementation(args) => { + send_message(&SocketMessage::BorderImplementation(args.style))?; + } + WindowsCommands::StackbarMode(args) => { + send_message(&SocketMessage::StackbarMode(args.mode))?; + } + WindowsCommands::Transparency(args) => { + send_message(&SocketMessage::Transparency(args.boolean_state.into()))?; + } + WindowsCommands::TransparencyAlpha(args) => { + send_message(&SocketMessage::TransparencyAlpha(args.alpha))?; + } + WindowsCommands::ToggleTransparency => { + send_message(&SocketMessage::ToggleTransparency)?; + } + + WindowsCommands::WindowHidingBehaviour(args) => { + send_message(&SocketMessage::WindowHidingBehaviour(args.value))?; + } + WindowsCommands::AhkAppSpecificConfiguration(args) => { + let content = std::fs::read_to_string(args.path)?; + let lines = if let Some(override_path) = args.override_path { + let override_content = std::fs::read_to_string(override_path)?; + + ApplicationConfigurationGenerator::generate_ahk( + &content, + Option::from(override_content.as_str()), + )? + } else { + ApplicationConfigurationGenerator::generate_ahk(&content, None)? + }; + + let generated_config = HOME_DIR.join("komorebi.generated.ahk"); + let mut file = OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .open(&generated_config)?; + + file.write_all(lines.join("\n").as_bytes())?; + + println!( + "\nApplication-specific generated configuration written to {}", + generated_config.display() + ); + } + WindowsCommands::PwshAppSpecificConfiguration(args) => { + let content = std::fs::read_to_string(args.path)?; + let lines = if let Some(override_path) = args.override_path { + let override_content = std::fs::read_to_string(override_path)?; + + ApplicationConfigurationGenerator::generate_pwsh( + &content, + Option::from(override_content.as_str()), + )? + } else { + ApplicationConfigurationGenerator::generate_pwsh(&content, None)? + }; + + let generated_config = HOME_DIR.join("komorebi.generated.ps1"); + let mut file = OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .open(&generated_config)?; + + file.write_all(lines.join("\n").as_bytes())?; + + println!( + "\nApplication-specific generated configuration written to {}", + generated_config.display() + ); + } + WindowsCommands::ConvertAppSpecificConfiguration(args) => { + let content = std::fs::read_to_string(args.path)?; + let mut asc = ApplicationConfigurationGenerator::load(&content)?; + asc.sort_by(|a, b| a.name.cmp(&b.name)); + let v2 = ApplicationSpecificConfiguration::from(asc); + println!("{}", serde_json::to_string_pretty(&v2)?); + } + WindowsCommands::FormatAppSpecificConfiguration(args) => { + let content = std::fs::read_to_string(&args.path)?; + let formatted_content = ApplicationConfigurationGenerator::format(&content)?; + + let mut file = OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .open(args.path)?; + + file.write_all(formatted_content.as_bytes())?; + + println!( + "File successfully formatted for PRs to https://github.com/LGUG2Z/komorebi-application-specific-configuration" + ); + } + WindowsCommands::FetchAppSpecificConfiguration => { + let content = reqwest::blocking::get("https://raw.githubusercontent.com/LGUG2Z/komorebi-application-specific-configuration/master/applications.json")? + .text()?; + + let output_file = HOME_DIR.join("applications.json"); + + let mut file = OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .open(&output_file)?; + + file.write_all(content.as_bytes())?; + + println!( + "Latest version of applications.json from https://github.com/LGUG2Z/komorebi-application-specific-configuration downloaded\n" + ); + println!( + "You can add this to your komorebi.json static configuration file like this: \n\n\"app_specific_configuration_path\": \"{}\"", + output_file.display().to_string().replace("\\", "/") + ); + } + WindowsCommands::ApplicationSpecificConfigurationSchema => { + #[cfg(feature = "schemars")] + { + let schema = komorebi_config::schema::view::( + komorebi_config::schema::Platform::CURRENT, + ); + print!("{schema}"); + } + } + WindowsCommands::NotificationSchema => { + #[cfg(feature = "schemars")] + { + let notification = schemars::schema_for!(komorebi_client::Notification); + let schema = serde_json::to_string_pretty(¬ification)?; + println!("{schema}"); + } + } + WindowsCommands::SocketSchema => { + #[cfg(feature = "schemars")] + { + let socket_message = schemars::schema_for!(SocketMessage); + let schema = serde_json::to_string_pretty(&socket_message)?; + println!("{schema}"); + } + } + WindowsCommands::StaticConfigSchema => { + #[cfg(feature = "schemars")] + { + let schema = komorebi_config::schema::view::< + komorebi_config::static_config::StaticConfig, + >(komorebi_config::schema::Platform::CURRENT); + print!("{schema}"); + } + } + WindowsCommands::GenerateStaticConfig => { + print_query(&SocketMessage::GenerateStaticConfig); + } + // Deprecated + #[allow(deprecated)] + WindowsCommands::AltFocusHack(_) + | WindowsCommands::IdentifyBorderOverflowApplication(_) => { + println!("Command deprecated - this is now automatically handled by komorebi! 🎉"); + } + }, + } + + Ok(()) +} + +fn show_window(hwnd: HWND, command: SHOW_WINDOW_CMD) { + // BOOL is returned but does not signify whether or not the operation was succesful + // https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow + // TODO: error handling + unsafe { + let _ = ShowWindow(hwnd, command); + }; +} + +fn remove_transparency(hwnd: isize) { + let _ = komorebi_client::Window::from(hwnd).opaque(); +} + +fn restore_window(hwnd: isize) { + show_window(HWND(hwnd as *mut core::ffi::c_void), SW_RESTORE); + remove_transparency(hwnd); +} diff --git a/komorebi-for-kde/komorebic/tests/check.rs b/komorebic/tests/linux_check.rs similarity index 99% rename from komorebi-for-kde/komorebic/tests/check.rs rename to komorebic/tests/linux_check.rs index f6c4ab8b..799c3b18 100644 --- a/komorebi-for-kde/komorebic/tests/check.rs +++ b/komorebic/tests/linux_check.rs @@ -1,3 +1,4 @@ +#![cfg(target_os = "linux")] //! `komorebic check`, as a person runs it: a configuration in, a report and an exit status out. use std::path::Path; diff --git a/komorebi-for-kde/komorebic/tests/cli.rs b/komorebic/tests/linux_cli.rs similarity index 99% rename from komorebi-for-kde/komorebic/tests/cli.rs rename to komorebic/tests/linux_cli.rs index 8dc9c1a1..24b660e2 100644 --- a/komorebi-for-kde/komorebic/tests/cli.rs +++ b/komorebic/tests/linux_cli.rs @@ -1,3 +1,4 @@ +#![cfg(target_os = "linux")] //! `komorebic` as a person runs it, against a socket the test serves in place of the daemon: what //! each subcommand writes on the socket, and what it prints. @@ -872,18 +873,18 @@ fn quickstart_writes_the_example_files_and_asks_before_it_overwrites_one() { let output = quickstart(&runtime, &home, ""); assert!(output.status.success(), "{output:?}"); - let example = include_str!("../../docs/komorebi.example.json"); + let example = include_str!("../../komorebi-for-kde/docs/komorebi.example.json"); assert_eq!( std::fs::read_to_string(home.join("komorebi.json")).unwrap(), example ); assert_eq!( std::fs::read_to_string(home.join("applications.json")).unwrap(), - include_str!("../applications.json") + include_str!("../src/linux/applications.json") ); assert_eq!( std::fs::read_to_string(home.join("skhdrc")).unwrap(), - include_str!("../../docs/skhdrc.sample") + include_str!("../../komorebi-for-kde/docs/skhdrc.sample") ); assert!(stdout(&output).contains("The following example files were written")); assert!(stdout(&output).contains("komorebic start")); @@ -899,12 +900,12 @@ fn quickstart_writes_the_example_files_and_asks_before_it_overwrites_one() { ); assert_eq!( std::fs::read_to_string(home.join("applications.json")).unwrap(), - include_str!("../applications.json") + include_str!("../src/linux/applications.json") ); // the third question has no answer, which is not a yes assert_eq!( std::fs::read_to_string(home.join("skhdrc")).unwrap(), - include_str!("../../docs/skhdrc.sample") + include_str!("../../komorebi-for-kde/docs/skhdrc.sample") ); assert!(stdout(&output).contains("Skipping")); } @@ -997,7 +998,7 @@ fn the_schema_subcommands_print_a_json_schema_without_a_daemon() { #[test] fn the_schema_files_of_the_repository_are_what_the_subcommands_print() { - let root = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap(); + let root = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().join("komorebi-for-kde"); for (file, subcommand) in [ ("schema.json", "static-config-schema"), diff --git a/komorebi-for-kde/komorebic/tests/hotkeys.rs b/komorebic/tests/linux_hotkeys.rs similarity index 99% rename from komorebi-for-kde/komorebic/tests/hotkeys.rs rename to komorebic/tests/linux_hotkeys.rs index b0c55a67..ee311141 100644 --- a/komorebi-for-kde/komorebic/tests/hotkeys.rs +++ b/komorebic/tests/linux_hotkeys.rs @@ -1,3 +1,4 @@ +#![cfg(target_os = "linux")] //! `export-kde-shortcuts` and `hotkeys compile` as a person runs them: the shortcut files they //! write for a key binding file, what they print, and when they refuse. @@ -77,7 +78,7 @@ fn stderr(output: &Output) -> String { fn fixture(name: &str) -> PathBuf { Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../komorebi-hotkeys/tests/fixtures") + .join("../komorebi-for-kde/komorebi-hotkeys/tests/fixtures") .join(name) } diff --git a/nix/workspace-src.nix b/nix/workspace-src.nix new file mode 100644 index 00000000..a0e8cfed --- /dev/null +++ b/nix/workspace-src.nix @@ -0,0 +1,36 @@ +# The source of a build from the one Cargo workspace of this repository. +# +# Cargo has to load every member of the workspace, but a build of one platform needs the sources of +# that platform's crates only. `real` is the filtered source (the platform's crates, the crates of the +# root workspace they depend on, the root manifest and lock); every other member (`isReal` is false) +# is added as its own manifest with an empty library and a `main` that does nothing. An edit of a +# crate of another platform then changes nothing here, and an edit of another platform's manifest +# changes only the stub copy of it. +# +# workspaceSrc { pkgs; repoRoot; real; isReal = member: bool; } +{ + pkgs, + repoRoot, + real, + isReal, +}: +let + inherit (pkgs) lib; + members = (builtins.fromTOML (builtins.readFile "${real}/Cargo.toml")).workspace.members; + stub = member: '' + mkdir -p $out/${member}/src + cp ${ + builtins.path { + path = repoRoot + "/${member}/Cargo.toml"; + name = "Cargo.toml"; + } + } $out/${member}/Cargo.toml + : > $out/${member}/src/lib.rs + echo 'fn main() {}' > $out/${member}/src/main.rs + ''; +in +pkgs.runCommand "komorebi-workspace-src" { } '' + cp -r ${real} $out + chmod -R u+w $out + ${lib.concatMapStrings stub (builtins.filter (m: !(isReal m)) members)} +''