mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-02-15 09:47:40 +01:00
Compare commits
4 Commits
dependabot
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bed314b866 | ||
|
|
c165172b5a | ||
|
|
9977cca500 | ||
|
|
5d7a0ea9ad |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.json text diff
|
||||
629
Cargo.lock
generated
629
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,7 @@ tracing-appender = "0.2"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
parking_lot = "0.12"
|
||||
paste = "1"
|
||||
sysinfo = "0.37"
|
||||
sysinfo = "0.38"
|
||||
uds_windows = "1"
|
||||
win32-display-data = { git = "https://github.com/LGUG2Z/win32-display-data", rev = "8c42d8db257d30fe95bc98c2e5cd8f75da861021" }
|
||||
windows-numerics = { version = "0.3" }
|
||||
|
||||
@@ -424,7 +424,7 @@ every `WindowManagerEvent` and `SocketMessage` handled by `komorebi` in a Rust c
|
||||
Below is a simple example of how to use `komorebi-client` in a basic Rust application.
|
||||
|
||||
```rust
|
||||
// komorebi-client = { git = "https://github.com/LGUG2Z/komorebi", tag = "v0.1.39"}
|
||||
// komorebi-client = { git = "https://github.com/LGUG2Z/komorebi" }
|
||||
|
||||
use anyhow::Result;
|
||||
use komorebi_client::Notification;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"anstyle-parse 0.2.7 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"anstyle-query 1.1.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"anstyle-wincon 3.0.11 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"anyhow 1.0.100 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"anyhow 1.0.101 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"approx 0.3.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"arboard 3.6.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"arrayvec 0.7.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -41,20 +41,20 @@
|
||||
"beef 0.5.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bit_field 0.10.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitflags 1.3.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitflags 2.10.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitflags 2.11.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitstream-io 4.9.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"block-buffer 0.10.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bytemuck 1.25.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bytemuck_derive 1.10.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cc 1.2.55 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cc 1.2.56 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cfg-if 0.1.10 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cfg-if 1.0.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"chrono 0.4.43 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"chrono-tz 0.10.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap 4.5.57 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_builder 4.5.57 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap 4.5.58 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_builder 4.5.58 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_derive 4.5.55 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_lex 0.7.7 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_lex 1.0.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"color-eyre 0.6.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"color-spantrace 0.3.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"colorchoice 1.0.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -70,7 +70,7 @@
|
||||
"cursor-icon 1.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"curve25519-dalek-derive 0.1.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"deflate 0.8.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"deranged 0.5.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"deranged 0.5.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"digest 0.10.7 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"dirs 3.0.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"dirs 4.0.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -119,6 +119,7 @@
|
||||
"getrandom 0.1.16 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"getrandom 0.2.17 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"getrandom 0.3.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"getrandom 0.4.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"gif 0.11.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"gif 0.14.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"git2 0.20.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -160,7 +161,7 @@
|
||||
"jpeg-decoder 0.1.22 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"khronos_api 3.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"lazy_static 1.5.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libc 0.2.180 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libc 0.2.182 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libgit2-sys 0.18.3+1.9.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libz-sys 1.1.23 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"linked-hash-map 0.5.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -178,10 +179,10 @@
|
||||
"miniz_oxide 0.8.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"miow 0.6.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"moxcms 0.7.11 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"native-tls 0.2.14 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"native-tls 0.2.16 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"net2 0.2.39 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"nohash-hasher 0.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ntapi 0.4.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ntapi 0.4.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"num 0.4.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"num-bigint 0.4.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"num-complex 0.4.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -207,13 +208,13 @@
|
||||
"pin-utils 0.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"pkg-config 0.3.32 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"png 0.16.8 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"png 0.18.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"png 0.18.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"powerfmt 0.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ppv-lite86 0.2.21 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"proc-macro2 1.0.106 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"profiling 1.0.17 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"profiling-procmacros 1.0.17 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"psm 0.1.29 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"psm 0.1.30 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"pxfm 0.1.27 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"qoi 0.4.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"quick-error 2.0.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -241,7 +242,7 @@
|
||||
"rustc-demangle 0.1.27 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"rustc_version 0.4.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"rustls-pki-types 1.14.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ryu 1.0.22 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ryu 1.0.23 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"scopeguard 1.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"semver 1.0.27 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"serde 1.0.228 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -268,20 +269,20 @@
|
||||
"smol_str 0.2.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"socket2 0.6.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"stable_deref_trait 1.2.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"stacker 0.1.22 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"stacker 0.1.23 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"static_assertions 1.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"supports-color 3.0.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"supports-hyperlinks 3.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"supports-unicode 3.0.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"syn 1.0.109 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"syn 2.0.114 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"syn 2.0.115 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"sync_wrapper 1.0.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tempfile 3.24.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tempfile 3.25.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"terminal_size 0.4.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thiserror 2.0.18 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thiserror-impl 2.0.18 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thread_local 1.1.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"time 0.3.46 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"time 0.3.47 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"time-core 0.1.8 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"toml 0.5.11 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ttf-parser 0.25.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -290,7 +291,7 @@
|
||||
"tzdb 0.7.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tzdb_data 0.2.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicase 2.9.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-ident 1.0.22 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-ident 1.0.23 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-linebreak 0.1.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-segmentation 1.12.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-width 0.1.14 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -303,7 +304,7 @@
|
||||
"vcpkg 0.2.15 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"version_check 0.9.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"web-time 1.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"webbrowser 1.0.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"webbrowser 1.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"weezl 0.1.12 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"win-msgbox 0.2.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"winapi 0.3.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -366,8 +367,8 @@
|
||||
"winit 0.30.12 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"wmi 0.15.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"yaml-rust 0.4.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy 0.8.38 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy-derive 0.8.38 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy 0.8.39 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy-derive 0.8.39 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zeroize 1.8.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zune-core 0.4.12 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zune-core 0.5.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -395,8 +396,8 @@
|
||||
"av1-grain 0.2.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"rav1e 0.8.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"v_frame 0.3.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy 0.8.38 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy-derive 0.8.38 registry+https://github.com/rust-lang/crates.io-index"
|
||||
"zerocopy 0.8.39 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy-derive 0.8.39 registry+https://github.com/rust-lang/crates.io-index"
|
||||
]
|
||||
],
|
||||
[
|
||||
@@ -404,7 +405,7 @@
|
||||
[
|
||||
"alloc-no-stdlib 2.0.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"alloc-stdlib 0.2.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"avif-serialize 0.8.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"avif-serialize 0.8.8 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"brotli 8.0.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"brotli-decompressor 5.0.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"curve25519-dalek 4.1.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -423,7 +424,7 @@
|
||||
[
|
||||
"clipboard-win 5.4.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"error-code 3.3.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ryu 1.0.22 registry+https://github.com/rust-lang/crates.io-index"
|
||||
"ryu 1.0.23 registry+https://github.com/rust-lang/crates.io-index"
|
||||
]
|
||||
],
|
||||
[
|
||||
@@ -462,7 +463,7 @@
|
||||
"anstyle-parse 0.2.7 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"anstyle-query 1.1.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"anstyle-wincon 3.0.11 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"anyhow 1.0.100 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"anyhow 1.0.101 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"arboard 3.6.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"arg_enum_proc_macro 0.3.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"arrayvec 0.7.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -477,7 +478,7 @@
|
||||
"beef 0.5.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bit_field 0.10.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitflags 1.3.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitflags 2.10.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitflags 2.11.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitstream-io 4.9.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"block-buffer 0.10.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"brotli 8.0.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -491,17 +492,17 @@
|
||||
"calm_io 0.1.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"calmio_filters 0.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"catppuccin-egui 5.6.0 git+https://github.com/LGUG2Z/catppuccin-egui?rev=b2f95cbf441d1dd99f3c955ef10dcb84ce23c20a",
|
||||
"cc 1.2.55 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cc 1.2.56 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cfg-if 0.1.10 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cfg-if 1.0.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cfg_aliases 0.2.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"chrono 0.4.43 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"chrono-tz 0.10.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"chumsky 0.9.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap 4.5.57 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_builder 4.5.57 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap 4.5.58 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_builder 4.5.58 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_derive 4.5.55 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_lex 0.7.7 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"clap_lex 1.0.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"color-eyre 0.6.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"color-spantrace 0.3.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"color-thief 0.2.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -522,7 +523,7 @@
|
||||
"darling_core 0.21.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"darling_macro 0.21.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"deflate 0.8.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"deranged 0.5.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"deranged 0.5.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"digest 0.10.7 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"dirs 3.0.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"dirs 4.0.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -578,6 +579,7 @@
|
||||
"getrandom 0.1.16 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"getrandom 0.2.17 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"getrandom 0.3.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"getrandom 0.4.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"gif 0.11.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"gif 0.14.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"git2 0.20.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -620,7 +622,7 @@
|
||||
"jobserver 0.1.34 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"jpeg-decoder 0.1.22 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"lazy_static 1.5.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libc 0.2.180 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libc 0.2.182 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libgit2-sys 0.18.3+1.9.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libz-sys 1.1.23 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"linked-hash-map 0.5.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -634,7 +636,7 @@
|
||||
"mac-addr 0.3.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"matchers 0.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"maybe-rayon 0.1.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"memchr 2.7.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"memchr 2.8.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"memoffset 0.9.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"mime 0.3.17 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"mime_guess2 2.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -645,7 +647,7 @@
|
||||
"mio 1.1.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"miow 0.6.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"nanoid 0.4.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"native-tls 0.2.14 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"native-tls 0.2.16 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"net2 0.2.39 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"netdev 0.40.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"new_debug_unreachable 1.0.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -653,7 +655,7 @@
|
||||
"nom 7.1.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"nom 8.0.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"noop_proc_macro 0.3.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ntapi 0.4.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ntapi 0.4.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"nu-ansi-term 0.50.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"num 0.4.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"num-bigint 0.4.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -690,14 +692,14 @@
|
||||
"pin-utils 0.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"pkg-config 0.3.32 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"png 0.16.8 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"png 0.18.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"png 0.18.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"powerfmt 0.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"powershell_script 1.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ppv-lite86 0.2.21 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"proc-macro2 1.0.106 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"profiling 1.0.17 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"profiling-procmacros 1.0.17 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"psm 0.1.29 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"psm 0.1.30 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"qoi 0.4.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"quick-error 2.0.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"quote 1.0.44 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -761,17 +763,17 @@
|
||||
"smol_str 0.2.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"socket2 0.6.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"stable_deref_trait 1.2.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"stacker 0.1.22 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"stacker 0.1.23 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"static_assertions 1.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"strsim 0.11.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"strum 0.27.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"strum_macros 0.27.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"syn 1.0.109 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"syn 2.0.114 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"syn 2.0.115 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"synstructure 0.13.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"sysinfo 0.33.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"sysinfo 0.37.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tempfile 3.24.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"sysinfo 0.38.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tempfile 3.25.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"terminal_size 0.4.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"textwrap 0.16.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thiserror 2.0.18 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -779,7 +781,7 @@
|
||||
"thread_local 1.1.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tiff 0.10.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tiff 0.6.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"time 0.3.46 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"time 0.3.47 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"time-core 0.1.8 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tokio 1.49.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tokio-native-tls 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -803,7 +805,7 @@
|
||||
"tzdb_data 0.2.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"uds_windows 1.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicase 2.9.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-ident 1.0.22 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-ident 1.0.23 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-segmentation 1.12.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-width 0.1.14 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-width 0.2.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -818,7 +820,7 @@
|
||||
"walkdir 2.5.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"want 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"web-time 1.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"webbrowser 1.0.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"webbrowser 1.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"weezl 0.1.12 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"which 8.0.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"win-msgbox 0.2.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -889,10 +891,10 @@
|
||||
"xml-rs 0.8.28 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"y4m 0.8.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"yaml-rust 0.4.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy 0.8.38 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy-derive 0.8.38 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy 0.8.39 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zerocopy-derive 0.8.39 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zeroize 1.8.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zmij 1.0.19 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zmij 1.0.21 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zune-core 0.4.12 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zune-core 0.5.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"zune-inflate 0.2.54 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -939,7 +941,7 @@
|
||||
"litemap 0.8.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"potential_utf 0.1.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tinystr 0.8.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-ident 1.0.22 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-ident 1.0.23 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"writeable 0.6.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"yoke 0.8.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"yoke-derive 0.8.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
@@ -956,7 +958,7 @@
|
||||
"aho-corasick 1.1.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"byteorder 1.5.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"byteorder-lite 0.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"memchr 2.7.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"memchr 2.8.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"same-file 1.0.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"walkdir 2.5.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"winapi-util 0.1.11 registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
@@ -621,6 +621,26 @@ extend_enum!(
|
||||
AllIconsAndTextOnSelected,
|
||||
});
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
/// Media widget display format
|
||||
pub enum MediaDisplayFormat {
|
||||
/// Show only the media info icon
|
||||
Icon,
|
||||
/// Show only the media info text (artist - title)
|
||||
Text,
|
||||
/// Show both icon and text
|
||||
IconAndText,
|
||||
/// Show only the control buttons (previous, play/pause, next)
|
||||
ControlsOnly,
|
||||
/// Show icon with control buttons
|
||||
IconAndControls,
|
||||
/// Show text with control buttons
|
||||
TextAndControls,
|
||||
/// Show icon, text, and control buttons
|
||||
Full,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde::Deserialize;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
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;
|
||||
@@ -14,6 +16,7 @@ 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))]
|
||||
@@ -21,24 +24,31 @@ use windows::Media::Control::GlobalSystemMediaTransportControlsSessionManager;
|
||||
pub struct MediaConfig {
|
||||
/// Enable the Media widget
|
||||
pub enable: bool,
|
||||
/// Display format of the media widget (defaults to IconAndText)
|
||||
pub display: Option<MediaDisplayFormat>,
|
||||
}
|
||||
|
||||
impl From<MediaConfig> for Media {
|
||||
fn from(value: MediaConfig) -> Self {
|
||||
Self::new(value.enable)
|
||||
Self::new(
|
||||
value.enable,
|
||||
value.display.unwrap_or(MediaDisplayFormat::IconAndText),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Media {
|
||||
pub enable: bool,
|
||||
pub display: MediaDisplayFormat,
|
||||
pub session_manager: GlobalSystemMediaTransportControlsSessionManager,
|
||||
}
|
||||
|
||||
impl Media {
|
||||
pub fn new(enable: bool) -> Self {
|
||||
pub fn new(enable: bool, display: MediaDisplayFormat) -> Self {
|
||||
Self {
|
||||
enable,
|
||||
display,
|
||||
session_manager: GlobalSystemMediaTransportControlsSessionManager::RequestAsync()
|
||||
.unwrap()
|
||||
.join()
|
||||
@@ -54,6 +64,58 @@ impl Media {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn previous(&self) {
|
||||
if let Ok(session) = self.session_manager.GetCurrentSession()
|
||||
&& let Ok(op) = session.TrySkipPreviousAsync()
|
||||
{
|
||||
op.join().unwrap_or_default();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn next(&self) {
|
||||
if let Ok(session) = self.session_manager.GetCurrentSession()
|
||||
&& let Ok(op) = session.TrySkipNextAsync()
|
||||
{
|
||||
op.join().unwrap_or_default();
|
||||
}
|
||||
}
|
||||
|
||||
fn is_playing(&self) -> bool {
|
||||
if let Ok(session) = self.session_manager.GetCurrentSession()
|
||||
&& let Ok(info) = session.GetPlaybackInfo()
|
||||
&& let Ok(status) = info.PlaybackStatus()
|
||||
{
|
||||
return status == GlobalSystemMediaTransportControlsSessionPlaybackStatus::Playing;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn is_previous_enabled(&self) -> bool {
|
||||
if let Ok(session) = self.session_manager.GetCurrentSession()
|
||||
&& let Ok(info) = session.GetPlaybackInfo()
|
||||
&& let Ok(controls) = info.Controls()
|
||||
&& let Ok(enabled) = controls.IsPreviousEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn is_next_enabled(&self) -> bool {
|
||||
if let Ok(session) = self.session_manager.GetCurrentSession()
|
||||
&& let Ok(info) = session.GetPlaybackInfo()
|
||||
&& let Ok(controls) = info.Controls()
|
||||
&& let Ok(enabled) = controls.IsNextEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn has_session(&self) -> bool {
|
||||
self.session_manager.GetCurrentSession().is_ok()
|
||||
}
|
||||
|
||||
fn output(&mut self) -> String {
|
||||
if let Ok(session) = self.session_manager.GetCurrentSession()
|
||||
&& let Ok(operation) = session.TryGetMediaPropertiesAsync()
|
||||
@@ -78,28 +140,96 @@ impl Media {
|
||||
impl BarWidget for Media {
|
||||
fn render(&mut self, ctx: &Context, ui: &mut Ui, config: &mut RenderConfig) {
|
||||
if self.enable {
|
||||
// Don't render if there's no active media session
|
||||
if !self.has_session() {
|
||||
return;
|
||||
}
|
||||
|
||||
let output = self.output();
|
||||
if !output.is_empty() {
|
||||
let mut layout_job = LayoutJob::simple(
|
||||
|
||||
let show_icon = matches!(
|
||||
self.display,
|
||||
MediaDisplayFormat::Icon
|
||||
| MediaDisplayFormat::IconAndText
|
||||
| MediaDisplayFormat::IconAndControls
|
||||
| MediaDisplayFormat::Full
|
||||
);
|
||||
let show_text = matches!(
|
||||
self.display,
|
||||
MediaDisplayFormat::Text
|
||||
| MediaDisplayFormat::IconAndText
|
||||
| MediaDisplayFormat::TextAndControls
|
||||
| MediaDisplayFormat::Full
|
||||
);
|
||||
let show_controls = matches!(
|
||||
self.display,
|
||||
MediaDisplayFormat::ControlsOnly
|
||||
| MediaDisplayFormat::IconAndControls
|
||||
| MediaDisplayFormat::TextAndControls
|
||||
| MediaDisplayFormat::Full
|
||||
);
|
||||
|
||||
// Don't render if there's no media info and we're not showing controls-only
|
||||
if output.is_empty() && !show_controls {
|
||||
return;
|
||||
}
|
||||
|
||||
let icon_font_id = config.icon_font_id.clone();
|
||||
let text_font_id = config.text_font_id.clone();
|
||||
let icon_color = ctx.style().visuals.selection.stroke.color;
|
||||
let text_color = ctx.style().visuals.text_color();
|
||||
|
||||
let mut layout_job = LayoutJob::default();
|
||||
|
||||
if show_icon {
|
||||
layout_job = LayoutJob::simple(
|
||||
egui_phosphor::regular::HEADPHONES.to_string(),
|
||||
config.icon_font_id.clone(),
|
||||
ctx.style().visuals.selection.stroke.color,
|
||||
icon_font_id.clone(),
|
||||
icon_color,
|
||||
100.0,
|
||||
);
|
||||
}
|
||||
|
||||
if show_text {
|
||||
layout_job.append(
|
||||
&output,
|
||||
10.0,
|
||||
if show_icon { 10.0 } else { 0.0 },
|
||||
TextFormat {
|
||||
font_id: config.text_font_id.clone(),
|
||||
color: ctx.style().visuals.text_color(),
|
||||
font_id: text_font_id,
|
||||
color: text_color,
|
||||
valign: Align::Center,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
config.apply_on_widget(false, ui, |ui| {
|
||||
if SelectableFrame::new(false)
|
||||
let is_playing = self.is_playing();
|
||||
let is_previous_enabled = self.is_previous_enabled();
|
||||
let is_next_enabled = self.is_next_enabled();
|
||||
let disabled_color = text_color.gamma_multiply(0.5);
|
||||
let is_reversed = matches!(config.alignment, Some(Alignment::Right));
|
||||
|
||||
let prev_color = if is_previous_enabled {
|
||||
text_color
|
||||
} else {
|
||||
disabled_color
|
||||
};
|
||||
|
||||
let next_color = if is_next_enabled {
|
||||
text_color
|
||||
} else {
|
||||
disabled_color
|
||||
};
|
||||
|
||||
let play_pause_icon = if is_playing {
|
||||
egui_phosphor::regular::PAUSE
|
||||
} else {
|
||||
egui_phosphor::regular::PLAY
|
||||
};
|
||||
|
||||
let show_label = |ui: &mut Ui| {
|
||||
if (show_icon || show_text)
|
||||
&& SelectableFrame::new(false)
|
||||
.show(ui, |ui| {
|
||||
let available_height = ui.available_height();
|
||||
let mut custom_ui = CustomUi(ui);
|
||||
@@ -109,15 +239,95 @@ impl BarWidget for Media {
|
||||
MAX_LABEL_WIDTH.load(Ordering::SeqCst) as f32,
|
||||
available_height,
|
||||
),
|
||||
Label::new(layout_job).selectable(false).truncate(),
|
||||
Label::new(layout_job.clone()).selectable(false).truncate(),
|
||||
)
|
||||
})
|
||||
.on_hover_text(&output)
|
||||
.clicked()
|
||||
{
|
||||
self.toggle();
|
||||
{
|
||||
self.toggle();
|
||||
}
|
||||
};
|
||||
|
||||
let show_previous = |ui: &mut Ui| {
|
||||
if SelectableFrame::new(false)
|
||||
.show(ui, |ui| {
|
||||
ui.add(
|
||||
Label::new(LayoutJob::simple(
|
||||
egui_phosphor::regular::SKIP_BACK.to_string(),
|
||||
icon_font_id.clone(),
|
||||
prev_color,
|
||||
100.0,
|
||||
))
|
||||
.selectable(false),
|
||||
)
|
||||
})
|
||||
.clicked()
|
||||
&& is_previous_enabled
|
||||
{
|
||||
self.previous();
|
||||
}
|
||||
};
|
||||
|
||||
let show_play_pause = |ui: &mut Ui| {
|
||||
if SelectableFrame::new(false)
|
||||
.show(ui, |ui| {
|
||||
ui.add(
|
||||
Label::new(LayoutJob::simple(
|
||||
play_pause_icon.to_string(),
|
||||
icon_font_id.clone(),
|
||||
text_color,
|
||||
100.0,
|
||||
))
|
||||
.selectable(false),
|
||||
)
|
||||
})
|
||||
.on_hover_text(&output)
|
||||
.clicked()
|
||||
{
|
||||
self.toggle();
|
||||
}
|
||||
};
|
||||
|
||||
let show_next = |ui: &mut Ui| {
|
||||
if SelectableFrame::new(false)
|
||||
.show(ui, |ui| {
|
||||
ui.add(
|
||||
Label::new(LayoutJob::simple(
|
||||
egui_phosphor::regular::SKIP_FORWARD.to_string(),
|
||||
icon_font_id.clone(),
|
||||
next_color,
|
||||
100.0,
|
||||
))
|
||||
.selectable(false),
|
||||
)
|
||||
})
|
||||
.clicked()
|
||||
&& is_next_enabled
|
||||
{
|
||||
self.next();
|
||||
}
|
||||
};
|
||||
|
||||
config.apply_on_widget(false, ui, |ui| {
|
||||
if is_reversed {
|
||||
// Right panel renders right-to-left, so reverse order
|
||||
if show_controls {
|
||||
show_next(ui);
|
||||
show_play_pause(ui);
|
||||
show_previous(ui);
|
||||
}
|
||||
});
|
||||
}
|
||||
show_label(ui);
|
||||
} else {
|
||||
// Left/center panel renders left-to-right, normal order
|
||||
show_label(ui);
|
||||
if show_controls {
|
||||
show_previous(ui);
|
||||
show_play_pause(ui);
|
||||
show_next(ui);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,36 @@ pub const DEFAULT_RATIO: f32 = 0.5;
|
||||
/// Default secondary ratio value for UltrawideVerticalStack layout
|
||||
pub const DEFAULT_SECONDARY_RATIO: f32 = 0.25;
|
||||
|
||||
/// Validates and converts a Vec of ratios into a fixed-size array.
|
||||
/// - Clamps values to MIN_RATIO..MAX_RATIO range
|
||||
/// - Truncates when cumulative sum reaches or exceeds 1.0
|
||||
/// - Limits to MAX_RATIOS values
|
||||
#[must_use]
|
||||
pub fn validate_ratios(ratios: &[f32]) -> [Option<f32>; MAX_RATIOS] {
|
||||
let mut arr = [None; MAX_RATIOS];
|
||||
let mut cumulative_sum = 0.0_f32;
|
||||
|
||||
for (i, &val) in ratios.iter().take(MAX_RATIOS).enumerate() {
|
||||
let clamped_val = val.clamp(MIN_RATIO, MAX_RATIO);
|
||||
|
||||
// Only add this ratio if cumulative sum stays below 1.0
|
||||
if cumulative_sum + clamped_val < 1.0 {
|
||||
arr[i] = Some(clamped_val);
|
||||
cumulative_sum += clamped_val;
|
||||
} else {
|
||||
// Stop adding ratios - cumulative sum would reach or exceed 1.0
|
||||
tracing::debug!(
|
||||
"Truncating ratios at index {} - cumulative sum {} + {} would reach/exceed 1.0",
|
||||
i,
|
||||
cumulative_sum,
|
||||
clamped_val
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
arr
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Serialize, Deserialize, Eq, PartialEq, Display, EnumString, ValueEnum,
|
||||
)]
|
||||
@@ -137,30 +167,7 @@ where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
let opt: Option<Vec<f32>> = Option::deserialize(deserializer)?;
|
||||
Ok(opt.map(|vec| {
|
||||
let mut arr = [None; MAX_RATIOS];
|
||||
let mut cumulative_sum = 0.0_f32;
|
||||
|
||||
for (i, &val) in vec.iter().take(MAX_RATIOS).enumerate() {
|
||||
let clamped_val = val.clamp(MIN_RATIO, MAX_RATIO);
|
||||
|
||||
// Only add this ratio if cumulative sum stays below 1.0
|
||||
if cumulative_sum + clamped_val < 1.0 {
|
||||
arr[i] = Some(clamped_val);
|
||||
cumulative_sum += clamped_val;
|
||||
} else {
|
||||
// Stop adding ratios - cumulative sum would reach or exceed 1.0
|
||||
tracing::debug!(
|
||||
"Truncating ratios at index {} - cumulative sum {} + {} would reach/exceed 1.0",
|
||||
i,
|
||||
cumulative_sum,
|
||||
clamped_val
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
arr
|
||||
}))
|
||||
Ok(opt.map(|vec| validate_ratios(&vec)))
|
||||
}
|
||||
|
||||
/// Helper to serialize [Option<f32>; MAX_RATIOS] as a compact array (without trailing nulls)
|
||||
|
||||
@@ -39,6 +39,7 @@ pub use komorebi_layouts::OperationDirection;
|
||||
pub use komorebi_layouts::Rect;
|
||||
pub use komorebi_layouts::ScrollingLayoutOptions;
|
||||
pub use komorebi_layouts::Sizing;
|
||||
pub use komorebi_layouts::validate_ratios;
|
||||
|
||||
// Local modules and exports
|
||||
pub use animation::AnimationStyle;
|
||||
@@ -118,6 +119,7 @@ pub enum SocketMessage {
|
||||
AdjustWorkspacePadding(Sizing, i32),
|
||||
ChangeLayout(DefaultLayout),
|
||||
CycleLayout(CycleDirection),
|
||||
LayoutRatios(Option<Vec<f32>>, Option<Vec<f32>>),
|
||||
ScrollingLayoutColumns(NonZeroUsize),
|
||||
ChangeLayoutCustom(#[serde_as(as = "ResolvedPathBuf")] PathBuf),
|
||||
FlipLayout(Axis),
|
||||
|
||||
@@ -957,6 +957,29 @@ impl WindowManager {
|
||||
}
|
||||
SocketMessage::ChangeLayout(layout) => self.change_workspace_layout_default(layout)?,
|
||||
SocketMessage::CycleLayout(direction) => self.cycle_layout(direction)?,
|
||||
SocketMessage::LayoutRatios(ref columns, ref rows) => {
|
||||
use crate::core::validate_ratios;
|
||||
|
||||
let focused_workspace = self.focused_workspace_mut()?;
|
||||
|
||||
let mut options = focused_workspace.layout_options.unwrap_or(LayoutOptions {
|
||||
scrolling: None,
|
||||
grid: None,
|
||||
column_ratios: None,
|
||||
row_ratios: None,
|
||||
});
|
||||
|
||||
if let Some(cols) = columns {
|
||||
options.column_ratios = Some(validate_ratios(cols));
|
||||
}
|
||||
|
||||
if let Some(rws) = rows {
|
||||
options.row_ratios = Some(validate_ratios(rws));
|
||||
}
|
||||
|
||||
focused_workspace.layout_options = Some(options);
|
||||
self.update_focused_workspace(false, false)?;
|
||||
}
|
||||
SocketMessage::ChangeLayoutCustom(ref path) => {
|
||||
self.change_workspace_custom_layout(path)?;
|
||||
}
|
||||
|
||||
@@ -1919,7 +1919,7 @@ mod tests {
|
||||
let docs = vec![
|
||||
"0.1.20", "0.1.21", "0.1.22", "0.1.23", "0.1.24", "0.1.25", "0.1.26", "0.1.27",
|
||||
"0.1.28", "0.1.29", "0.1.30", "0.1.31", "0.1.32", "0.1.33", "0.1.34", "0.1.35",
|
||||
"0.1.36", "0.1.37", "0.1.38",
|
||||
"0.1.36", "0.1.37", "0.1.38", "0.1.39",
|
||||
];
|
||||
|
||||
let mut versions = vec![];
|
||||
|
||||
@@ -1001,6 +1001,16 @@ struct ScrollingLayoutColumns {
|
||||
count: NonZeroUsize,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
struct LayoutRatios {
|
||||
/// Column width ratios (space-separated values between 0.1 and 0.9)
|
||||
#[clap(short, long, num_args = 1..)]
|
||||
columns: Option<Vec<f32>>,
|
||||
/// Row height ratios (space-separated values between 0.1 and 0.9)
|
||||
#[clap(short, long, num_args = 1..)]
|
||||
rows: Option<Vec<f32>>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
struct License {
|
||||
/// Email address associated with an Individual Commercial Use License
|
||||
@@ -1267,6 +1277,8 @@ enum SubCommand {
|
||||
/// Set the number of visible columns for the Scrolling layout on the focused workspace
|
||||
#[clap(arg_required_else_help = true)]
|
||||
ScrollingLayoutColumns(ScrollingLayoutColumns),
|
||||
/// 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)]
|
||||
@@ -2934,6 +2946,15 @@ if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) {
|
||||
SubCommand::ScrollingLayoutColumns(args) => {
|
||||
send_message(&SocketMessage::ScrollingLayoutColumns(args.count))?;
|
||||
}
|
||||
SubCommand::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))?;
|
||||
}
|
||||
}
|
||||
SubCommand::LoadCustomLayout(args) => {
|
||||
send_message(&SocketMessage::ChangeLayoutCustom(args.path))?;
|
||||
}
|
||||
|
||||
@@ -3863,6 +3863,17 @@
|
||||
"description": "Media widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display": {
|
||||
"description": "Display format of the media widget (defaults to IconAndText)",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/$defs/MediaDisplayFormat"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"enable": {
|
||||
"description": "Enable the Media widget",
|
||||
"type": "boolean"
|
||||
@@ -3872,6 +3883,46 @@
|
||||
"enable"
|
||||
]
|
||||
},
|
||||
"MediaDisplayFormat": {
|
||||
"description": "Media widget display format",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "Show only the media info icon",
|
||||
"type": "string",
|
||||
"const": "Icon"
|
||||
},
|
||||
{
|
||||
"description": "Show only the media info text (artist - title)",
|
||||
"type": "string",
|
||||
"const": "Text"
|
||||
},
|
||||
{
|
||||
"description": "Show both icon and text",
|
||||
"type": "string",
|
||||
"const": "IconAndText"
|
||||
},
|
||||
{
|
||||
"description": "Show only the control buttons (previous, play/pause, next)",
|
||||
"type": "string",
|
||||
"const": "ControlsOnly"
|
||||
},
|
||||
{
|
||||
"description": "Show icon with control buttons",
|
||||
"type": "string",
|
||||
"const": "IconAndControls"
|
||||
},
|
||||
{
|
||||
"description": "Show text with control buttons",
|
||||
"type": "string",
|
||||
"const": "TextAndControls"
|
||||
},
|
||||
{
|
||||
"description": "Show icon, text, and control buttons",
|
||||
"type": "string",
|
||||
"const": "Full"
|
||||
}
|
||||
]
|
||||
},
|
||||
"MemoryConfig": {
|
||||
"description": "Memory widget configuration",
|
||||
"type": "object",
|
||||
@@ -5366,6 +5417,46 @@
|
||||
"content"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content": {
|
||||
"type": "array",
|
||||
"maxItems": 2,
|
||||
"minItems": 2,
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"items": {
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "LayoutRatios"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"content"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user