From c22b8a14538ce8156b524a62a9cdb8c3dc22fed9 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 15 Jul 2023 12:04:07 +0800 Subject: [PATCH 01/25] frameworkd: Add scaffold Signed-off-by: Daniel Schaefer --- .github/workflows/ci.yml | 20 +++++++++++++++++++- Cargo.lock | 7 +++++++ Cargo.toml | 2 ++ README.md | 4 ++++ frameworkd/Cargo.toml | 7 +++++++ frameworkd/src/main.rs | 12 ++++++++++++ 6 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 frameworkd/Cargo.toml create mode 100644 frameworkd/src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dad703ac..22dc5f49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,9 @@ jobs: - name: Build Linux tool run: cargo build -p framework_tool + - name: Build Linux daemon + run: cargo build -p frameworkd + - name: Check if Linux tool can start run: cargo run -- --help @@ -55,6 +58,12 @@ jobs: name: framework_tool_debug path: target/debug/framework_tool + - name: Upload Linux Daemon + uses: actions/upload-artifact@v7 + with: + name: frameworkd + path: target/debug/frameworkd + - name: Build Linux tool (Release) run: cargo build -p framework_tool --release --features nvidia,smartmontools @@ -145,6 +154,9 @@ jobs: cargo build -p framework_tool cargo build -p framework_tool --release --features nvidia,smartmontools + - name: Build Windows daemon + run: cargo build -p frameworkd + - name: Check if Windows tool can start run: target/release/framework_tool.exe --help @@ -168,6 +180,12 @@ jobs: name: framework_tool.exe path: target/release/framework_tool.exe + - name: Upload Windows Daemon + uses: actions/upload-artifact@v7 + with: + name: frameworkd.exe + path: target/debug/frameworkd.exe + test: name: Test Suite @@ -209,7 +227,7 @@ jobs: run: cargo fmt --all -- --check - name: Run cargo clippy - run: cargo clippy -p framework_lib -p framework_tool -- -D warnings + run: cargo clippy -p framework_lib -p framework_tool -p frameworkd -- -D warnings - name: Check shell completions are up to date run: | diff --git a/Cargo.lock b/Cargo.lock index 776a6be1..45690bf0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -483,6 +483,13 @@ dependencies = [ "uefi", ] +[[package]] +name = "frameworkd" +version = "0.1.0" +dependencies = [ + "framework_lib", +] + [[package]] name = "futures-core" version = "0.3.34" diff --git a/Cargo.toml b/Cargo.toml index 66801a46..c7daf453 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,8 @@ resolver = "2" members = [ # Linux and Windows tool to inspect and customize the system "framework_tool", + # Linux and Windows daemon to watch for system changes and handle them + "frameworkd", # UEFI tool to inspect and customize the system "framework_uefi", # Catchall library that we'll probably want to split up further diff --git a/README.md b/README.md index 7cc2de5f..2c1861eb 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,10 @@ cargo build -p framework_lib cargo build -p framework_tool ls -l target/debug/framework_tool +# Building only the daemon +cargo build -p frameworkd +ls -l target/debug/frameworkd + # Build the UEFI application # Can't be built with cargo! That's why we need to exclude it in the other commands. make -C framework_uefi diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml new file mode 100644 index 00000000..48d67426 --- /dev/null +++ b/frameworkd/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "frameworkd" +version = "0.1.0" +edition = "2021" + +[dependencies.framework_lib] +path = "../framework_lib" diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs new file mode 100644 index 00000000..0ebdccff --- /dev/null +++ b/frameworkd/src/main.rs @@ -0,0 +1,12 @@ +//use framework_lib::commandline; + +/// Get commandline arguments +fn get_args() -> Vec { + std::env::args().collect() +} + +fn main() { + //let args = commandline::parse(&get_args()); + println!("Hello World: {:?}", get_args()) + //commandline::run_with_args(&args, false); +} From 2a6df59ce0d5efb0dc98bb88f9d10b5794d99cfa Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 15 Jul 2023 12:20:18 +0800 Subject: [PATCH 02/25] frameworkd: WIP tray icon Signed-off-by: Daniel Schaefer --- Cargo.lock | 917 +++++++++++++++++++++++++++++++++++++-- frameworkd/Cargo.toml | 4 + frameworkd/src/icon1.ico | Bin 0 -> 34494 bytes frameworkd/src/icon2.ico | Bin 0 -> 34494 bytes frameworkd/src/main.rs | 143 +++++- 5 files changed, 1030 insertions(+), 34 deletions(-) create mode 100644 frameworkd/src/icon1.ico create mode 100644 frameworkd/src/icon2.ico diff --git a/Cargo.lock b/Cargo.lock index 45690bf0..916818e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + [[package]] name = "aho-corasick" version = "1.1.5" @@ -11,6 +17,19 @@ dependencies = [ "memchr", ] +[[package]] +name = "andrew" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4afb09dd642feec8408e33f92f3ffc4052946f6b20f32fb99c1f58cd4fa7cf" +dependencies = [ + "bitflags 1.3.2", + "rusttype", + "walkdir", + "xdg", + "xml-rs", +] + [[package]] name = "android_system_properties" version = "0.1.6" @@ -94,6 +113,12 @@ 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 = "block-buffer" version = "0.10.4" @@ -119,6 +144,16 @@ version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" +[[package]] +name = "calloop" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c" +dependencies = [ + "log", + "nix 0.18.0", +] + [[package]] name = "cc" version = "1.6.0" @@ -131,6 +166,12 @@ dependencies = [ "shlex", ] +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.5" @@ -149,7 +190,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ - "cfg-if", + "cfg-if 1.0.5", "cpufeatures 0.3.1", "rand_core", ] @@ -203,7 +244,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.1", ] [[package]] @@ -243,18 +284,123 @@ dependencies = [ "roff", ] +[[package]] +name = "cocoa" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation 0.9.4", + "core-graphics 0.22.3", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation 0.9.4", + "core-graphics-types", + "libc", + "objc", +] + [[package]] name = "colorchoice" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys 0.7.0", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys 0.8.7", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + [[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.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.7.0", + "foreign-types", + "libc", +] + +[[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", + "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-video-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" +dependencies = [ + "cfg-if 0.1.10", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.2", + "libc", + "objc", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -273,6 +419,62 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e71406cd8807725f7ac2f999a4cdd32e98f829fdf65f528343cebf945e41df1e" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[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-queue" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae" +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 = "crypto-common" version = "0.1.7" @@ -283,14 +485,44 @@ dependencies = [ "typenum", ] +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + +[[package]] +name = "darling" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +dependencies = [ + "darling_core 0.10.2", + "darling_macro 0.10.2", +] + [[package]] name = "darling" version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + +[[package]] +name = "darling_core" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.9.3", + "syn 1.0.109", ] [[package]] @@ -303,17 +535,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.11.1", "syn 2.0.119", ] +[[package]] +name = "darling_macro" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +dependencies = [ + "darling_core 0.10.2", + "quote", + "syn 1.0.109", +] + [[package]] name = "darling_macro" version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core", + "darling_core 0.20.11", "quote", "syn 2.0.119", ] @@ -359,6 +602,30 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dlib" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" +dependencies = [ + "libloading 0.6.7", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading 0.8.9", +] + [[package]] name = "dmidecode" version = "1.0.1" @@ -369,6 +636,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + [[package]] name = "embed-resource" version = "3.0.11" @@ -378,7 +651,7 @@ dependencies = [ "cc", "memchr", "rustc_version", - "toml", + "toml 1.1.6+spec-1.1.0", "vswhom", "winreg 0.55.0", ] @@ -424,6 +697,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "framework_lib" version = "0.6.6" @@ -441,7 +729,7 @@ dependencies = [ "lazy_static", "libc", "log", - "nix", + "nix 0.31.3", "no-std-compat", "num", "num-derive", @@ -488,6 +776,8 @@ name = "frameworkd" version = "0.1.0" dependencies = [ "framework_lib", + "trayicon", + "winit", ] [[package]] @@ -530,7 +820,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ - "cfg-if", + "cfg-if 1.0.5", "libc", "r-efi", "rand_core", @@ -576,7 +866,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "818c0e1d27887aaf76fe737042e27a66b796a7b099e6d2e1a72d106c2dff3fa6" dependencies = [ "cc", - "cfg-if", + "cfg-if 1.0.5", "libc", "pkg-config", "windows-sys 0.61.2", @@ -589,7 +879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", - "core-foundation-sys", + "core-foundation-sys 0.8.7", "iana-time-zone-haiku", "js-sys", "log", @@ -622,6 +912,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if 1.0.5", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.2" @@ -665,6 +964,34 @@ dependencies = [ "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" @@ -681,7 +1008,7 @@ version = "0.3.106" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" dependencies = [ - "cfg-if", + "cfg-if 1.0.5", "futures-util", "wasm-bindgen", ] @@ -713,13 +1040,23 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libloading" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" +dependencies = [ + "cfg-if 1.0.5", + "winapi", +] + [[package]] name = "libloading" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ - "cfg-if", + "cfg-if 1.0.5", "windows-link 0.2.1", ] @@ -762,12 +1099,133 @@ version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + [[package]] name = "memchr" version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" +[[package]] +name = "memmap2" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" +dependencies = [ + "libc", +] + +[[package]] +name = "mio" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi", +] + +[[package]] +name = "mio-misc" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47412f3a52115b936ff2a229b803498c7b4d332adeb87c2f1498c9da54c398c" +dependencies = [ + "crossbeam", + "crossbeam-queue", + "log", + "mio", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "ndk" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8794322172319b972f528bf90c6b467be0079f1fa82780ffb431088e741a73ab" +dependencies = [ + "jni-sys 0.3.1", + "ndk-sys", + "num_enum", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-glue" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5caf0c24d51ac1c905c27d4eda4fa0635bbe0de596b8f79235e0b17a4d29385" +dependencies = [ + "lazy_static", + "libc", + "log", + "ndk", + "ndk-macro", + "ndk-sys", +] + +[[package]] +name = "ndk-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" +dependencies = [ + "darling 0.10.2", + "proc-macro-crate 0.1.5", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ndk-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" + +[[package]] +name = "nix" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055" +dependencies = [ + "bitflags 1.3.2", + "cc", + "cfg-if 0.1.10", + "libc", +] + +[[package]] +name = "nix" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" +dependencies = [ + "bitflags 1.3.2", + "cc", + "cfg-if 1.0.5", + "libc", +] + [[package]] name = "nix" version = "0.31.3" @@ -775,7 +1233,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" dependencies = [ "bitflags 2.13.2", - "cfg-if", + "cfg-if 1.0.5", "cfg_aliases", "libc", ] @@ -786,6 +1244,15 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi", +] + [[package]] name = "num" version = "0.4.3" @@ -857,6 +1324,27 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "nvml-wrapper" version = "0.13.0" @@ -864,7 +1352,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d164abbde0b3c03edb9edb9cb8d31a7f5b79015c692b7c771f6e0840e9106b9f" dependencies = [ "bitflags 2.13.2", - "libloading", + "libloading 0.8.9", "nvml-wrapper-sys", "static_assertions", "thiserror 1.0.69", @@ -877,7 +1365,16 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d2079f4c9b6d2170bfb71c6355734ead6c47da75c179847395c31f9f2f66ede" dependencies = [ - "libloading", + "libloading 0.8.9", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", ] [[package]] @@ -892,6 +1389,46 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +[[package]] +name = "owned_ttf_parser" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e6affeb1632d6ff6a23d2cd40ffed138e82f1532571a26f527c8a284bb2fbb" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if 1.0.5", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + [[package]] name = "pin-project-lite" version = "0.2.17" @@ -925,6 +1462,25 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml 0.5.11", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -986,6 +1542,34 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" +[[package]] +name = "raw-window-handle" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76" +dependencies = [ + "libc", + "raw-window-handle 0.4.3", +] + +[[package]] +name = "raw-window-handle" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" +dependencies = [ + "cty", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "regex" version = "1.13.1" @@ -1040,12 +1624,37 @@ dependencies = [ "semver", ] +[[package]] +name = "rusttype" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff8374aa04134254b7995b63ad3dc41c7f7236f69528b28553da7d72efaa967" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + [[package]] name = "rustversion" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" +[[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 = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" @@ -1058,6 +1667,15 @@ 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", +] + [[package]] name = "serde_core" version = "1.0.229" @@ -1093,7 +1711,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" dependencies = [ - "cfg-if", + "cfg-if 1.0.5", "cpufeatures 0.2.17", "digest", ] @@ -1104,7 +1722,7 @@ version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ - "cfg-if", + "cfg-if 1.0.5", "cpufeatures 0.2.17", "digest", ] @@ -1121,6 +1739,12 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" +[[package]] +name = "smallvec" +version = "1.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" + [[package]] name = "smartmon" version = "0.1.0" @@ -1130,6 +1754,25 @@ dependencies = [ "cc", ] +[[package]] +name = "smithay-client-toolkit" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4750c76fd5d3ac95fa3ed80fe667d6a3d8590a960e5b575b98eea93339a80b80" +dependencies = [ + "andrew", + "bitflags 1.3.2", + "calloop", + "dlib 0.4.2", + "lazy_static", + "log", + "memmap2", + "nix 0.18.0", + "wayland-client", + "wayland-cursor", + "wayland-protocols", +] + [[package]] name = "spin" version = "0.9.9" @@ -1157,12 +1800,29 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff7589a1859b09232522bb9edf076ca7fcf14ded96685d3fa629db73023ffbb7" +[[package]] +name = "strsim" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" + [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.119" @@ -1225,6 +1885,15 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "toml" version = "1.1.6+spec-1.1.0" @@ -1234,12 +1903,18 @@ dependencies = [ "indexmap", "serde_core", "serde_spanned", - "toml_datetime", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", "toml_writer", - "winnow", + "winnow 1.0.4", ] +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" + [[package]] name = "toml_datetime" version = "1.1.1+spec-1.1.0" @@ -1249,13 +1924,24 @@ dependencies = [ "serde_core", ] +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap", + "toml_datetime 0.6.11", + "winnow 0.5.40", +] + [[package]] name = "toml_parser" version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" dependencies = [ - "winnow", + "winnow 1.0.4", ] [[package]] @@ -1264,6 +1950,21 @@ version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" +[[package]] +name = "trayicon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51617694e059fe4b83ab48e435660c1ba5b48b1573b4c143fdabd1c0f279daa" +dependencies = [ + "winapi", +] + +[[package]] +name = "ttf-parser" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" + [[package]] name = "typenum" version = "1.20.1" @@ -1286,7 +1987,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "368cef7d94514897e6dad4350945c7910a9f5bf9021191d1c58ee3ec09962697" dependencies = [ "bitflags 2.13.2", - "cfg-if", + "cfg-if 1.0.5", "log", "ptr_meta", "ucs2", @@ -1372,13 +2073,23 @@ dependencies = [ "libc", ] +[[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 = "wasm-bindgen" version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" dependencies = [ - "cfg-if", + "cfg-if 1.0.5", "once_cell", "rustversion", "wasm-bindgen-macro", @@ -1417,6 +2128,79 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wayland-client" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" +dependencies = [ + "bitflags 1.3.2", + "downcast-rs", + "libc", + "nix 0.20.0", + "scoped-tls", + "wayland-commons", + "wayland-scanner", + "wayland-sys", +] + +[[package]] +name = "wayland-commons" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" +dependencies = [ + "nix 0.20.0", + "once_cell", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-cursor" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be610084edd1586d45e7bdd275fe345c7c1873598caa464c4fb835dee70fa65a" +dependencies = [ + "nix 0.20.0", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "286620ea4d803bacf61fa087a4242ee316693099ee5a140796aaba02b29f861f" +dependencies = [ + "bitflags 1.3.2", + "wayland-client", + "wayland-commons", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" +dependencies = [ + "proc-macro2", + "quote", + "xml-rs", +] + +[[package]] +name = "wayland-sys" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" +dependencies = [ + "dlib 0.5.3", + "lazy_static", + "pkg-config", +] + [[package]] name = "winapi" version = "0.3.9" @@ -1433,6 +2217,15 @@ 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" @@ -1646,6 +2439,47 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winit" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79610794594d5e86be473ef7763f604f2159cbac8c94debd00df8fb41e86c2f8" +dependencies = [ + "bitflags 1.3.2", + "cocoa", + "core-foundation 0.9.4", + "core-graphics 0.22.3", + "core-video-sys", + "dispatch", + "instant", + "lazy_static", + "libc", + "log", + "mio", + "mio-misc", + "ndk", + "ndk-glue", + "ndk-sys", + "objc", + "parking_lot", + "percent-encoding", + "raw-window-handle 0.3.4", + "scopeguard", + "smithay-client-toolkit", + "wayland-client", + "winapi", + "x11-dl", +] + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + [[package]] name = "winnow" version = "1.0.4" @@ -1658,7 +2492,7 @@ version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" dependencies = [ - "cfg-if", + "cfg-if 1.0.5", "windows-sys 0.59.0", ] @@ -1668,7 +2502,7 @@ version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" dependencies = [ - "cfg-if", + "cfg-if 1.0.5", "windows-sys 0.61.2", ] @@ -1678,7 +2512,7 @@ version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0986a8b1d586b7d3e4fe3d9ea39fb451ae22869dcea4aa109d287a374d866087" dependencies = [ - "toml", + "toml 1.1.6+spec-1.1.0", "version_check", ] @@ -1688,12 +2522,41 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76ff259533532054cfbaefb115c613203c73707017459206380f03b3b3f266e" dependencies = [ - "darling", + "darling 0.20.11", "proc-macro2", "quote", "syn 2.0.119", ] +[[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 = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xdg" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + [[package]] name = "zerocopy" version = "0.8.59" diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index 48d67426..ddfaf3ab 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -3,5 +3,9 @@ name = "frameworkd" version = "0.1.0" edition = "2021" +[dependencies] +winit = "0.25" +trayicon = "0.2" + [dependencies.framework_lib] path = "../framework_lib" diff --git a/frameworkd/src/icon1.ico b/frameworkd/src/icon1.ico new file mode 100644 index 0000000000000000000000000000000000000000..31ff90f539017ea1bc8867c3f9f31bae023166aa GIT binary patch literal 34494 zcmd^|-K!ks9mk*3qdB!yPw0)2q#87WXtAeNTHA;TZIS)~>Xkx7XuW7Jv^8EyRuD;3 zUs7nR7kZ~LHziT1y)epxq8AE^)zma5ZcRedXu>g2Fy`c}-_Oka_DtrS*_qjy+1+Pn z;Cr5V`MrF9&-?T2>>lT)+=XuSYNvF)yY~X;?r_enSrcAwzsR}QbZ`Co@Oro8ZoS00 zxw+{2YUfT}?%d|h;q^5?bMCLdaPAt}kfDLXwo^dX^hmkhBP@T{JyYfj)Jks9%$ZKY3u+MN@RkmLGMXO#LZaf2|!*pW#uc z{a8bk9(D@1-_DG4?P=#)Q)VeUMHU@&>1WhcxjBLUD>&3=bg^;X!F6>1 zL8YgKqP9&QU2ODx=p5Ss-(_saePGM%lKxOQESOB$6kFKDHg)?Mp{&iMJ~pv^v+&;< z>|+z#JA{69Fv%ou4eYO>W-Jx{jN1Z8sgDr5RJv10B=H7B;cXJZ!zNS?JBfR_mhRp*V<{ zyuViXt?+{Ip1{0xL7*>X?ZZ8uA%kpcdF7!Xef(Z1+$8*2I4FE6BQjk^E2P8>$r|Bib6VGJJj z_{&(2PaFS7Hvfptf!2x7J|S=29aIh<`05>;N2q)L$=ntnfxjLBo!C94L!W;ej~Iuc zuRm7cKp72n{bd|Tqr9MRpq(&R9LoAL&LPHQmHe}&{*AzR@vd-ESct$m_jra(?)7)K zHPu~oZrg%$o4$1Jih1W|JI>9tottiH>j1a`57TeUR!26mjSqa`6W{Dp%n4hB-af?! zT~u@^FDT1z2y29m!motC2(Ji-gwq0RBK9%J$B%`50y4;=gDy6PcHm2x7UqQC344WO z0$ls;ZCSsF46^8;iw$gHv$g}<0^`Z`!V|)NfqAC!8Z^ZQwy=q9d{lN|D+2w_R^hO4 zRv46TnjSW>jSqYUe#-6?j?LI#6h0lT8hIEOa{_QT|fME8AmEsfM za42*jFMLb5PdF|Ni*wQszTp6uTnBOj;~RSPdr6zazJ>!_;MDivxj>zx+(w!2$vlD! zoKo9^p1~c^Zbnhxlbn;+aDrRFGhPsOPbvKtZ9l0yF4u5d*0<^&F)?mz70w9b!Z*nS zZg4zrjMFvz8T$?iNu6=KJ}i#k7lMOSVD9m_upo>Z-y|P6GS>*^OG@F-{As_ClpWV= zxWXCkfI8(v-dldc70z(KOn6DKXTGFxhCAzsqaN~yGu(eIob!-BoZhw_o4;&!^M|d>+5pOZBl0!RBy)A1OZg7Na@8CSbTBUy%%KE8GA8v3A`1S%=Dg*A{A{-Fv z;xMRPIKgchcZ(x>#vb*Z!np09!zp$DJQ0JJpI;rJVORqbkMDfSDkim5bvGBK_RQ($a;HX;wWl|@9*9%d?pm-UzI$*;Q*JS{L9F1 zkiR#Cs^TbX2QF6)DGzR!ALb2ZIajR@C%Ba<*M7RxvB$*G*nYOUQ5~WBCOCGh z3$2v+SyQtQV{((465~qy2ka|MYRt*Fh&A5!=@+Zmt4jJA*K1;pj|CeWRQ6UT#B6n7 zX9MFWW{dx$2F8CNivPO}jNRJ6<%<1|2FFkAk2E-bV*gu%<0p1LbF=o)w3OJ7H8}o` zVn5yB_&;xO?6mbN-qZ29&mjJ$*Z-#Xe@!3%nm+$&`uz8{29JTPe|RU>=P|4dch>&w zf&8n1dBC2J?f*R4!1&|)U%c~MrXKmIOUzdO>;?b3L3xne|0W-r{P_p*e_J@&fI2{o z7YkPRQykIPNeFF1~0WNvpZ;r=N=A1gVMHuz>-{4SZ zeb34x))TC$hPige7e2GrGFjZKe9oGhJ(LfHZcV^8KGN3jRmM}s7T;BVT&QAS85`Id z_wPTa<=0wqXD#uNz#QUj;fN6b+?jLk@eCPc(Lp!OZYB4-UHzhf{&d41YEatd2O4zn zLjg*{A0P-G^GgohdG5~!Vu4_b>#0y&3c>Fb=ocL<4b;Q`Rf8b^uZCmR(oS&cW-M*H z;Fz|w6<+gyZ8(;t;qB4=ZH2Cv@v{5v@OdwuPIx_IspW&E!S6mOpDf=jA1w`vg@S2e gNcr9-Re=QtR4(BUM=X__m1D15gCB|r3s`@@21R2hbN~PV literal 0 HcmV?d00001 diff --git a/frameworkd/src/icon2.ico b/frameworkd/src/icon2.ico new file mode 100644 index 0000000000000000000000000000000000000000..9a356183c738c42e1c59668a93e37738c003b890 GIT binary patch literal 34494 zcmeI5J8vXK5XbvCjuR4x9e{KZb^yWxf=h{Poe&YEKmdsFczgj!ykw-joI#8Z5kiOv zcqG6V03<`iOUM$54-OCiU+wfV9_GC>v$N+KsjgquRsX84?&;|r&xLRAqm4NoUJL<>W!m7$_FIs8cc}k0(GQ{%kt&VIQ%4&-Ep?b|u+#rfQIwlcX@dve7CMZ7 zM}58%tGxYe%pF_nbL&bR6+#$Zd z7iD9KJax2nm|w`}G93f04|5IvuX~`%1BsTfLQ-s=gngr%VK)>}Y?p*$8Ir9?txAou=}Q-0F#GB&x>A5iTooX+B!+D?qqt!k~}0j5d9>&AyR`8 zdFp6`2i|Itja#FvWLGl36{(_<;DNU%3?>JgzNyih#RZ1c4~-2iU^LzAv+!$Hev>?X zme`{K$Mh3djBOL0Sswb(x4^EZRi>ZV&c<3+M^&Ca^lhrFfY0>5Dj8LJs@mvVAh&7N zB=oP^|HROb9maq@eZ(Jg=-m$b>9gegBTg&^+O9vWRXwaf3;p2O6|G?XJ%s_AM!x@` zKVCK#+50c^8)A-dPaf$08})nY9&iubN*>S|MD=yFktBx~ljO7WNisWEzY&24Ui#3t z=Hi@!--=!kEzT+KSHUm$fP26_;2v-fxCh(=?tvaXV9$}4^t||>=uy$tl*m&@TaWts z5M`Jp$lkkqR_S{p&KZ6a{hbnd>S%jT)ZiVxKCsovFzgqEM{i;#pNNh`s;ne<;H3|J z>y!-CZrJq(SMrjm>p3iakuea)GO>nTZ@DHfiiizWbRzm916gIt2BFle{uuE9NI@4sXHnj&?$V7HuU<>4!{JW%sb+9S6 zrhM;9CbA3k_Ely0xet9k0DkTd$nFblfgHony>yv1M?wn64w=X<(A!s);b%|qR|$qP zY)$HsiR`|>7Rb3J@UMIPto!^OYW-wQ9%KE~yja)!7gO5i@S5%);*w-Gtm*!3F$U~; z*L459uz_cfHGFV=`}b%X=9)Bx(D0??g96Jd%!*59$38x=C2WHr)Ad=DK9G_mzS4F zQ#uJ@pZv`bcC+bm2wRk6s@?Vm<*sRz6VtrDhyxu)5og4WV`v*DPm7A& z1qdhifyaQyfX9HxfX9HxfX9HxfX9HxfX9HxfX9HxKvfLr1VbkZtD`DxW3;ufo!@ky z5WOY(O7x2;{*FqXI@;h#{|>y~uVdI)r9)Wj#(z^huZw;ciMbKMOCS1H%CEvUMq3TO zXVlKvHnls?M_*)=`d|zjt8|oL@c#%N1%uwQ9&e_z%g#DMLQ#;~zUM`}NNwq+$6bh`ZtyD`?eG98S8 z=&Z;8=PQW+DXo8J{r%<()rI`bj&pXT~pfs;)j{2?LE9JKf28KW$W@- z^$~~Cv7Uc<#-8HyFXJ)B`3E{|>`BKO=Q2H6ENPzSlCE)G*Kg|QUyRFHKmUwAIIHL1 zi@B*-;H>iJCFTQtPn~zFoRvSt`F{$Z@Um9VL~Zs5{9Pq|7VEt7dAU|DTbIVFFT+(( zAAkRRQ*B?07~A8N$Wuof`#N|F?akMZWoMb5Jf5-3Ww^Y4^?L&!10MsA0gnNX0gnNX z0gnNX0gnNX0gnNX0gr(R#ekqp;^G4dTslJGvJWUI)e+Ga~fK i9b-Dv2M?$pDvf$#dYIzK Vec { +// std::env::args().collect() +//} +// +//fn main() { +// //let args = commandline::parse(&get_args()); +// println!("Hello World: {:?}", get_args()) +// //commandline::run_with_args(&args, false); +//} +// -/// Get commandline arguments -fn get_args() -> Vec { - std::env::args().collect() +use winit::{ + event::{Event, WindowEvent}, + event_loop::{ControlFlow, EventLoop}, + window::WindowBuilder, +}; + +use trayicon::{Icon, MenuBuilder, MenuItem, TrayIconBuilder}; + +#[derive(Clone, Eq, PartialEq, Debug)] +enum Events { + ClickTrayIcon, + DoubleClickTrayIcon, + Exit, + Item1, + Item2, + Item3, + Item4, + DisabledItem1, + CheckItem1, + SubItem1, + SubItem2, + SubItem3, } fn main() { - //let args = commandline::parse(&get_args()); - println!("Hello World: {:?}", get_args()) - //commandline::run_with_args(&args, false); + let event_loop = EventLoop::::with_user_event(); + let your_app_window = WindowBuilder::new().build(&event_loop).unwrap(); + let proxy = event_loop.create_proxy(); + let icon = include_bytes!("icon1.ico"); + let icon2 = include_bytes!("icon2.ico"); + + let second_icon = Icon::from_buffer(icon2, None, None).unwrap(); + let first_icon = Icon::from_buffer(icon, None, None).unwrap(); + + // Needlessly complicated tray icon with all the whistles and bells + let mut tray_icon = TrayIconBuilder::new() + .sender(move |e: &Events| { + let _ = proxy.send_event(e.clone()); + }) + .icon_from_buffer(icon) + .tooltip("Cool Tray 👀 Icon") + .on_click(Events::ClickTrayIcon) + .on_double_click(Events::DoubleClickTrayIcon) + .menu( + MenuBuilder::new() + .item("Item 4 Set Tooltip", Events::Item4) + .item("Item 3 Replace Menu 👍", Events::Item3) + .item("Item 2 Change Icon Green", Events::Item2) + .item("Item 1 Change Icon Red", Events::Item1) + .separator() + .submenu( + "Sub Menu", + MenuBuilder::new() + .item("Sub item 1", Events::SubItem1) + .item("Sub Item 2", Events::SubItem2) + .item("Sub Item 3", Events::SubItem3), + ) + .checkable("This checkbox toggles disable", true, Events::CheckItem1) + .with(MenuItem::Item { + name: "Item Disabled".into(), + disabled: true, // Disabled entry example + id: Events::DisabledItem1, + icon: Result::ok(Icon::from_buffer(icon, None, None)), + }) + .separator() + .item("E&xit", Events::Exit), + ) + .build() + .unwrap(); + + event_loop.run(move |event, _, control_flow| { + *control_flow = ControlFlow::Wait; + + // Move the tray_icon to the main loop (even if you don't use it) + // + // Tray icon uses normal message pump from winit, for orderly closure + // and removal of the tray icon when you exit it must be moved inside. + let _ = tray_icon; + + match event { + // Main window events + Event::WindowEvent { + event: WindowEvent::CloseRequested, + window_id, + } if window_id == your_app_window.id() => *control_flow = ControlFlow::Exit, + + // User events + Event::UserEvent(e) => match e { + Events::Exit => *control_flow = ControlFlow::Exit, + Events::CheckItem1 => { + // You can mutate single checked, disabled value followingly. + // + // However, I think better way is to use reactively + // `set_menu` by building the menu based on application + // state. + if let Some(old_value) = tray_icon.get_menu_item_checkable(Events::CheckItem1) { + // Set checkable example + let _ = tray_icon.set_menu_item_checkable(Events::CheckItem1, !old_value); + + // Set disabled example + let _ = tray_icon.set_menu_item_disabled(Events::DisabledItem1, !old_value); + } + } + Events::Item1 => { + tray_icon.set_icon(&second_icon).unwrap(); + } + Events::Item2 => { + tray_icon.set_icon(&first_icon).unwrap(); + } + Events::Item3 => { + tray_icon + .set_menu( + &MenuBuilder::new() + .item("Another item", Events::Item1) + .item("Exit", Events::Exit), + ) + .unwrap(); + } + Events::Item4 => { + tray_icon.set_tooltip("Menu changed!").unwrap(); + } + e => println!("Got event {:?}", e), + }, + _ => (), + } + }); } From 13d709513bc7c9f35087a063eaca1416b64b7673 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 15 Jul 2023 14:20:39 +0800 Subject: [PATCH 03/25] frameworkd: Don't use winit to avoid showing a window Signed-off-by: Daniel Schaefer --- Cargo.lock | 908 ++--------------------------------------- frameworkd/Cargo.toml | 3 +- frameworkd/src/main.rs | 173 ++++---- 3 files changed, 110 insertions(+), 974 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 916818e1..9c540f82 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "ab_glyph_rasterizer" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" - [[package]] name = "aho-corasick" version = "1.1.5" @@ -17,19 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "andrew" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4afb09dd642feec8408e33f92f3ffc4052946f6b20f32fb99c1f58cd4fa7cf" -dependencies = [ - "bitflags 1.3.2", - "rusttype", - "walkdir", - "xdg", - "xml-rs", -] - [[package]] name = "android_system_properties" version = "0.1.6" @@ -113,12 +94,6 @@ 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 = "block-buffer" version = "0.10.4" @@ -144,16 +119,6 @@ version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" -[[package]] -name = "calloop" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c" -dependencies = [ - "log", - "nix 0.18.0", -] - [[package]] name = "cc" version = "1.6.0" @@ -166,12 +131,6 @@ dependencies = [ "shlex", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.5" @@ -190,7 +149,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ - "cfg-if 1.0.5", + "cfg-if", "cpufeatures 0.3.1", "rand_core", ] @@ -244,7 +203,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -284,123 +243,18 @@ dependencies = [ "roff", ] -[[package]] -name = "cocoa" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" -dependencies = [ - "bitflags 1.3.2", - "block", - "cocoa-foundation", - "core-foundation 0.9.4", - "core-graphics 0.22.3", - "foreign-types", - "libc", - "objc", -] - -[[package]] -name = "cocoa-foundation" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" -dependencies = [ - "bitflags 1.3.2", - "block", - "core-foundation 0.9.4", - "core-graphics-types", - "libc", - "objc", -] - [[package]] name = "colorchoice" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" -[[package]] -name = "core-foundation" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" -dependencies = [ - "core-foundation-sys 0.7.0", - "libc", -] - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys 0.8.7", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" - [[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.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.7.0", - "foreign-types", - "libc", -] - -[[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", - "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-video-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" -dependencies = [ - "cfg-if 0.1.10", - "core-foundation-sys 0.7.0", - "core-graphics 0.19.2", - "libc", - "objc", -] - [[package]] name = "cpufeatures" version = "0.2.17" @@ -419,62 +273,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crossbeam" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e71406cd8807725f7ac2f999a4cdd32e98f829fdf65f528343cebf945e41df1e" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue", - "crossbeam-utils", -] - -[[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-queue" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae" -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 = "crypto-common" version = "0.1.7" @@ -485,44 +283,14 @@ dependencies = [ "typenum", ] -[[package]] -name = "cty" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" - -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core 0.10.2", - "darling_macro 0.10.2", -] - [[package]] name = "darling" version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core 0.20.11", - "darling_macro 0.20.11", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.9.3", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -535,28 +303,17 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.119", ] -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core 0.10.2", - "quote", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core 0.20.11", + "darling_core", "quote", "syn 2.0.119", ] @@ -602,30 +359,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dispatch" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - -[[package]] -name = "dlib" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" -dependencies = [ - "libloading 0.6.7", -] - -[[package]] -name = "dlib" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" -dependencies = [ - "libloading 0.8.9", -] - [[package]] name = "dmidecode" version = "1.0.1" @@ -636,12 +369,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "downcast-rs" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" - [[package]] name = "embed-resource" version = "3.0.11" @@ -651,7 +378,7 @@ dependencies = [ "cc", "memchr", "rustc_version", - "toml 1.1.6+spec-1.1.0", + "toml", "vswhom", "winreg 0.55.0", ] @@ -697,21 +424,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "framework_lib" version = "0.6.6" @@ -729,7 +441,7 @@ dependencies = [ "lazy_static", "libc", "log", - "nix 0.31.3", + "nix", "no-std-compat", "num", "num-derive", @@ -777,7 +489,7 @@ version = "0.1.0" dependencies = [ "framework_lib", "trayicon", - "winit", + "winapi", ] [[package]] @@ -820,7 +532,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ - "cfg-if 1.0.5", + "cfg-if", "libc", "r-efi", "rand_core", @@ -866,7 +578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "818c0e1d27887aaf76fe737042e27a66b796a7b099e6d2e1a72d106c2dff3fa6" dependencies = [ "cc", - "cfg-if 1.0.5", + "cfg-if", "libc", "pkg-config", "windows-sys 0.61.2", @@ -879,7 +591,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", - "core-foundation-sys 0.8.7", + "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "log", @@ -912,15 +624,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if 1.0.5", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.2" @@ -964,34 +667,6 @@ dependencies = [ "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" @@ -1008,7 +683,7 @@ version = "0.3.106" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" dependencies = [ - "cfg-if 1.0.5", + "cfg-if", "futures-util", "wasm-bindgen", ] @@ -1040,23 +715,13 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "libloading" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" -dependencies = [ - "cfg-if 1.0.5", - "winapi", -] - [[package]] name = "libloading" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ - "cfg-if 1.0.5", + "cfg-if", "windows-link 0.2.1", ] @@ -1099,133 +764,12 @@ version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - [[package]] name = "memchr" version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" -[[package]] -name = "memmap2" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" -dependencies = [ - "libc", -] - -[[package]] -name = "mio" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - -[[package]] -name = "mio-misc" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47412f3a52115b936ff2a229b803498c7b4d332adeb87c2f1498c9da54c398c" -dependencies = [ - "crossbeam", - "crossbeam-queue", - "log", - "mio", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", -] - -[[package]] -name = "ndk" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8794322172319b972f528bf90c6b467be0079f1fa82780ffb431088e741a73ab" -dependencies = [ - "jni-sys 0.3.1", - "ndk-sys", - "num_enum", - "thiserror 1.0.69", -] - -[[package]] -name = "ndk-glue" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5caf0c24d51ac1c905c27d4eda4fa0635bbe0de596b8f79235e0b17a4d29385" -dependencies = [ - "lazy_static", - "libc", - "log", - "ndk", - "ndk-macro", - "ndk-sys", -] - -[[package]] -name = "ndk-macro" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" -dependencies = [ - "darling 0.10.2", - "proc-macro-crate 0.1.5", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ndk-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" - -[[package]] -name = "nix" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if 0.1.10", - "libc", -] - -[[package]] -name = "nix" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if 1.0.5", - "libc", -] - [[package]] name = "nix" version = "0.31.3" @@ -1233,7 +777,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" dependencies = [ "bitflags 2.13.2", - "cfg-if 1.0.5", + "cfg-if", "cfg_aliases", "libc", ] @@ -1244,15 +788,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi", -] - [[package]] name = "num" version = "0.4.3" @@ -1324,27 +859,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "nvml-wrapper" version = "0.13.0" @@ -1352,7 +866,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d164abbde0b3c03edb9edb9cb8d31a7f5b79015c692b7c771f6e0840e9106b9f" dependencies = [ "bitflags 2.13.2", - "libloading 0.8.9", + "libloading", "nvml-wrapper-sys", "static_assertions", "thiserror 1.0.69", @@ -1365,16 +879,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d2079f4c9b6d2170bfb71c6355734ead6c47da75c179847395c31f9f2f66ede" dependencies = [ - "libloading 0.8.9", -] - -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", + "libloading", ] [[package]] @@ -1389,46 +894,6 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" -[[package]] -name = "owned_ttf_parser" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e6affeb1632d6ff6a23d2cd40ffed138e82f1532571a26f527c8a284bb2fbb" -dependencies = [ - "ttf-parser", -] - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if 1.0.5", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - [[package]] name = "pin-project-lite" version = "0.2.17" @@ -1462,25 +927,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml 0.5.11", -] - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - [[package]] name = "proc-macro2" version = "1.0.107" @@ -1542,34 +988,6 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" -[[package]] -name = "raw-window-handle" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76" -dependencies = [ - "libc", - "raw-window-handle 0.4.3", -] - -[[package]] -name = "raw-window-handle" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" -dependencies = [ - "cty", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "regex" version = "1.13.1" @@ -1624,37 +1042,12 @@ dependencies = [ "semver", ] -[[package]] -name = "rusttype" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff8374aa04134254b7995b63ad3dc41c7f7236f69528b28553da7d72efaa967" -dependencies = [ - "ab_glyph_rasterizer", - "owned_ttf_parser", -] - [[package]] name = "rustversion" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" -[[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 = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "scopeguard" version = "1.2.0" @@ -1667,15 +1060,6 @@ 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", -] - [[package]] name = "serde_core" version = "1.0.229" @@ -1711,7 +1095,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" dependencies = [ - "cfg-if 1.0.5", + "cfg-if", "cpufeatures 0.2.17", "digest", ] @@ -1722,7 +1106,7 @@ version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ - "cfg-if 1.0.5", + "cfg-if", "cpufeatures 0.2.17", "digest", ] @@ -1739,12 +1123,6 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" -[[package]] -name = "smallvec" -version = "1.16.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" - [[package]] name = "smartmon" version = "0.1.0" @@ -1754,25 +1132,6 @@ dependencies = [ "cc", ] -[[package]] -name = "smithay-client-toolkit" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4750c76fd5d3ac95fa3ed80fe667d6a3d8590a960e5b575b98eea93339a80b80" -dependencies = [ - "andrew", - "bitflags 1.3.2", - "calloop", - "dlib 0.4.2", - "lazy_static", - "log", - "memmap2", - "nix 0.18.0", - "wayland-client", - "wayland-cursor", - "wayland-protocols", -] - [[package]] name = "spin" version = "0.9.9" @@ -1800,29 +1159,12 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff7589a1859b09232522bb9edf076ca7fcf14ded96685d3fa629db73023ffbb7" -[[package]] -name = "strsim" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" - [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.119" @@ -1885,15 +1227,6 @@ dependencies = [ "syn 3.0.6", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "1.1.6+spec-1.1.0" @@ -1903,18 +1236,12 @@ dependencies = [ "indexmap", "serde_core", "serde_spanned", - "toml_datetime 1.1.1+spec-1.1.0", + "toml_datetime", "toml_parser", "toml_writer", - "winnow 1.0.4", + "winnow", ] -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" - [[package]] name = "toml_datetime" version = "1.1.1+spec-1.1.0" @@ -1924,24 +1251,13 @@ dependencies = [ "serde_core", ] -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "toml_datetime 0.6.11", - "winnow 0.5.40", -] - [[package]] name = "toml_parser" version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" dependencies = [ - "winnow 1.0.4", + "winnow", ] [[package]] @@ -1959,12 +1275,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ttf-parser" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" - [[package]] name = "typenum" version = "1.20.1" @@ -1987,7 +1297,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "368cef7d94514897e6dad4350945c7910a9f5bf9021191d1c58ee3ec09962697" dependencies = [ "bitflags 2.13.2", - "cfg-if 1.0.5", + "cfg-if", "log", "ptr_meta", "ucs2", @@ -2073,23 +1383,13 @@ dependencies = [ "libc", ] -[[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 = "wasm-bindgen" version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" dependencies = [ - "cfg-if 1.0.5", + "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", @@ -2128,79 +1428,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "wayland-client" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" -dependencies = [ - "bitflags 1.3.2", - "downcast-rs", - "libc", - "nix 0.20.0", - "scoped-tls", - "wayland-commons", - "wayland-scanner", - "wayland-sys", -] - -[[package]] -name = "wayland-commons" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" -dependencies = [ - "nix 0.20.0", - "once_cell", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-cursor" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be610084edd1586d45e7bdd275fe345c7c1873598caa464c4fb835dee70fa65a" -dependencies = [ - "nix 0.20.0", - "wayland-client", - "xcursor", -] - -[[package]] -name = "wayland-protocols" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "286620ea4d803bacf61fa087a4242ee316693099ee5a140796aaba02b29f861f" -dependencies = [ - "bitflags 1.3.2", - "wayland-client", - "wayland-commons", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" -dependencies = [ - "proc-macro2", - "quote", - "xml-rs", -] - -[[package]] -name = "wayland-sys" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" -dependencies = [ - "dlib 0.5.3", - "lazy_static", - "pkg-config", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2217,15 +1444,6 @@ 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" @@ -2439,47 +1657,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winit" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79610794594d5e86be473ef7763f604f2159cbac8c94debd00df8fb41e86c2f8" -dependencies = [ - "bitflags 1.3.2", - "cocoa", - "core-foundation 0.9.4", - "core-graphics 0.22.3", - "core-video-sys", - "dispatch", - "instant", - "lazy_static", - "libc", - "log", - "mio", - "mio-misc", - "ndk", - "ndk-glue", - "ndk-sys", - "objc", - "parking_lot", - "percent-encoding", - "raw-window-handle 0.3.4", - "scopeguard", - "smithay-client-toolkit", - "wayland-client", - "winapi", - "x11-dl", -] - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "winnow" version = "1.0.4" @@ -2492,7 +1669,7 @@ version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" dependencies = [ - "cfg-if 1.0.5", + "cfg-if", "windows-sys 0.59.0", ] @@ -2502,7 +1679,7 @@ version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" dependencies = [ - "cfg-if 1.0.5", + "cfg-if", "windows-sys 0.61.2", ] @@ -2512,7 +1689,7 @@ version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0986a8b1d586b7d3e4fe3d9ea39fb451ae22869dcea4aa109d287a374d866087" dependencies = [ - "toml 1.1.6+spec-1.1.0", + "toml", "version_check", ] @@ -2522,41 +1699,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76ff259533532054cfbaefb115c613203c73707017459206380f03b3b3f266e" dependencies = [ - "darling 0.20.11", + "darling", "proc-macro2", "quote", "syn 2.0.119", ] -[[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 = "xcursor" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" - -[[package]] -name = "xdg" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" - -[[package]] -name = "xml-rs" -version = "0.8.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" - [[package]] name = "zerocopy" version = "0.8.59" diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index ddfaf3ab..d32b4b53 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -4,8 +4,9 @@ version = "0.1.0" edition = "2021" [dependencies] -winit = "0.25" trayicon = "0.2" +winapi = { version = "0.3.9", features = ["winuser", "windef", "minwindef", "shellapi", "libloaderapi", "commctrl", "basetsd"] } +#crossbeam-channel = "0.5" [dependencies.framework_lib] path = "../framework_lib" diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 936f7c85..a7642c2d 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -1,45 +1,27 @@ -////use framework_lib::commandline; -// -///// Get commandline arguments -//fn get_args() -> Vec { -// std::env::args().collect() -//} -// -//fn main() { -// //let args = commandline::parse(&get_args()); -// println!("Hello World: {:?}", get_args()) -// //commandline::run_with_args(&args, false); -//} -// +#![windows_subsystem = "windows"] -use winit::{ - event::{Event, WindowEvent}, - event_loop::{ControlFlow, EventLoop}, - window::WindowBuilder, -}; - -use trayicon::{Icon, MenuBuilder, MenuItem, TrayIconBuilder}; - -#[derive(Clone, Eq, PartialEq, Debug)] -enum Events { - ClickTrayIcon, - DoubleClickTrayIcon, - Exit, - Item1, - Item2, - Item3, - Item4, - DisabledItem1, - CheckItem1, - SubItem1, - SubItem2, - SubItem3, -} +use core::mem::MaybeUninit; +use trayicon::*; +use winapi::um::winuser; fn main() { - let event_loop = EventLoop::::with_user_event(); - let your_app_window = WindowBuilder::new().build(&event_loop).unwrap(); - let proxy = event_loop.create_proxy(); + #[derive(Copy, Clone, Eq, PartialEq, Debug)] + enum Events { + ClickTrayIcon, + DoubleClickTrayIcon, + Exit, + Item1, + Item2, + Item3, + Item4, + DisabledItem1, + CheckItem1, + SubItem1, + SubItem2, + SubItem3, + } + + let (s, r) = std::sync::mpsc::channel::(); let icon = include_bytes!("icon1.ico"); let icon2 = include_bytes!("icon2.ico"); @@ -49,7 +31,7 @@ fn main() { // Needlessly complicated tray icon with all the whistles and bells let mut tray_icon = TrayIconBuilder::new() .sender(move |e: &Events| { - let _ = proxy.send_event(e.clone()); + let _ = s.send(*e); }) .icon_from_buffer(icon) .tooltip("Cool Tray 👀 Icon") @@ -62,6 +44,7 @@ fn main() { .item("Item 2 Change Icon Green", Events::Item2) .item("Item 1 Change Icon Red", Events::Item1) .separator() + .checkable("This is checkable", true, Events::CheckItem1) .submenu( "Sub Menu", MenuBuilder::new() @@ -82,60 +65,64 @@ fn main() { .build() .unwrap(); - event_loop.run(move |event, _, control_flow| { - *control_flow = ControlFlow::Wait; + std::thread::spawn(move || { + r.iter().for_each(|m| match m { + Events::DoubleClickTrayIcon => { + println!("Double click"); + } + Events::ClickTrayIcon => { + println!("Single click"); + } + Events::Exit => { + std::process::exit(0); + } + Events::Item1 => { + tray_icon.set_icon(&second_icon).unwrap(); + } + Events::Item2 => { + tray_icon.set_icon(&first_icon).unwrap(); + } + Events::Item3 => { + tray_icon + .set_menu( + &MenuBuilder::new() + .item("New menu item", Events::Item1) + .item("Exit", Events::Exit), + ) + .unwrap(); + } + Events::CheckItem1 => { + // You can mutate single checked, disabled value followingly. + // + // However, I think better way is to use reactively + // `set_menu` by building the menu based on application + // state. + if let Some(old_value) = tray_icon.get_menu_item_checkable(Events::CheckItem1) { + // Set checkable example + let _ = tray_icon.set_menu_item_checkable(Events::CheckItem1, !old_value); - // Move the tray_icon to the main loop (even if you don't use it) - // - // Tray icon uses normal message pump from winit, for orderly closure - // and removal of the tray icon when you exit it must be moved inside. - let _ = tray_icon; - - match event { - // Main window events - Event::WindowEvent { - event: WindowEvent::CloseRequested, - window_id, - } if window_id == your_app_window.id() => *control_flow = ControlFlow::Exit, - - // User events - Event::UserEvent(e) => match e { - Events::Exit => *control_flow = ControlFlow::Exit, - Events::CheckItem1 => { - // You can mutate single checked, disabled value followingly. - // - // However, I think better way is to use reactively - // `set_menu` by building the menu based on application - // state. - if let Some(old_value) = tray_icon.get_menu_item_checkable(Events::CheckItem1) { - // Set checkable example - let _ = tray_icon.set_menu_item_checkable(Events::CheckItem1, !old_value); - - // Set disabled example - let _ = tray_icon.set_menu_item_disabled(Events::DisabledItem1, !old_value); - } - } - Events::Item1 => { - tray_icon.set_icon(&second_icon).unwrap(); + // Set disabled example + let _ = tray_icon.set_menu_item_disabled(Events::DisabledItem1, !old_value); } - Events::Item2 => { - tray_icon.set_icon(&first_icon).unwrap(); - } - Events::Item3 => { - tray_icon - .set_menu( - &MenuBuilder::new() - .item("Another item", Events::Item1) - .item("Exit", Events::Exit), - ) - .unwrap(); - } - Events::Item4 => { - tray_icon.set_tooltip("Menu changed!").unwrap(); - } - e => println!("Got event {:?}", e), - }, - _ => (), - } + } + e => { + println!("{:?}", e); + } + }) }); + + // Your applications message loop. Because all applications require an + // application loop, you are best served using an `winit` crate. + loop { + unsafe { + let mut msg = MaybeUninit::uninit(); + let bret = winuser::GetMessageA(msg.as_mut_ptr(), 0 as _, 0, 0); + if bret > 0 { + winuser::TranslateMessage(msg.as_ptr()); + winuser::DispatchMessageA(msg.as_ptr()); + } else { + break; + } + } + } } From c8c2ad0db913816dcc2ddfc0c04e15a416bc95c1 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 15 Jul 2023 17:47:01 +0800 Subject: [PATCH 04/25] frameworkd: POC screen brightness control/reading Signed-off-by: Daniel Schaefer --- Cargo.lock | 1094 +++++++++++++++++++++++++++++++++++++++- frameworkd/Cargo.toml | 1 + frameworkd/src/main.rs | 14 + 3 files changed, 1081 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c540f82..8b64433a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -70,6 +70,181 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "async-broadcast" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" +dependencies = [ + "event-listener 2.5.3", + "futures-core", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f426a31126c735126297bc5ea7a521263c9faff4f63ca415267ee625651c4f37" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand 2.5.0", + "futures-lite 2.6.1", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" +dependencies = [ + "async-lock 2.8.0", + "autocfg", + "blocking", + "futures-lite 1.13.0", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock 2.8.0", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite 1.13.0", + "log", + "parking", + "polling 2.8.0", + "rustix 0.37.28", + "slab", + "socket2", + "waker-fn", +] + +[[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 2.6.1", + "parking", + "polling 3.11.0", + "rustix 1.1.6", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener 2.5.3", +] + +[[package]] +name = "async-lock" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f" +dependencies = [ + "event-listener 5.4.2", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" +dependencies = [ + "async-io 1.13.0", + "async-lock 2.8.0", + "async-signal", + "blocking", + "cfg-if", + "event-listener 3.1.0", + "futures-lite 1.13.0", + "rustix 0.38.44", + "windows-sys 0.48.0", +] + +[[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.6", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io 2.6.0", + "async-lock 3.5.0", + "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.6", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.5.1" @@ -103,6 +278,35 @@ dependencies = [ "generic-array", ] +[[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 2.6.1", + "piper", +] + +[[package]] +name = "brightness" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ccf3c64278486354c6c41b71293570a207684a34cceb53137975d781748d33f" +dependencies = [ + "async-trait", + "blocking", + "cfg-if", + "futures", + "itertools", + "thiserror 1.0.69", + "windows 0.39.0", + "zbus", +] + [[package]] name = "built" version = "0.8.1" @@ -119,6 +323,12 @@ version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "cc" version = "1.6.0" @@ -151,7 +361,7 @@ checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ "cfg-if", "cpufeatures 0.3.1", - "rand_core", + "rand_core 0.10.1", ] [[package]] @@ -249,6 +459,15 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" +[[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 = "core-foundation-sys" version = "0.8.7" @@ -273,6 +492,12 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + [[package]] name = "crypto-common" version = "0.1.7" @@ -349,6 +574,17 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "digest" version = "0.10.7" @@ -369,6 +605,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + [[package]] name = "embed-resource" version = "3.0.11" @@ -383,6 +625,27 @@ dependencies = [ "winreg 0.55.0", ] +[[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 = "env_filter" version = "2.0.0" @@ -412,6 +675,68 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[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 = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "event-listener" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[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 5.4.2", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + [[package]] name = "find-msvc-tools" version = "0.1.14" @@ -441,14 +766,14 @@ dependencies = [ "lazy_static", "libc", "log", - "nix", + "nix 0.31.3", "no-std-compat", "num", "num-derive", "num-traits", "nvml-wrapper", "plain", - "rand", + "rand 0.10.3", "regex", "rusb", "sha1", @@ -457,7 +782,7 @@ dependencies = [ "spin 0.12.3", "uefi", "uefi-raw", - "windows", + "windows 0.62.2", "windows-version", "winreg 0.56.0", "zerocopy", @@ -487,17 +812,105 @@ dependencies = [ name = "frameworkd" version = "0.1.0" dependencies = [ + "brightness", "framework_lib", "trayicon", "winapi", ] +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[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-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[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 = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand 2.5.0", + "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.6", +] + +[[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" @@ -510,8 +923,13 @@ version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ + "futures-channel", "futures-core", + "futures-io", + "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "slab", ] @@ -526,6 +944,17 @@ dependencies = [ "version_check", ] +[[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.4.3" @@ -535,7 +964,7 @@ dependencies = [ "cfg-if", "libc", "r-efi", - "rand_core", + "rand_core 0.10.1", ] [[package]] @@ -571,6 +1000,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[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" + [[package]] name = "hidapi" version = "2.6.7" @@ -624,12 +1071,41 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.48.0", +] + [[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.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "jiff" version = "0.2.37" @@ -673,7 +1149,7 @@ version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" dependencies = [ - "getrandom", + "getrandom 0.4.3", "libc", ] @@ -749,6 +1225,24 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[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 = "lock_api" version = "0.4.14" @@ -770,6 +1264,36 @@ version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset 0.7.1", +] + [[package]] name = "nix" version = "0.31.3" @@ -894,12 +1418,39 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +[[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 = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[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 2.5.0", + "futures-io", +] + [[package]] name = "pkg-config" version = "0.3.34" @@ -912,6 +1463,36 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[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 0.5.3", + "pin-project-lite", + "rustix 1.1.6", + "windows-sys 0.61.2", +] + [[package]] name = "portable-atomic" version = "1.15.0" @@ -927,6 +1508,25 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -960,26 +1560,56 @@ dependencies = [ name = "quote" version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" dependencies = [ - "proc-macro2", + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", ] [[package]] -name = "r-efi" -version = "6.0.0" +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] [[package]] -name = "rand" -version = "0.10.3" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "chacha20", - "getrandom", - "rand_core", + "getrandom 0.2.17", ] [[package]] @@ -1042,6 +1672,46 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.37.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "519165d378b97752ca44bbe15047d5d3409e875f39327546b42ac81d7e18c1b6" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[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" @@ -1060,6 +1730,16 @@ 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" @@ -1080,6 +1760,17 @@ dependencies = [ "syn 3.0.6", ] +[[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.6", +] + [[package]] name = "serde_spanned" version = "1.1.1" @@ -1117,6 +1808,16 @@ 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 = "slab" version = "0.4.12" @@ -1132,6 +1833,16 @@ dependencies = [ "cc", ] +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "spin" version = "0.9.9" @@ -1165,6 +1876,17 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.119" @@ -1187,6 +1909,19 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand 2.5.0", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.6", + "windows-sys 0.61.2", +] + [[package]] name = "thiserror" version = "1.0.69" @@ -1236,12 +1971,18 @@ dependencies = [ "indexmap", "serde_core", "serde_spanned", - "toml_datetime", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", "toml_writer", - "winnow", + "winnow 1.0.4", ] +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" + [[package]] name = "toml_datetime" version = "1.1.1+spec-1.1.0" @@ -1251,13 +1992,24 @@ dependencies = [ "serde_core", ] +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap", + "toml_datetime 0.6.11", + "winnow 0.5.40", +] + [[package]] name = "toml_parser" version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" dependencies = [ - "winnow", + "winnow 1.0.4", ] [[package]] @@ -1266,6 +2018,37 @@ version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[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", +] + [[package]] name = "trayicon" version = "0.2.0" @@ -1290,6 +2073,17 @@ dependencies = [ "bit_field", ] +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset 0.9.1", + "tempfile", + "windows-sys 0.61.2", +] + [[package]] name = "uefi" version = "0.41.0" @@ -1383,6 +2177,18 @@ dependencies = [ "libc", ] +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasm-bindgen" version = "0.2.129" @@ -1450,6 +2256,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1c4bd0a50ac6020f65184721f758dba47bb9fbc2133df715ec74a237b26794a" +dependencies = [ + "windows_aarch64_msvc 0.39.0", + "windows_i686_gnu 0.39.0", + "windows_i686_msvc 0.39.0", + "windows_x86_64_gnu 0.39.0", + "windows_x86_64_msvc 0.39.0", +] + [[package]] name = "windows" version = "0.62.2" @@ -1557,13 +2376,22 @@ 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.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1575,20 +2403,35 @@ 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", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "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]] @@ -1609,18 +2452,48 @@ dependencies = [ "windows-link 0.100.0", ] +[[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.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" + +[[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.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" + +[[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" @@ -1633,30 +2506,81 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" + +[[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.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" + +[[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.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + [[package]] name = "winnow" version = "1.0.4" @@ -1705,6 +2629,82 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "xdg-home" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "zbus" +version = "3.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "675d170b632a6ad49804c8cf2105d7c31eddd3312555cffd4b740e08e97c25e6" +dependencies = [ + "async-broadcast", + "async-executor", + "async-fs", + "async-io 1.13.0", + "async-lock 2.8.0", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "byteorder", + "derivative", + "enumflags2", + "event-listener 2.5.3", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix 0.26.4", + "once_cell", + "ordered-stream", + "rand 0.8.8", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "winapi", + "xdg-home", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "3.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7131497b0f887e8061b430c530240063d33bf9455fa34438f388a245da69e0a5" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "437d738d3750bed6ca9b8d423ccc7a8eb284f6b1d6d4e225a0e4e6258d864c8d" +dependencies = [ + "serde", + "static_assertions", + "zvariant", +] + [[package]] name = "zerocopy" version = "0.8.59" @@ -1724,3 +2724,41 @@ dependencies = [ "quote", "syn 2.0.119", ] + +[[package]] +name = "zvariant" +version = "3.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eef2be88ba09b358d3b58aca6e41cd853631d44787f319a1383ca83424fb2db" +dependencies = [ + "byteorder", + "enumflags2", + "libc", + "serde", + "static_assertions", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "3.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c24dc0bed72f5f90d1f8bb5b07228cbf63b3c6e9f82d82559d4bae666e7ed9" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index d32b4b53..e11eecac 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" trayicon = "0.2" winapi = { version = "0.3.9", features = ["winuser", "windef", "minwindef", "shellapi", "libloaderapi", "commctrl", "basetsd"] } #crossbeam-channel = "0.5" +brightness = "0.5.0" [dependencies.framework_lib] path = "../framework_lib" diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index a7642c2d..2d7632e8 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -1,6 +1,8 @@ #![windows_subsystem = "windows"] use core::mem::MaybeUninit; + +use brightness::blocking::Brightness; use trayicon::*; use winapi::um::winuser; @@ -69,9 +71,21 @@ fn main() { r.iter().for_each(|m| match m { Events::DoubleClickTrayIcon => { println!("Double click"); + let devs = brightness::blocking::brightness_devices(); + for dev in devs { + let dev = dev.unwrap(); + dev.set(50).unwrap(); + } } Events::ClickTrayIcon => { println!("Single click"); + let devs = brightness::blocking::brightness_devices(); + for dev in devs { + // TODO: Skip unsupported monitors + let dev = dev.unwrap(); + println!("{:?}", dev.device_name()); + println!(" {:?}", dev.get()); + } } Events::Exit => { std::process::exit(0); From da712b3fbed7e242907fc2e1b5253a3c0222b8d9 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 15 Jul 2023 17:49:30 +0800 Subject: [PATCH 05/25] frameworkd: Add Framework icon Signed-off-by: Daniel Schaefer --- .../res/logo_cropped_transparent_32x32.ico | Bin 0 -> 4286 bytes frameworkd/src/icon1.ico | Bin 34494 -> 0 bytes frameworkd/src/main.rs | 4 +++- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 frameworkd/res/logo_cropped_transparent_32x32.ico delete mode 100644 frameworkd/src/icon1.ico diff --git a/frameworkd/res/logo_cropped_transparent_32x32.ico b/frameworkd/res/logo_cropped_transparent_32x32.ico new file mode 100644 index 0000000000000000000000000000000000000000..b14c44806723af449e1b80d749ae0c334f32235d GIT binary patch literal 4286 zcmc&%Nl08l5bbdx2SW^qA`(zB7)1nE)YGUWpa?o5F1Ue;D30qv)NzRicaNgD@7o;W zhUnFUI4DS>ID#OIpg9O)V#4Sc#ZHx^hd=ti|2s}}K0W<^cXhq0>guX4LS*o`xe@#) z({BlJB7}HBgCP&8`}_NX^m}`I-D6uvC%y{J6nfXjMv>>CX>g($2G*Wz`y1JSqCMIrL3YYOgp2%Bl zACM*~DM=7NARvIIr>AdKRaMRQ_4VC0d{0YD+w%AK7u*NrDHWeje;*&8KZS*b>WPU7 z?~RQOThNOX6cpSxd|zK*w;dZB^F|t9U*9VjGLZ%GYiepl^*=c|u}?`!`OaMrzIX-x z9xrCQfAcb+O~}g1GLga0&+nVq`m?h$(%jtqk!#1CoSZ9-MiaNQvm+`y z_xHOjFE11D-8lG}>=n|Xz0_*8w+Mfu9zt{wf4%X{aAm-Eg+g%!F(D3g)ZU%LZ-}v5 zo12@qLVTr;gYVd;rlxN3VSpX9;M@0PLt4lkv(Ss`Cng8-sI06+UiWbF^73eObo9M( zqy@j5g>_HH&(F^%7^nE~VGmv$|2gcB@tIG5wEs){-~T>;m@ghWe;9vydU|f-PiSbU zi7yrx7e6`vU_Rp7o*RFbmX?hE-PzeG7=L$nca3yn=Z($t#b1a6_u?<3$Nr)G^Ozi9 zPX1wX@a133fsjiSU`Hu-FgyRE3_|xWPfyQF*vsk3$w}k=1HLVO|9H&(3v$@A-M_d# zY|gvX`zPMN!3HmO|Hk^Gp`k%?{UMjjsU_h literal 0 HcmV?d00001 diff --git a/frameworkd/src/icon1.ico b/frameworkd/src/icon1.ico deleted file mode 100644 index 31ff90f539017ea1bc8867c3f9f31bae023166aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34494 zcmd^|-K!ks9mk*3qdB!yPw0)2q#87WXtAeNTHA;TZIS)~>Xkx7XuW7Jv^8EyRuD;3 zUs7nR7kZ~LHziT1y)epxq8AE^)zma5ZcRedXu>g2Fy`c}-_Oka_DtrS*_qjy+1+Pn z;Cr5V`MrF9&-?T2>>lT)+=XuSYNvF)yY~X;?r_enSrcAwzsR}QbZ`Co@Oro8ZoS00 zxw+{2YUfT}?%d|h;q^5?bMCLdaPAt}kfDLXwo^dX^hmkhBP@T{JyYfj)Jks9%$ZKY3u+MN@RkmLGMXO#LZaf2|!*pW#uc z{a8bk9(D@1-_DG4?P=#)Q)VeUMHU@&>1WhcxjBLUD>&3=bg^;X!F6>1 zL8YgKqP9&QU2ODx=p5Ss-(_saePGM%lKxOQESOB$6kFKDHg)?Mp{&iMJ~pv^v+&;< z>|+z#JA{69Fv%ou4eYO>W-Jx{jN1Z8sgDr5RJv10B=H7B;cXJZ!zNS?JBfR_mhRp*V<{ zyuViXt?+{Ip1{0xL7*>X?ZZ8uA%kpcdF7!Xef(Z1+$8*2I4FE6BQjk^E2P8>$r|Bib6VGJJj z_{&(2PaFS7Hvfptf!2x7J|S=29aIh<`05>;N2q)L$=ntnfxjLBo!C94L!W;ej~Iuc zuRm7cKp72n{bd|Tqr9MRpq(&R9LoAL&LPHQmHe}&{*AzR@vd-ESct$m_jra(?)7)K zHPu~oZrg%$o4$1Jih1W|JI>9tottiH>j1a`57TeUR!26mjSqa`6W{Dp%n4hB-af?! zT~u@^FDT1z2y29m!motC2(Ji-gwq0RBK9%J$B%`50y4;=gDy6PcHm2x7UqQC344WO z0$ls;ZCSsF46^8;iw$gHv$g}<0^`Z`!V|)NfqAC!8Z^ZQwy=q9d{lN|D+2w_R^hO4 zRv46TnjSW>jSqYUe#-6?j?LI#6h0lT8hIEOa{_QT|fME8AmEsfM za42*jFMLb5PdF|Ni*wQszTp6uTnBOj;~RSPdr6zazJ>!_;MDivxj>zx+(w!2$vlD! zoKo9^p1~c^Zbnhxlbn;+aDrRFGhPsOPbvKtZ9l0yF4u5d*0<^&F)?mz70w9b!Z*nS zZg4zrjMFvz8T$?iNu6=KJ}i#k7lMOSVD9m_upo>Z-y|P6GS>*^OG@F-{As_ClpWV= zxWXCkfI8(v-dldc70z(KOn6DKXTGFxhCAzsqaN~yGu(eIob!-BoZhw_o4;&!^M|d>+5pOZBl0!RBy)A1OZg7Na@8CSbTBUy%%KE8GA8v3A`1S%=Dg*A{A{-Fv z;xMRPIKgchcZ(x>#vb*Z!np09!zp$DJQ0JJpI;rJVORqbkMDfSDkim5bvGBK_RQ($a;HX;wWl|@9*9%d?pm-UzI$*;Q*JS{L9F1 zkiR#Cs^TbX2QF6)DGzR!ALb2ZIajR@C%Ba<*M7RxvB$*G*nYOUQ5~WBCOCGh z3$2v+SyQtQV{((465~qy2ka|MYRt*Fh&A5!=@+Zmt4jJA*K1;pj|CeWRQ6UT#B6n7 zX9MFWW{dx$2F8CNivPO}jNRJ6<%<1|2FFkAk2E-bV*gu%<0p1LbF=o)w3OJ7H8}o` zVn5yB_&;xO?6mbN-qZ29&mjJ$*Z-#Xe@!3%nm+$&`uz8{29JTPe|RU>=P|4dch>&w zf&8n1dBC2J?f*R4!1&|)U%c~MrXKmIOUzdO>;?b3L3xne|0W-r{P_p*e_J@&fI2{o z7YkPRQykIPNeFF1~0WNvpZ;r=N=A1gVMHuz>-{4SZ zeb34x))TC$hPige7e2GrGFjZKe9oGhJ(LfHZcV^8KGN3jRmM}s7T;BVT&QAS85`Id z_wPTa<=0wqXD#uNz#QUj;fN6b+?jLk@eCPc(Lp!OZYB4-UHzhf{&d41YEatd2O4zn zLjg*{A0P-G^GgohdG5~!Vu4_b>#0y&3c>Fb=ocL<4b;Q`Rf8b^uZCmR(oS&cW-M*H z;Fz|w6<+gyZ8(;t;qB4=ZH2Cv@v{5v@OdwuPIx_IspW&E!S6mOpDf=jA1w`vg@S2e gNcr9-Re=QtR4(BUM=X__m1D15gCB|r3s`@@21R2hbN~PV diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 2d7632e8..e4b74425 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -6,6 +6,8 @@ use brightness::blocking::Brightness; use trayicon::*; use winapi::um::winuser; +const LOGO_32_ICO: &[u8] = include_bytes!("../res/logo_cropped_transparent_32x32.ico"); + fn main() { #[derive(Copy, Clone, Eq, PartialEq, Debug)] enum Events { @@ -24,7 +26,7 @@ fn main() { } let (s, r) = std::sync::mpsc::channel::(); - let icon = include_bytes!("icon1.ico"); + let icon = LOGO_32_ICO; let icon2 = include_bytes!("icon2.ico"); let second_icon = Icon::from_buffer(icon2, None, None).unwrap(); From 1fb1eed3ac96d7d2861dc40bc5061f8bd3e6af97 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 15 Jul 2023 17:50:48 +0800 Subject: [PATCH 06/25] frameworkd: Keep console mode in debug builds Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index e4b74425..4b126f53 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -1,4 +1,6 @@ -#![windows_subsystem = "windows"] +// In debug builds don't disable terminal +// Otherwise we can't see println and can't exit with CTRL+C +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] use core::mem::MaybeUninit; From 590b3b6773a7e27729f9e52d3676ac1bfeacf949 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 15 Jul 2023 17:52:29 +0800 Subject: [PATCH 07/25] frameworkd: POC allow starting other apps Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 4b126f53..dad3f409 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -3,6 +3,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] use core::mem::MaybeUninit; +use std::process::Command; use brightness::blocking::Brightness; use trayicon::*; @@ -10,6 +11,19 @@ use winapi::um::winuser; const LOGO_32_ICO: &[u8] = include_bytes!("../res/logo_cropped_transparent_32x32.ico"); +enum Tool { + QmkGui, + LedmatrixControl, +} + +fn launch_tool(t: Tool) { + let path = match t { + Tool::QmkGui => r"C:\Program Files\Framework Computer\qmk_gui.exe", + Tool::LedmatrixControl => r"C:\Program Files\Framework Computer\ledmatrix_control.exe", + }; + Command::new(path).spawn().unwrap(); +} + fn main() { #[derive(Copy, Clone, Eq, PartialEq, Debug)] enum Events { @@ -25,6 +39,8 @@ fn main() { SubItem1, SubItem2, SubItem3, + LaunchQmkGui, + LaunchLedmatrixControl, } let (s, r) = std::sync::mpsc::channel::(); @@ -45,6 +61,13 @@ fn main() { .on_double_click(Events::DoubleClickTrayIcon) .menu( MenuBuilder::new() + .submenu( + "Launch Inputmodule Apps", + MenuBuilder::new() + .item("Keyboard (QMK GUI)", Events::LaunchQmkGui) + .item("LED Matrix", Events::LaunchLedmatrixControl), + ) + .separator() .item("Item 4 Set Tooltip", Events::Item4) .item("Item 3 Replace Menu 👍", Events::Item3) .item("Item 2 Change Icon Green", Events::Item2) @@ -73,6 +96,8 @@ fn main() { std::thread::spawn(move || { r.iter().for_each(|m| match m { + Events::LaunchQmkGui => launch_tool(Tool::QmkGui), + Events::LaunchLedmatrixControl => launch_tool(Tool::LedmatrixControl), Events::DoubleClickTrayIcon => { println!("Double click"); let devs = brightness::blocking::brightness_devices(); From f8d38312d662918f4ced8f6b2cca464583e63d88 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 16 Jul 2023 10:44:31 +0800 Subject: [PATCH 08/25] frameworkd: Add numlock indicator and toggle Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 172 +++++++++++++++++++++++++++++------------ 1 file changed, 123 insertions(+), 49 deletions(-) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index dad3f409..f916bcb6 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -4,6 +4,8 @@ use core::mem::MaybeUninit; use std::process::Command; +use std::thread; +use std::time::Duration; use brightness::blocking::Brightness; use trayicon::*; @@ -11,6 +13,29 @@ use winapi::um::winuser; const LOGO_32_ICO: &[u8] = include_bytes!("../res/logo_cropped_transparent_32x32.ico"); +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +enum Events { + ClickTrayIcon, + DoubleClickTrayIcon, + Exit, + Item1, + Item2, + Item3, + Item4, + DisabledItem1, + CheckItem1, + SubItem1, + SubItem2, + SubItem3, + LaunchQmkGui, + LaunchLedmatrixControl, + SyncKeyboards, + SyncKeyboardScreen, + NumLockOn, + NumLockOff, + NumLockToggle, +} + enum Tool { QmkGui, LedmatrixControl, @@ -24,25 +49,74 @@ fn launch_tool(t: Tool) { Command::new(path).spawn().unwrap(); } -fn main() { - #[derive(Copy, Clone, Eq, PartialEq, Debug)] - enum Events { - ClickTrayIcon, - DoubleClickTrayIcon, - Exit, - Item1, - Item2, - Item3, - Item4, - DisabledItem1, - CheckItem1, - SubItem1, - SubItem2, - SubItem3, - LaunchQmkGui, - LaunchLedmatrixControl, + +fn add_menu(menu: MenuBuilder, icon: &'static [u8], nm: Events) -> MenuBuilder { + let nm_str = match nm { + Events::NumLockOff => "Numlock Off (Arrow Keys)", + Events::NumLockOn => "Numlock On (Number Keys)", + _ => "???", + }; + menu.submenu( + "Launch Inputmodule Apps", + MenuBuilder::new() + .item("Keyboard (QMK GUI)", Events::LaunchQmkGui) + .item("LED Matrix", Events::LaunchLedmatrixControl), + ) + .separator() + // TODO + // .item("Sync keyboard brightness", Events::SyncKeyboards) + .item( + "Sync keyboard brightness with screen", + Events::SyncKeyboardScreen, + ) + //.separator() + //.item("Item 4 Set Tooltip", Events::Item4) + //.item("Item 3 Replace Menu 👍", Events::Item3) + //.item("Item 2 Change Icon Green", Events::Item2) + //.item("Item 1 Change Icon Red", Events::Item1) + //.separator() + //.checkable("This is checkable", true, Events::CheckItem1) + //.submenu( + // "Sub Menu", + // MenuBuilder::new() + // .item("Sub item 1", Events::SubItem1) + // .item("Sub Item 2", Events::SubItem2) + // .item("Sub Item 3", Events::SubItem3), + //) + //.checkable("This checkbox toggles disable", true, Events::CheckItem1) + .with(MenuItem::Item { + name: nm_str.into(), + disabled: false, + id: Events::NumLockToggle, + icon: Result::ok(Icon::from_buffer(icon, None, None)), + }) + //.with(MenuItem::Item { + // name: "Item Disabled".into(), + // disabled: true, // Disabled entry example + // id: Events::DisabledItem1, + // icon: Result::ok(Icon::from_buffer(icon, None, None)), + //}) + .separator() + .item("E&xit", Events::Exit) +} + +/// Check if numlock is enabled +/// +/// Enabled means number mode, disabled means arrow mode +fn numlock_enabled() -> bool { + use winapi::um::winuser::*; + unsafe { GetKeyState(VK_NUMLOCK) == 1 } +} + +fn numlock_toggle() { + use winapi::um::winuser::*; + unsafe { + keybd_event(VK_NUMLOCK as u8, 0x3A, 0x1, 0); + keybd_event(VK_NUMLOCK as u8, 0x3A, 0x3, 0); } +} +fn main() { let (s, r) = std::sync::mpsc::channel::(); let icon = LOGO_32_ICO; let icon2 = include_bytes!("icon2.ico"); @@ -50,6 +124,8 @@ fn main() { let second_icon = Icon::from_buffer(icon2, None, None).unwrap(); let first_icon = Icon::from_buffer(icon, None, None).unwrap(); + let periodic_s = s.clone(); + // Needlessly complicated tray icon with all the whistles and bells let mut tray_icon = TrayIconBuilder::new() .sender(move |e: &Events| { @@ -59,43 +135,26 @@ fn main() { .tooltip("Cool Tray 👀 Icon") .on_click(Events::ClickTrayIcon) .on_double_click(Events::DoubleClickTrayIcon) - .menu( - MenuBuilder::new() - .submenu( - "Launch Inputmodule Apps", - MenuBuilder::new() - .item("Keyboard (QMK GUI)", Events::LaunchQmkGui) - .item("LED Matrix", Events::LaunchLedmatrixControl), - ) - .separator() - .item("Item 4 Set Tooltip", Events::Item4) - .item("Item 3 Replace Menu 👍", Events::Item3) - .item("Item 2 Change Icon Green", Events::Item2) - .item("Item 1 Change Icon Red", Events::Item1) - .separator() - .checkable("This is checkable", true, Events::CheckItem1) - .submenu( - "Sub Menu", - MenuBuilder::new() - .item("Sub item 1", Events::SubItem1) - .item("Sub Item 2", Events::SubItem2) - .item("Sub Item 3", Events::SubItem3), - ) - .checkable("This checkbox toggles disable", true, Events::CheckItem1) - .with(MenuItem::Item { - name: "Item Disabled".into(), - disabled: true, // Disabled entry example - id: Events::DisabledItem1, - icon: Result::ok(Icon::from_buffer(icon, None, None)), - }) - .separator() - .item("E&xit", Events::Exit), - ) + .menu(add_menu(MenuBuilder::new(), icon, Events::NumLockOn)) .build() .unwrap(); + std::thread::spawn(move || loop { + // TODO: Check if it changed and if not, don't send events + if numlock_enabled() { + periodic_s.send(Events::NumLockOn).unwrap(); + } else { + periodic_s.send(Events::NumLockOff).unwrap(); + } + + thread::sleep(Duration::from_secs(1)); + }); + std::thread::spawn(move || { r.iter().for_each(|m| match m { + // About Popup + // FontAwesome Icon + // Events::About => {}, Events::LaunchQmkGui => launch_tool(Tool::QmkGui), Events::LaunchLedmatrixControl => launch_tool(Tool::LedmatrixControl), Events::DoubleClickTrayIcon => { @@ -125,6 +184,21 @@ fn main() { Events::Item2 => { tray_icon.set_icon(&first_icon).unwrap(); } + Events::NumLockToggle => { + numlock_toggle(); + } + Events::NumLockOn => { + //println!("Turning numlock on"); + tray_icon + .set_menu(&add_menu(MenuBuilder::new(), icon, Events::NumLockOn)) + .unwrap(); + } + Events::NumLockOff => { + //println!("Turning numlock off"); + tray_icon + .set_menu(&add_menu(MenuBuilder::new(), icon, Events::NumLockOff)) + .unwrap(); + } Events::Item3 => { tray_icon .set_menu( From 66446c03f8f7cdb623591994410694a2e4673cce Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 16 Jul 2023 10:45:14 +0800 Subject: [PATCH 09/25] frameworkd: POC sync keyboard and display brightness Signed-off-by: Daniel Schaefer --- Cargo.lock | 11 +++++++ frameworkd/Cargo.toml | 1 + frameworkd/src/main.rs | 69 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 8b64433a..ad1b93c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -814,6 +814,7 @@ version = "0.1.0" dependencies = [ "brightness", "framework_lib", + "qmk_hid", "trayicon", "winapi", ] @@ -1556,6 +1557,16 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "qmk_hid" +version = "0.1.12" +source = "git+https://github.com/FrameworkComputer/qmk_hid#8129c40a8ffabff06d866c821c1a0e5e16958062" +dependencies = [ + "clap", + "hidapi", + "static_vcruntime", +] + [[package]] name = "quote" version = "1.0.47" diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index e11eecac..7a5080a6 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -8,6 +8,7 @@ trayicon = "0.2" winapi = { version = "0.3.9", features = ["winuser", "windef", "minwindef", "shellapi", "libloaderapi", "commctrl", "basetsd"] } #crossbeam-channel = "0.5" brightness = "0.5.0" +qmk_hid = { git = 'https://github.com/FrameworkComputer/qmk_hid' } [dependencies.framework_lib] path = "../framework_lib" diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index f916bcb6..296e1e7f 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -8,9 +8,16 @@ use std::thread; use std::time::Duration; use brightness::blocking::Brightness; +use qmk_hid::via; use trayicon::*; use winapi::um::winuser; +#[repr(u16)] +enum FrameworkPid { + Macropad = 0x0012, + IsoKeyboard = 0x0018, +} + const LOGO_32_ICO: &[u8] = include_bytes!("../res/logo_cropped_transparent_32x32.ico"); #[derive(Copy, Clone, Eq, PartialEq, Debug)] @@ -49,6 +56,64 @@ fn launch_tool(t: Tool) { Command::new(path).spawn().unwrap(); } +fn sync_keyboards() {} + +fn sync_keyboard_screen() { + println!("Sync"); + match qmk_hid::new_hidapi() { + Ok(api) => { + let found = qmk_hid::find_devices(&api, true, false, Some("32ac"), None); + + let dev_infos = found.raw_usages; + + let dev_info = if dev_infos.is_empty() { + println!("No device found"); + return; + } else if dev_infos.len() == 1 { + //println!("Found one device"); + dev_infos.get(0).unwrap() + } else { + println!("More than 1 device found. Select a specific device with --vid and --pid"); + dev_infos.get(0).unwrap() + }; + //println!("Open"); + let device = dev_info.open_device(&api).unwrap(); + //println!("Opened"); + + //println!("Get RGB"); + let rgb_brightness = + via::get_rgb_u8(&device, via::ViaRgbMatrixValue::Brightness as u8).unwrap(); + //println!("Get white"); + let white_brightness = + via::get_backlight(&device, via::ViaBacklightValue::Brightness as u8).unwrap(); + // println!("RGB: {}/255 White: {}/255", rgb_brightness, brightness); + + // TODO: In firmware it should sync both brightnesses + let pid = dev_info.product_id(); + let brightness = if pid == FrameworkPid::IsoKeyboard as u16 { + white_brightness + // } else if pid == FrameworkPid::Macropad as u16 { + // white_brightness + } else if pid == FrameworkPid::Macropad as u16 { + rgb_brightness + } else { + white_brightness + }; + + let percent = (brightness as u32) * 100 / 255; + println!("Brightness: {}/255, {}%", brightness, percent); + + let devs = brightness::blocking::brightness_devices(); + for dev in devs { + let dev = dev.unwrap(); + dev.set(percent).unwrap(); + } + } + Err(e) => { + eprintln!("Error: {e}"); + } + }; +} fn add_menu(menu: MenuBuilder, icon: &'static [u8], nm: Events) -> MenuBuilder { let nm_str = match nm { @@ -157,6 +222,9 @@ fn main() { // Events::About => {}, Events::LaunchQmkGui => launch_tool(Tool::QmkGui), Events::LaunchLedmatrixControl => launch_tool(Tool::LedmatrixControl), + Events::SyncKeyboards => sync_keyboards(), + Events::SyncKeyboardScreen => sync_keyboard_screen(), + Events::DoubleClickTrayIcon => { println!("Double click"); let devs = brightness::blocking::brightness_devices(); @@ -174,6 +242,7 @@ fn main() { println!("{:?}", dev.device_name()); println!(" {:?}", dev.get()); } + sync_keyboard_screen(); } Events::Exit => { std::process::exit(0); From bd6131bc1b3e2cd2386f56b21fa16b7e027b2cfb Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 16 Jul 2023 11:22:47 +0800 Subject: [PATCH 10/25] frameworkd: Add entries to launch useful websites Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 296e1e7f..4c42a710 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -19,6 +19,11 @@ enum FrameworkPid { } const LOGO_32_ICO: &[u8] = include_bytes!("../res/logo_cropped_transparent_32x32.ico"); +const VIA_URL: &str = "https://usevia.app"; +const FWK_MARKETPLACE: &str = "https://frame.work/marketplace"; +const FWK_COMMUNITY: &str = "https://community.frame.work"; +const FWK_KB: &str = "https://knowledgebase.frame.work/"; +const FWK_GUIDES: &str = "https://guides.frame.work/c/Root"; #[derive(Copy, Clone, Eq, PartialEq, Debug)] enum Events { @@ -34,8 +39,13 @@ enum Events { SubItem1, SubItem2, SubItem3, + LaunchVia, LaunchQmkGui, LaunchLedmatrixControl, + LaunchMarketplace, + LaunchCommunity, + LaunchKb, + LaunchGuides, SyncKeyboards, SyncKeyboardScreen, NumLockOn, @@ -48,6 +58,41 @@ enum Tool { LedmatrixControl, } +fn to_wstring(value: &str) -> Vec { + use std::os::windows::ffi::OsStrExt; + + std::ffi::OsStr::new(value) + .encode_wide() + .chain(std::iter::once(0)) + .collect() +} + +fn launch_website(url: &str) { + println!("Launch: {:?}", url); + use std::ptr::null_mut; + use winapi::um::shellapi::*; + use winapi::um::winuser::*; + let wurl = to_wstring(url).as_ptr(); + let action = to_wstring("open").as_ptr(); + let ret = unsafe { + ShellExecuteW( + null_mut(), + action, + wurl, + null_mut(), + null_mut(), + SW_SHOWNORMAL, + ) + }; + // TODO: Sometimes it fails with 0x1F, which I think is SE_ERR_NOASSOC + // Not sure why, maybe just retry? + println!( + "Launch: done with {:?}, success: {:?}", + ret, + (ret as u8) > 32 + ); +} + fn launch_tool(t: Tool) { let path = match t { Tool::QmkGui => r"C:\Program Files\Framework Computer\qmk_gui.exe", @@ -124,6 +169,7 @@ fn add_menu(menu: MenuBuilder, icon: &'static [u8], nm: Events) -> MenuB menu.submenu( "Launch Inputmodule Apps", MenuBuilder::new() + .item("Keyboard (VIA)", Events::LaunchVia) .item("Keyboard (QMK GUI)", Events::LaunchQmkGui) .item("LED Matrix", Events::LaunchLedmatrixControl), ) @@ -162,6 +208,15 @@ fn add_menu(menu: MenuBuilder, icon: &'static [u8], nm: Events) -> MenuB // icon: Result::ok(Icon::from_buffer(icon, None, None)), //}) .separator() + .submenu( + "Framework Websites", + MenuBuilder::new() + .item("Marketplace", Events::LaunchMarketplace) + .item("Community", Events::LaunchCommunity) + .item("Knowledge Base", Events::LaunchKb) + .item("Guides", Events::LaunchGuides), + ) + .separator() .item("E&xit", Events::Exit) } @@ -220,8 +275,13 @@ fn main() { // About Popup // FontAwesome Icon // Events::About => {}, + Events::LaunchVia => launch_website(VIA_URL), Events::LaunchQmkGui => launch_tool(Tool::QmkGui), Events::LaunchLedmatrixControl => launch_tool(Tool::LedmatrixControl), + Events::LaunchMarketplace => launch_website(FWK_MARKETPLACE), + Events::LaunchCommunity => launch_website(FWK_COMMUNITY), + Events::LaunchKb => launch_website(FWK_KB), + Events::LaunchGuides => launch_website(FWK_GUIDES), Events::SyncKeyboards => sync_keyboards(), Events::SyncKeyboardScreen => sync_keyboard_screen(), From f0d871d4f8483cd550a94ea7b6939af4b79d0e91 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 16 Jul 2023 13:23:34 +0800 Subject: [PATCH 11/25] frameworkd: Sync keyboard brightnesses periodically Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 111 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 108 insertions(+), 3 deletions(-) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 4c42a710..adef0ab1 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -3,6 +3,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] use core::mem::MaybeUninit; +use std::collections::HashMap; use std::process::Command; use std::thread; use std::time::Duration; @@ -101,13 +102,112 @@ fn launch_tool(t: Tool) { Command::new(path).spawn().unwrap(); } -fn sync_keyboards() {} +fn sync_keyboards(prev_brightness: &mut HashMap) { + match qmk_hid::new_hidapi() { + Ok(api) => { + let found = qmk_hid::find_devices(&api, false, false, Some("32ac"), None); + + let dev_infos = found.raw_usages; + + if dev_infos.len() <= 1 { + // No need to sync + return; + } + + for dev_info in &dev_infos { + let device = dev_info.open_device(&api).unwrap(); + let white_brightness = + via::get_backlight(&device, via::ViaBacklightValue::Brightness as u8).unwrap(); + let rgb_brightness = + via::get_rgb_u8(&device, via::ViaRgbMatrixValue::Brightness as u8).unwrap(); + //println!("{:?}", dev_info.product_string()); + //println!(" RGB: {}/255 White: {}/255", rgb_brightness, white_brightness); + + let mut br_changed = false; + let mut rgb_br_changed = false; + + let path = dev_info.path(); + if let Some((prev_white, prev_rgb)) = prev_brightness.get(path) { + if white_brightness != *prev_white { + // println!("White changed from {} to {}", prev_white, white_brightness); + br_changed = true + } + if rgb_brightness != *prev_rgb { + // println!("RGB changed from {} to {}", prev_rgb, rgb_brightness); + rgb_br_changed = true + } + } + prev_brightness.insert(path.into(), (white_brightness, rgb_brightness)); + + if br_changed || rgb_br_changed { + // Update other keyboards + let new_brightness = if br_changed { + white_brightness + } else { + rgb_brightness + }; + // println!("Updating based on {:?}", dev_info.product_string()); + // println!(" Updating other keyboards to {}", new_brightness); + for other_info in &dev_infos { + if path == other_info.path() { + continue; + } + // println!(" Updating {:?}", other_info.product_string()); + { + let other_device = other_info.open_device(&api).unwrap(); + via::set_backlight( + &other_device, + via::ViaBacklightValue::Brightness as u8, + new_brightness, + ) + .unwrap(); + via::set_rgb_u8( + &other_device, + via::ViaRgbMatrixValue::Brightness as u8, + new_brightness, + ) + .unwrap(); + } + + // Avoid triggering an update in the other direction + // Need to read the value since the keyboard might only have 3 brightness levels, + // if that's the case, the value we set and the value the keyboard sets itself to are not the same. + // Seems we have to sleep a bit and also connect to the device again to make the change visible. + // TODO: Figure out why QMK changes the value also on the RGB which should have all 255 levels + thread::sleep(Duration::from_millis(100)); + { + let other_device = other_info.open_device(&api).unwrap(); + let actual_white = via::get_backlight( + &other_device, + via::ViaBacklightValue::Brightness as u8, + ) + .unwrap(); + let actual_rgb = via::get_rgb_u8( + &other_device, + via::ViaRgbMatrixValue::Brightness as u8, + ) + .unwrap(); + // println!(" Actually set to white: {}, rgb: {}", actual_white, actual_rgb); + prev_brightness + .insert(other_info.path().into(), (actual_white, actual_rgb)); + } + } + break; + } + } + //println!(); + } + Err(e) => { + eprintln!("Error: {e}"); + } + }; +} fn sync_keyboard_screen() { println!("Sync"); match qmk_hid::new_hidapi() { Ok(api) => { - let found = qmk_hid::find_devices(&api, true, false, Some("32ac"), None); + let found = qmk_hid::find_devices(&api, false, false, Some("32ac"), None); let dev_infos = found.raw_usages; @@ -259,6 +359,8 @@ fn main() { .build() .unwrap(); + let mut prev_brightness = HashMap::new(); + std::thread::spawn(move || loop { // TODO: Check if it changed and if not, don't send events if numlock_enabled() { @@ -267,6 +369,9 @@ fn main() { periodic_s.send(Events::NumLockOff).unwrap(); } + //sync_keyboard_screen(); + sync_keyboards(&mut prev_brightness); + thread::sleep(Duration::from_secs(1)); }); @@ -282,7 +387,7 @@ fn main() { Events::LaunchCommunity => launch_website(FWK_COMMUNITY), Events::LaunchKb => launch_website(FWK_KB), Events::LaunchGuides => launch_website(FWK_GUIDES), - Events::SyncKeyboards => sync_keyboards(), + //Events::SyncKeyboards => sync_keyboards(), Events::SyncKeyboardScreen => sync_keyboard_screen(), Events::DoubleClickTrayIcon => { From 6b962364278e1e19ae150990ee619f172bb1449f Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 16 Jul 2023 15:16:14 +0800 Subject: [PATCH 12/25] frameworkd: Sync keyboard brightness to screen Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index adef0ab1..28181ff9 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -102,7 +102,8 @@ fn launch_tool(t: Tool) { Command::new(path).spawn().unwrap(); } -fn sync_keyboards(prev_brightness: &mut HashMap) { +// Returns percentage if brightness changed +fn sync_keyboards(prev_brightness: &mut HashMap) -> Option { match qmk_hid::new_hidapi() { Ok(api) => { let found = qmk_hid::find_devices(&api, false, false, Some("32ac"), None); @@ -111,7 +112,7 @@ fn sync_keyboards(prev_brightness: &mut HashMap) { if dev_infos.len() <= 1 { // No need to sync - return; + return None; } for dev_info in &dev_infos { @@ -192,7 +193,7 @@ fn sync_keyboards(prev_brightness: &mut HashMap) { .insert(other_info.path().into(), (actual_white, actual_rgb)); } } - break; + return Some((new_brightness as u32) * 100 / 255); } } //println!(); @@ -200,7 +201,8 @@ fn sync_keyboards(prev_brightness: &mut HashMap) { Err(e) => { eprintln!("Error: {e}"); } - }; + } + None } fn sync_keyboard_screen() { @@ -370,7 +372,13 @@ fn main() { } //sync_keyboard_screen(); - sync_keyboards(&mut prev_brightness); + if let Some(percentage) = sync_keyboards(&mut prev_brightness) { + let devs = brightness::blocking::brightness_devices(); + for dev in devs { + let dev = dev.unwrap(); + dev.set(percentage).unwrap(); + } + } thread::sleep(Duration::from_secs(1)); }); From 228b5f0239ae534c67b759be1b136172992b0c00 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 16 Jul 2023 21:42:00 +0800 Subject: [PATCH 13/25] frameworkd: Cleanup Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 91 +++++++++--------------------------------- 1 file changed, 19 insertions(+), 72 deletions(-) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 28181ff9..546ad42e 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -31,15 +31,6 @@ enum Events { ClickTrayIcon, DoubleClickTrayIcon, Exit, - Item1, - Item2, - Item3, - Item4, - DisabledItem1, - CheckItem1, - SubItem1, - SubItem2, - SubItem3, LaunchVia, LaunchQmkGui, LaunchLedmatrixControl, @@ -47,7 +38,7 @@ enum Events { LaunchCommunity, LaunchKb, LaunchGuides, - SyncKeyboards, + // SyncKeyboards, SyncKeyboardScreen, NumLockOn, NumLockOff, @@ -262,11 +253,11 @@ fn sync_keyboard_screen() { }; } -fn add_menu(menu: MenuBuilder, icon: &'static [u8], nm: Events) -> MenuBuilder { - let nm_str = match nm { - Events::NumLockOff => "Numlock Off (Arrow Keys)", - Events::NumLockOn => "Numlock On (Number Keys)", - _ => "???", +fn add_menu(menu: MenuBuilder, _icon: &'static [u8], nm: Events) -> MenuBuilder { + let (nm_str, nm_checked) = match nm { + Events::NumLockOff => ("Numlock Off (Arrow Keys)", false), + Events::NumLockOn => ("Numlock On (Number Keys)", true), + _ => ("???", false), }; menu.submenu( "Launch Inputmodule Apps", @@ -283,26 +274,7 @@ fn add_menu(menu: MenuBuilder, icon: &'static [u8], nm: Events) -> MenuB Events::SyncKeyboardScreen, ) //.separator() - //.item("Item 4 Set Tooltip", Events::Item4) - //.item("Item 3 Replace Menu 👍", Events::Item3) - //.item("Item 2 Change Icon Green", Events::Item2) - //.item("Item 1 Change Icon Red", Events::Item1) - //.separator() - //.checkable("This is checkable", true, Events::CheckItem1) - //.submenu( - // "Sub Menu", - // MenuBuilder::new() - // .item("Sub item 1", Events::SubItem1) - // .item("Sub Item 2", Events::SubItem2) - // .item("Sub Item 3", Events::SubItem3), - //) - //.checkable("This checkbox toggles disable", true, Events::CheckItem1) - .with(MenuItem::Item { - name: nm_str.into(), - disabled: false, - id: Events::NumLockToggle, - icon: Result::ok(Icon::from_buffer(icon, None, None)), - }) + .checkable(nm_str, nm_checked, Events::NumLockToggle) //.with(MenuItem::Item { // name: "Item Disabled".into(), // disabled: true, // Disabled entry example @@ -341,10 +313,9 @@ fn numlock_toggle() { fn main() { let (s, r) = std::sync::mpsc::channel::(); let icon = LOGO_32_ICO; - let icon2 = include_bytes!("icon2.ico"); - - let second_icon = Icon::from_buffer(icon2, None, None).unwrap(); - let first_icon = Icon::from_buffer(icon, None, None).unwrap(); + // let icon2 = include_bytes!("icon2.ico"); + // let second_icon = Icon::from_buffer(icon2, None, None).unwrap(); + // let first_icon = Icon::from_buffer(icon, None, None).unwrap(); let periodic_s = s.clone(); @@ -420,12 +391,6 @@ fn main() { Events::Exit => { std::process::exit(0); } - Events::Item1 => { - tray_icon.set_icon(&second_icon).unwrap(); - } - Events::Item2 => { - tray_icon.set_icon(&first_icon).unwrap(); - } Events::NumLockToggle => { numlock_toggle(); } @@ -440,33 +405,15 @@ fn main() { tray_icon .set_menu(&add_menu(MenuBuilder::new(), icon, Events::NumLockOff)) .unwrap(); - } - Events::Item3 => { - tray_icon - .set_menu( - &MenuBuilder::new() - .item("New menu item", Events::Item1) - .item("Exit", Events::Exit), - ) - .unwrap(); - } - Events::CheckItem1 => { - // You can mutate single checked, disabled value followingly. - // - // However, I think better way is to use reactively - // `set_menu` by building the menu based on application - // state. - if let Some(old_value) = tray_icon.get_menu_item_checkable(Events::CheckItem1) { - // Set checkable example - let _ = tray_icon.set_menu_item_checkable(Events::CheckItem1, !old_value); - - // Set disabled example - let _ = tray_icon.set_menu_item_disabled(Events::DisabledItem1, !old_value); - } - } - e => { - println!("{:?}", e); - } + } // Events::Item1 => { + // tray_icon.set_icon(&second_icon).unwrap(); + // } + // Events::Item2 => { + // tray_icon.set_icon(&first_icon).unwrap(); + // } + // e => { + // println!("{:?}", e); + // } }) }); From 1d087e5dafef9384b002c6e88c70078e925fb139 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 17 Jul 2023 14:27:43 +0800 Subject: [PATCH 14/25] frameworkd: Send notification if numlock state changed Signed-off-by: Daniel Schaefer --- Cargo.lock | 102 ++++++++++++++++++++++++++++++++++++++--- frameworkd/Cargo.toml | 1 + frameworkd/src/main.rs | 42 ++++++++++++++--- 3 files changed, 132 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad1b93c1..156640f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -431,7 +431,7 @@ version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "syn 3.0.6", @@ -817,6 +817,7 @@ dependencies = [ "qmk_hid", "trayicon", "winapi", + "winrt-notification", ] [[package]] @@ -995,6 +996,15 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "heck" version = "0.5.0" @@ -1021,15 +1031,15 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hidapi" -version = "2.6.7" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818c0e1d27887aaf76fe737042e27a66b796a7b099e6d2e1a72d106c2dff3fa6" +checksum = "565dd4c730b8f8b2c0fb36df6be12e5470ae10895ddcc4e9dcfbfb495de202b0" dependencies = [ "cc", "cfg-if", "libc", "pkg-config", - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] @@ -1559,8 +1569,8 @@ dependencies = [ [[package]] name = "qmk_hid" -version = "0.1.12" -source = "git+https://github.com/FrameworkComputer/qmk_hid#8129c40a8ffabff06d866c821c1a0e5e16958062" +version = "0.1.13" +source = "git+https://github.com/FrameworkComputer/qmk_hid#8f02fe5e34e27dc60260ee564e86a11f2dc7ca87" dependencies = [ "clap", "hidapi", @@ -1887,6 +1897,27 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "strum" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb" +dependencies = [ + "heck 0.3.3", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "syn" version = "1.0.109" @@ -2144,6 +2175,12 @@ version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + [[package]] name = "utf8parse" version = "0.2.2" @@ -2267,6 +2304,18 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9f39345ae0c8ab072c0ac7fe8a8b411636aa34f89be19ddd0d9226544f13944" +dependencies = [ + "windows_i686_gnu 0.24.0", + "windows_i686_msvc 0.24.0", + "windows_x86_64_gnu 0.24.0", + "windows_x86_64_msvc 0.24.0", +] + [[package]] name = "windows" version = "0.39.0" @@ -2493,6 +2542,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0866510a3eca9aed73a077490bbbf03e5eaac4e1fd70849d89539e5830501fd" + [[package]] name = "windows_i686_gnu" version = "0.39.0" @@ -2517,6 +2572,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf0ffed56b7e9369a29078d2ab3aaeceea48eb58999d2cff3aa2494a275b95c6" + [[package]] name = "windows_i686_msvc" version = "0.39.0" @@ -2535,6 +2596,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384a173630588044205a2993b6864a2f56e5a8c1e7668c07b93ec18cf4888dc4" + [[package]] name = "windows_x86_64_gnu" version = "0.39.0" @@ -2565,6 +2632,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd8f062d8ca5446358159d79a90be12c543b3a965c847c8f3eedf14b321d399" + [[package]] name = "windows_x86_64_msvc" version = "0.39.0" @@ -2628,6 +2701,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "winrt-notification" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007a0353840b23e0c6dc73e5b962ff58ed7f6bc9ceff3ce7fe6fbad8d496edf4" +dependencies = [ + "strum", + "windows 0.24.0", + "xml-rs", +] + [[package]] name = "wrapcenum-derive" version = "0.4.1" @@ -2650,6 +2734,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + [[package]] name = "zbus" version = "3.15.2" diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index 7a5080a6..6743101a 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -9,6 +9,7 @@ winapi = { version = "0.3.9", features = ["winuser", "windef", "minwindef", "she #crossbeam-channel = "0.5" brightness = "0.5.0" qmk_hid = { git = 'https://github.com/FrameworkComputer/qmk_hid' } +winrt-notification = "0.5.1" [dependencies.framework_lib] path = "../framework_lib" diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 546ad42e..a29f38e8 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -12,6 +12,7 @@ use brightness::blocking::Brightness; use qmk_hid::via; use trayicon::*; use winapi::um::winuser; +use winrt_notification::Toast; #[repr(u16)] enum FrameworkPid { @@ -50,6 +51,20 @@ enum Tool { LedmatrixControl, } +struct PrevValues { + brightness: HashMap, + numlock: bool, +} + +impl Default for PrevValues { + fn default() -> Self { + PrevValues { + brightness: HashMap::new(), + numlock: true, + } + } +} + fn to_wstring(value: &str) -> Vec { use std::os::windows::ffi::OsStrExt; @@ -332,18 +347,31 @@ fn main() { .build() .unwrap(); - let mut prev_brightness = HashMap::new(); + let mut prev_values = PrevValues::default(); std::thread::spawn(move || loop { - // TODO: Check if it changed and if not, don't send events - if numlock_enabled() { - periodic_s.send(Events::NumLockOn).unwrap(); - } else { - periodic_s.send(Events::NumLockOff).unwrap(); + let numlock_state = numlock_enabled(); + if numlock_state != prev_values.numlock { + let text = if numlock_state { + periodic_s.send(Events::NumLockOn).unwrap(); + "Numlock enabled" + } else { + periodic_s.send(Events::NumLockOff).unwrap(); + "Numlock disabled" + }; + // TODO: Figure out our own Application User Model ID + Toast::new(Toast::POWERSHELL_APP_ID) + .title("Framework Keyboard") + .text1(text) + .sound(None) + .duration(winrt_notification::Duration::Short) + .show() + .expect("unable to toast"); } + prev_values.numlock = numlock_state; //sync_keyboard_screen(); - if let Some(percentage) = sync_keyboards(&mut prev_brightness) { + if let Some(percentage) = sync_keyboards(&mut prev_values.brightness) { let devs = brightness::blocking::brightness_devices(); for dev in devs { let dev = dev.unwrap(); From 333288564055c5793eff6890e544e8a6cc56b0ef Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 17 Jul 2023 21:33:27 +0800 Subject: [PATCH 15/25] frameworkd: Add wix installer Mainly so that we can have an ApplicationUserModelId so that the notification can show the app's logo and name, not that of powershell. Build with: cargo wix -p frameworkd --nocapture -d Launch with: .\target\wix\frameworkd-0.1.0-x86_64.msi Signed-off-by: Daniel Schaefer --- Cargo.lock | 122 +++++++++++++++++++ framework_lib/Cargo.toml | 1 + frameworkd/Cargo.toml | 6 + frameworkd/build.rs | 7 ++ frameworkd/res/res.rc | 1 + frameworkd/src/main.rs | 25 +++- frameworkd/wix/main.wxs | 254 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 414 insertions(+), 2 deletions(-) create mode 100644 frameworkd/build.rs create mode 100644 frameworkd/res/res.rc create mode 100644 frameworkd/wix/main.wxs diff --git a/Cargo.lock b/Cargo.lock index 156640f7..ae75b734 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -459,6 +459,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" +[[package]] +name = "concat-string" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7439becb5fafc780b6f4de382b1a7a3e70234afe783854a4702ee8adbb838609" + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -468,6 +474,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "const-sha1" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb58b6451e8c2a812ad979ed1d83378caa5e927eef2622017a45f251457c2c9d" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -743,6 +755,17 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" +[[package]] +name = "find-winsdk" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cbf17b871570c1f8612b763bac3e86290602bcf5dc3c5ce657e0e1e9071d9e" +dependencies = [ + "serde", + "serde_derive", + "winreg 0.5.1", +] + [[package]] name = "fnv" version = "1.0.7" @@ -817,6 +840,8 @@ dependencies = [ "qmk_hid", "trayicon", "winapi", + "windows 0.3.1", + "windres", "winrt-notification", ] @@ -1879,6 +1904,12 @@ dependencies = [ "lock_api", ] +[[package]] +name = "squote" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fccf17fd09e2455ea796d2ad267b64fa2c5cbd8701b2a93b555d2aa73449f7d" + [[package]] name = "static_assertions" version = "1.1.0" @@ -2304,6 +2335,18 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "426842497696b65fbfc575691d94ef65befb248ed1a8c4361e293c724e7ebe61" +dependencies = [ + "const-sha1", + "windows_gen", + "windows_macros", + "windows_winmd", +] + [[package]] name = "windows" version = "0.24.0" @@ -2542,6 +2585,31 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_gen" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ac8f0f06b647f42ee5459a8e1ffe41795647582c5926ec3fa363a91aad7d77" +dependencies = [ + "proc-macro2", + "quote", + "squote", + "syn 1.0.109", + "windows_gen_macros", + "windows_winmd", +] + +[[package]] +name = "windows_gen_macros" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23eac2169a20173b890c496f9e0e1149a92ef29fe4ba96026b72eec363b993f9" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "windows_i686_gnu" version = "0.24.0" @@ -2596,6 +2664,40 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_macros" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edc57c944eec106c7823b425ab0fd9f90163489e50a4df747f65fcf9030e1fb" +dependencies = [ + "proc-macro2", + "quote", + "squote", + "syn 1.0.109", + "windows_gen", + "windows_winmd", +] + +[[package]] +name = "windows_winmd" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d44527d04c9713312ed598f5d6ce3c453754dbfc03ddc376615be4415ffc88" +dependencies = [ + "windows_winmd_macros", +] + +[[package]] +name = "windows_winmd_macros" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2353f43f512938450614a176abf2b6cb31ac3b84fd71c88470fee571303e3f36" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "windows_x86_64_gnu" version = "0.24.0" @@ -2656,6 +2758,16 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windres" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82115619221b2b66001a39088b8059d171b1f9005a00d6a10c6e8a71a30a4cdc" +dependencies = [ + "concat-string", + "find-winsdk", +] + [[package]] name = "winnow" version = "0.5.40" @@ -2671,6 +2783,16 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +[[package]] +name = "winreg" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a" +dependencies = [ + "serde", + "winapi", +] + [[package]] name = "winreg" version = "0.55.0" diff --git a/framework_lib/Cargo.toml b/framework_lib/Cargo.toml index 83b730ff..5a1031fc 100644 --- a/framework_lib/Cargo.toml +++ b/framework_lib/Cargo.toml @@ -1,4 +1,5 @@ [package] +authors = [ "Framework Computer Inc" ] name = "framework_lib" version = "0.6.6" description = "Library to control Framework Computer systems" diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index 6743101a..09464111 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "frameworkd" +authors = [ "Framework Computer Inc" ] version = "0.1.0" edition = "2021" @@ -10,6 +11,11 @@ winapi = { version = "0.3.9", features = ["winuser", "windef", "minwindef", "she brightness = "0.5.0" qmk_hid = { git = 'https://github.com/FrameworkComputer/qmk_hid' } winrt-notification = "0.5.1" +windows = "0.3" + +[build-dependencies] +windows = "0.3" +windres = "0.2" [dependencies.framework_lib] path = "../framework_lib" diff --git a/frameworkd/build.rs b/frameworkd/build.rs new file mode 100644 index 00000000..f118bbff --- /dev/null +++ b/frameworkd/build.rs @@ -0,0 +1,7 @@ +fn main() { + // if compiling for windows bundle the rc file + if cfg!(windows) { + windres::Build::new().compile("res/res.rc").unwrap(); + windows::build!(windows::win32::shell::SetCurrentProcessExplicitAppUserModelID); + } +} diff --git a/frameworkd/res/res.rc b/frameworkd/res/res.rc new file mode 100644 index 00000000..00fc6b42 --- /dev/null +++ b/frameworkd/res/res.rc @@ -0,0 +1 @@ +1 ICON "res\logo_cropped_transparent_32x32.ico" \ No newline at end of file diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index a29f38e8..abb3d0c8 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -1,6 +1,7 @@ // In debug builds don't disable terminal // Otherwise we can't see println and can't exit with CTRL+C -#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] +//#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] +#![windows_subsystem = "windows"] use core::mem::MaybeUninit; use std::collections::HashMap; @@ -325,7 +326,27 @@ fn numlock_toggle() { } } +#[cfg(windows)] +mod win_bindings { + ::windows::include_bindings!(); + pub use self::windows::win32::shell::SetCurrentProcessExplicitAppUserModelID; +} + fn main() { + unsafe { + win_bindings::SetCurrentProcessExplicitAppUserModelID( + to_wstring("work.frame.tray").as_ptr(), + ) + .unwrap(); + } + Toast::new("work.frame.tray") + .title("Framework Tray Application") + .text1("Started") + .sound(None) + .duration(winrt_notification::Duration::Short) + .show() + .expect("unable to toast"); + let (s, r) = std::sync::mpsc::channel::(); let icon = LOGO_32_ICO; // let icon2 = include_bytes!("icon2.ico"); @@ -360,7 +381,7 @@ fn main() { "Numlock disabled" }; // TODO: Figure out our own Application User Model ID - Toast::new(Toast::POWERSHELL_APP_ID) + Toast::new("work.frame.tray") .title("Framework Keyboard") .text1(text) .sound(None) diff --git a/frameworkd/wix/main.wxs b/frameworkd/wix/main.wxs new file mode 100644 index 00000000..27428eb2 --- /dev/null +++ b/frameworkd/wix/main.wxs @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + + + + + + + + + + + + + + + + + + From 24ce9f3e918e71e7333e00c7475c75f37567fbc4 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 18 Jul 2023 07:47:44 +0800 Subject: [PATCH 16/25] frameworkd: Build windows installer Signed-off-by: Daniel Schaefer --- .github/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22dc5f49..06f07386 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,3 +265,13 @@ jobs: - name: Run cargo doc run: cargo doc + + build-installer: + name: Build frameworkd Windows installer + runs-on: windows-latest + steps: + - name: Build installer + run: cargo wix -p frameworkd --nocapture -d + + - name: Check output + run: dir target\wix \ No newline at end of file From eadb985a531155e42a7288d503a6e5f818cfc7da Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 15 Nov 2024 13:30:28 +0800 Subject: [PATCH 17/25] frameworkd: Add right-click handler Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index abb3d0c8..cf06b416 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -30,7 +30,8 @@ const FWK_GUIDES: &str = "https://guides.frame.work/c/Root"; #[derive(Copy, Clone, Eq, PartialEq, Debug)] enum Events { - ClickTrayIcon, + RightClickTrayIcon, + LeftClickTrayIcon, DoubleClickTrayIcon, Exit, LaunchVia, @@ -361,8 +362,9 @@ fn main() { let _ = s.send(*e); }) .icon_from_buffer(icon) - .tooltip("Cool Tray 👀 Icon") - .on_click(Events::ClickTrayIcon) + .tooltip("Framework Computer") + .on_right_click(Events::RightClickTrayIcon) + .on_click(Events::LeftClickTrayIcon) .on_double_click(Events::DoubleClickTrayIcon) .menu(add_menu(MenuBuilder::new(), icon, Events::NumLockOn)) .build() @@ -426,7 +428,10 @@ fn main() { dev.set(50).unwrap(); } } - Events::ClickTrayIcon => { + Events::RightClickTrayIcon => { + tray_icon.show_menu().unwrap(); + } + Events::LeftClickTrayIcon => { println!("Single click"); let devs = brightness::blocking::brightness_devices(); for dev in devs { From a302bff1829abc07d2ca2e7e9d1673fdcf5b0b68 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 15 Nov 2024 14:29:24 +0800 Subject: [PATCH 18/25] frameworkd: Add touchpad/tabletmode functionality Signed-off-by: Daniel Schaefer --- frameworkd/Cargo.toml | 2 +- frameworkd/src/main.rs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index 09464111..7ceb794c 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -5,7 +5,7 @@ version = "0.1.0" edition = "2021" [dependencies] -trayicon = "0.2" +trayicon = { git = 'https://github.com/FrameworkComputer/trayicon-rs-private', branch = "auto-tablet-mode-touchpad" } winapi = { version = "0.3.9", features = ["winuser", "windef", "minwindef", "shellapi", "libloaderapi", "commctrl", "basetsd"] } #crossbeam-channel = "0.5" brightness = "0.5.0" diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index cf06b416..74b8014d 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -33,6 +33,8 @@ enum Events { RightClickTrayIcon, LeftClickTrayIcon, DoubleClickTrayIcon, + _ToggleTabletMode, + ToggleTouchpad, Exit, LaunchVia, LaunchQmkGui, @@ -308,6 +310,14 @@ fn add_menu(menu: MenuBuilder, _icon: &'static [u8], nm: Events) -> Menu .item("Guides", Events::LaunchGuides), ) .separator() + .submenu( + "Advanced", + MenuBuilder::new() + // TODO: Doesn't work when repeatedly called, I think + // we can't CreateFileW multiple times in the same process + // .item("Toggle tablet-mode", Events::ToggleTabletMode) + .item("Toggle touchpad enable", Events::ToggleTouchpad) + ) .item("E&xit", Events::Exit) } @@ -442,6 +452,16 @@ fn main() { } sync_keyboard_screen(); } + Events::_ToggleTabletMode => { + println!("Toggle Tablet Mode"); + use trayicon::touchpad_tabletmode; + let _ = touchpad_tabletmode::toggle_tabletmode(); + } + Events::ToggleTouchpad=> { + println!("Toggle Touchpad"); + use trayicon::touchpad_tabletmode; + let _ = touchpad_tabletmode::toggle_touchpad(); + } Events::Exit => { std::process::exit(0); } From 48267a6fb621a133e2a7799292549d615cce8d76 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 15 Nov 2024 14:29:48 +0800 Subject: [PATCH 19/25] frameworkd: Make work on non-lotus Signed-off-by: Daniel Schaefer --- frameworkd/Cargo.toml | 3 +++ frameworkd/src/main.rs | 42 +++++++++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index 7ceb794c..83b1e155 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -4,6 +4,9 @@ authors = [ "Framework Computer Inc" ] version = "0.1.0" edition = "2021" +[features] +lotus = [] + [dependencies] trayicon = { git = 'https://github.com/FrameworkComputer/trayicon-rs-private', branch = "auto-tablet-mode-touchpad" } winapi = { version = "0.3.9", features = ["winuser", "windef", "minwindef", "shellapi", "libloaderapi", "commctrl", "basetsd"] } diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 74b8014d..94bc7af6 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -278,20 +278,25 @@ fn add_menu(menu: MenuBuilder, _icon: &'static [u8], nm: Events) -> Menu Events::NumLockOn => ("Numlock On (Number Keys)", true), _ => ("???", false), }; - menu.submenu( + #[cfg(features = "lotus")] + let menu = menu.submenu( "Launch Inputmodule Apps", MenuBuilder::new() .item("Keyboard (VIA)", Events::LaunchVia) .item("Keyboard (QMK GUI)", Events::LaunchQmkGui) .item("LED Matrix", Events::LaunchLedmatrixControl), ) - .separator() + .separator(); + // TODO // .item("Sync keyboard brightness", Events::SyncKeyboards) - .item( + #[cfg(features = "lotus")] + let menu = menu.item( "Sync keyboard brightness with screen", Events::SyncKeyboardScreen, - ) + ); + + menu //.separator() .checkable(nm_str, nm_checked, Events::NumLockToggle) //.with(MenuItem::Item { @@ -432,10 +437,13 @@ fn main() { Events::DoubleClickTrayIcon => { println!("Double click"); - let devs = brightness::blocking::brightness_devices(); - for dev in devs { - let dev = dev.unwrap(); - dev.set(50).unwrap(); + #[cfg(features = "lotus")] + { + let devs = brightness::blocking::brightness_devices(); + for dev in devs { + let dev = dev.unwrap(); + dev.set(50).unwrap(); + } } } Events::RightClickTrayIcon => { @@ -443,14 +451,18 @@ fn main() { } Events::LeftClickTrayIcon => { println!("Single click"); - let devs = brightness::blocking::brightness_devices(); - for dev in devs { - // TODO: Skip unsupported monitors - let dev = dev.unwrap(); - println!("{:?}", dev.device_name()); - println!(" {:?}", dev.get()); + #[cfg(features = "lotus")] + { + let devs = brightness::blocking::brightness_devices(); + for dev in devs { + // TODO: Skip unsupported monitors + let dev = dev.unwrap(); + println!("{:?}", dev.device_name()); + println!(" {:?}", dev.get()); + } + sync_keyboard_screen(); } - sync_keyboard_screen(); + tray_icon.show_menu().unwrap(); } Events::_ToggleTabletMode => { println!("Toggle Tablet Mode"); From 60bf3d0ab5de81d99851eaae6e8dda45613a424c Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 15 Nov 2024 14:29:58 +0800 Subject: [PATCH 20/25] frameworkd: By default build as console subsystem Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 94bc7af6..9bb555b7 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -1,7 +1,6 @@ // In debug builds don't disable terminal // Otherwise we can't see println and can't exit with CTRL+C -//#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -#![windows_subsystem = "windows"] +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] use core::mem::MaybeUninit; use std::collections::HashMap; From 38734a452481f6d8663c2b803e12d587e0762743 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 14 Feb 2025 05:11:17 +0000 Subject: [PATCH 21/25] frameworkd: Switch aways from trayicon fork Don't need to disable touchpad from windows anymore. Signed-off-by: Daniel Schaefer --- frameworkd/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index 83b1e155..a8172a60 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" lotus = [] [dependencies] -trayicon = { git = 'https://github.com/FrameworkComputer/trayicon-rs-private', branch = "auto-tablet-mode-touchpad" } +trayicon = "0.2.0" winapi = { version = "0.3.9", features = ["winuser", "windef", "minwindef", "shellapi", "libloaderapi", "commctrl", "basetsd"] } #crossbeam-channel = "0.5" brightness = "0.5.0" From 3b2c395a95e8ceec9cb42371ce9e4dd87798d782 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 8 Nov 2026 11:10:56 +0800 Subject: [PATCH 22/25] frameworkd: Remove touchpad and tablet-mode menu items They depended on touchpad_tabletmode from the private trayicon fork, which is no longer used. Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index 9bb555b7..fe8aba2b 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -32,8 +32,6 @@ enum Events { RightClickTrayIcon, LeftClickTrayIcon, DoubleClickTrayIcon, - _ToggleTabletMode, - ToggleTouchpad, Exit, LaunchVia, LaunchQmkGui, @@ -314,14 +312,6 @@ fn add_menu(menu: MenuBuilder, _icon: &'static [u8], nm: Events) -> Menu .item("Guides", Events::LaunchGuides), ) .separator() - .submenu( - "Advanced", - MenuBuilder::new() - // TODO: Doesn't work when repeatedly called, I think - // we can't CreateFileW multiple times in the same process - // .item("Toggle tablet-mode", Events::ToggleTabletMode) - .item("Toggle touchpad enable", Events::ToggleTouchpad) - ) .item("E&xit", Events::Exit) } @@ -463,16 +453,6 @@ fn main() { } tray_icon.show_menu().unwrap(); } - Events::_ToggleTabletMode => { - println!("Toggle Tablet Mode"); - use trayicon::touchpad_tabletmode; - let _ = touchpad_tabletmode::toggle_tabletmode(); - } - Events::ToggleTouchpad=> { - println!("Toggle Touchpad"); - use trayicon::touchpad_tabletmode; - let _ = touchpad_tabletmode::toggle_touchpad(); - } Events::Exit => { std::process::exit(0); } From 81a425a43ae95ab88b6c3299c86f85cdca8eab35 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 8 Nov 2026 11:11:56 +0800 Subject: [PATCH 23/25] frameworkd: Run cargo fmt Signed-off-by: Daniel Schaefer --- frameworkd/src/main.rs | 55 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs index fe8aba2b..ce496a79 100644 --- a/frameworkd/src/main.rs +++ b/frameworkd/src/main.rs @@ -276,14 +276,15 @@ fn add_menu(menu: MenuBuilder, _icon: &'static [u8], nm: Events) -> Menu _ => ("???", false), }; #[cfg(features = "lotus")] - let menu = menu.submenu( - "Launch Inputmodule Apps", - MenuBuilder::new() - .item("Keyboard (VIA)", Events::LaunchVia) - .item("Keyboard (QMK GUI)", Events::LaunchQmkGui) - .item("LED Matrix", Events::LaunchLedmatrixControl), - ) - .separator(); + let menu = menu + .submenu( + "Launch Inputmodule Apps", + MenuBuilder::new() + .item("Keyboard (VIA)", Events::LaunchVia) + .item("Keyboard (QMK GUI)", Events::LaunchQmkGui) + .item("LED Matrix", Events::LaunchLedmatrixControl), + ) + .separator(); // TODO // .item("Sync keyboard brightness", Events::SyncKeyboards) @@ -294,25 +295,25 @@ fn add_menu(menu: MenuBuilder, _icon: &'static [u8], nm: Events) -> Menu ); menu - //.separator() - .checkable(nm_str, nm_checked, Events::NumLockToggle) - //.with(MenuItem::Item { - // name: "Item Disabled".into(), - // disabled: true, // Disabled entry example - // id: Events::DisabledItem1, - // icon: Result::ok(Icon::from_buffer(icon, None, None)), - //}) - .separator() - .submenu( - "Framework Websites", - MenuBuilder::new() - .item("Marketplace", Events::LaunchMarketplace) - .item("Community", Events::LaunchCommunity) - .item("Knowledge Base", Events::LaunchKb) - .item("Guides", Events::LaunchGuides), - ) - .separator() - .item("E&xit", Events::Exit) + //.separator() + .checkable(nm_str, nm_checked, Events::NumLockToggle) + //.with(MenuItem::Item { + // name: "Item Disabled".into(), + // disabled: true, // Disabled entry example + // id: Events::DisabledItem1, + // icon: Result::ok(Icon::from_buffer(icon, None, None)), + //}) + .separator() + .submenu( + "Framework Websites", + MenuBuilder::new() + .item("Marketplace", Events::LaunchMarketplace) + .item("Community", Events::LaunchCommunity) + .item("Knowledge Base", Events::LaunchKb) + .item("Guides", Events::LaunchGuides), + ) + .separator() + .item("E&xit", Events::Exit) } /// Check if numlock is enabled From b004049000c7f0940ebe2f6d5e7c7c0a6f354464 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 8 Nov 2026 11:14:57 +0800 Subject: [PATCH 24/25] framework_lib: Use io::Error::other Fixes clippy::io_other_error on newer Rust stable. Signed-off-by: Daniel Schaefer --- framework_lib/src/smart_battery.rs | 24 ++++++------------------ frameworkd/src/{main.rs => tray.rs} | 0 2 files changed, 6 insertions(+), 18 deletions(-) rename frameworkd/src/{main.rs => tray.rs} (100%) diff --git a/framework_lib/src/smart_battery.rs b/framework_lib/src/smart_battery.rs index dc1f2822..d4924977 100644 --- a/framework_lib/src/smart_battery.rs +++ b/framework_lib/src/smart_battery.rs @@ -708,29 +708,17 @@ fn read_password() -> io::Result { }; unsafe { - let handle = GetStdHandle(STD_INPUT_HANDLE).map_err(|e| { - io::Error::new( - io::ErrorKind::Other, - format!("Failed to get stdin handle: {}", e), - ) - })?; + let handle = GetStdHandle(STD_INPUT_HANDLE) + .map_err(|e| io::Error::other(format!("Failed to get stdin handle: {}", e)))?; let mut mode = CONSOLE_MODE::default(); - GetConsoleMode(handle, &mut mode).map_err(|e| { - io::Error::new( - io::ErrorKind::Other, - format!("Failed to get console mode: {}", e), - ) - })?; + GetConsoleMode(handle, &mut mode) + .map_err(|e| io::Error::other(format!("Failed to get console mode: {}", e)))?; // Disable echo let noecho = CONSOLE_MODE(mode.0 & !ENABLE_ECHO_INPUT.0); - SetConsoleMode(handle, noecho).map_err(|e| { - io::Error::new( - io::ErrorKind::Other, - format!("Failed to set console mode: {}", e), - ) - })?; + SetConsoleMode(handle, noecho) + .map_err(|e| io::Error::other(format!("Failed to set console mode: {}", e)))?; // Read the line let mut input = String::new(); diff --git a/frameworkd/src/main.rs b/frameworkd/src/tray.rs similarity index 100% rename from frameworkd/src/main.rs rename to frameworkd/src/tray.rs From 315861f0679940fec597edd99888a749a699cf14 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 8 Nov 2026 11:14:57 +0800 Subject: [PATCH 25/25] frameworkd: Make tray application Windows-only The tray dependencies only build on Windows, so move the tray code into its own module and only depend on them when targeting Windows. On other platforms frameworkd just prints that it's not supported yet. Also fix the clippy warnings, so CI passes: - Fix dangling pointers passed to ShellExecuteW - Fix cfg(features = "lotus") typo, which made it always disabled --- frameworkd/Cargo.toml | 5 +++-- frameworkd/build.rs | 3 ++- frameworkd/src/main.rs | 17 +++++++++++++++++ frameworkd/src/tray.rs | 32 ++++++++++++++++---------------- 4 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 frameworkd/src/main.rs diff --git a/frameworkd/Cargo.toml b/frameworkd/Cargo.toml index a8172a60..09fde611 100644 --- a/frameworkd/Cargo.toml +++ b/frameworkd/Cargo.toml @@ -7,7 +7,8 @@ edition = "2021" [features] lotus = [] -[dependencies] +# The tray application is Windows-only for now +[target.'cfg(windows)'.dependencies] trayicon = "0.2.0" winapi = { version = "0.3.9", features = ["winuser", "windef", "minwindef", "shellapi", "libloaderapi", "commctrl", "basetsd"] } #crossbeam-channel = "0.5" @@ -16,7 +17,7 @@ qmk_hid = { git = 'https://github.com/FrameworkComputer/qmk_hid' } winrt-notification = "0.5.1" windows = "0.3" -[build-dependencies] +[target.'cfg(windows)'.build-dependencies] windows = "0.3" windres = "0.2" diff --git a/frameworkd/build.rs b/frameworkd/build.rs index f118bbff..d28fbe0e 100644 --- a/frameworkd/build.rs +++ b/frameworkd/build.rs @@ -1,6 +1,7 @@ fn main() { // if compiling for windows bundle the rc file - if cfg!(windows) { + #[cfg(windows)] + if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") { windres::Build::new().compile("res/res.rc").unwrap(); windows::build!(windows::win32::shell::SetCurrentProcessExplicitAppUserModelID); } diff --git a/frameworkd/src/main.rs b/frameworkd/src/main.rs new file mode 100644 index 00000000..46642333 --- /dev/null +++ b/frameworkd/src/main.rs @@ -0,0 +1,17 @@ +// In debug builds don't disable terminal +// Otherwise we can't see println and can't exit with CTRL+C +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +#[cfg(windows)] +mod tray; + +#[cfg(windows)] +fn main() { + tray::main(); +} + +#[cfg(not(windows))] +fn main() { + eprintln!("frameworkd is currently only supported on Windows"); + std::process::exit(1); +} diff --git a/frameworkd/src/tray.rs b/frameworkd/src/tray.rs index ce496a79..8edec648 100644 --- a/frameworkd/src/tray.rs +++ b/frameworkd/src/tray.rs @@ -1,7 +1,3 @@ -// In debug builds don't disable terminal -// Otherwise we can't see println and can't exit with CTRL+C -#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] - use core::mem::MaybeUninit; use std::collections::HashMap; use std::process::Command; @@ -27,6 +23,8 @@ const FWK_COMMUNITY: &str = "https://community.frame.work"; const FWK_KB: &str = "https://knowledgebase.frame.work/"; const FWK_GUIDES: &str = "https://guides.frame.work/c/Root"; +// Some menu entries are only added with the lotus feature or still TODO +#[allow(dead_code)] #[derive(Copy, Clone, Eq, PartialEq, Debug)] enum Events { RightClickTrayIcon, @@ -80,13 +78,13 @@ fn launch_website(url: &str) { use std::ptr::null_mut; use winapi::um::shellapi::*; use winapi::um::winuser::*; - let wurl = to_wstring(url).as_ptr(); - let action = to_wstring("open").as_ptr(); + let wurl = to_wstring(url); + let action = to_wstring("open"); let ret = unsafe { ShellExecuteW( null_mut(), - action, - wurl, + action.as_ptr(), + wurl.as_ptr(), null_mut(), null_mut(), SW_SHOWNORMAL, @@ -106,6 +104,8 @@ fn launch_tool(t: Tool) { Tool::QmkGui => r"C:\Program Files\Framework Computer\qmk_gui.exe", Tool::LedmatrixControl => r"C:\Program Files\Framework Computer\ledmatrix_control.exe", }; + // Tool keeps running independently, don't wait for it + #[allow(clippy::zombie_processes)] Command::new(path).spawn().unwrap(); } @@ -225,10 +225,10 @@ fn sync_keyboard_screen() { return; } else if dev_infos.len() == 1 { //println!("Found one device"); - dev_infos.get(0).unwrap() + dev_infos.first().unwrap() } else { println!("More than 1 device found. Select a specific device with --vid and --pid"); - dev_infos.get(0).unwrap() + dev_infos.first().unwrap() }; //println!("Open"); let device = dev_info.open_device(&api).unwrap(); @@ -275,7 +275,7 @@ fn add_menu(menu: MenuBuilder, _icon: &'static [u8], nm: Events) -> Menu Events::NumLockOn => ("Numlock On (Number Keys)", true), _ => ("???", false), }; - #[cfg(features = "lotus")] + #[cfg(feature = "lotus")] let menu = menu .submenu( "Launch Inputmodule Apps", @@ -288,7 +288,7 @@ fn add_menu(menu: MenuBuilder, _icon: &'static [u8], nm: Events) -> Menu // TODO // .item("Sync keyboard brightness", Events::SyncKeyboards) - #[cfg(features = "lotus")] + #[cfg(feature = "lotus")] let menu = menu.item( "Sync keyboard brightness with screen", Events::SyncKeyboardScreen, @@ -332,13 +332,13 @@ fn numlock_toggle() { } } -#[cfg(windows)] +#[allow(unused_imports)] mod win_bindings { ::windows::include_bindings!(); pub use self::windows::win32::shell::SetCurrentProcessExplicitAppUserModelID; } -fn main() { +pub fn main() { unsafe { win_bindings::SetCurrentProcessExplicitAppUserModelID( to_wstring("work.frame.tray").as_ptr(), @@ -427,7 +427,7 @@ fn main() { Events::DoubleClickTrayIcon => { println!("Double click"); - #[cfg(features = "lotus")] + #[cfg(feature = "lotus")] { let devs = brightness::blocking::brightness_devices(); for dev in devs { @@ -441,7 +441,7 @@ fn main() { } Events::LeftClickTrayIcon => { println!("Single click"); - #[cfg(features = "lotus")] + #[cfg(feature = "lotus")] { let devs = brightness::blocking::brightness_devices(); for dev in devs {