diff --git a/Cargo.lock b/Cargo.lock index 6139b35..c637826 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,7 +12,7 @@ dependencies = [ "core-foundation", "core-graphics", "objc", - "windows", + "windows 0.48.0", "xcb", ] @@ -175,9 +175,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "cc" -version = "1.2.5" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" +checksum = "8d6dbb628b8f8555f86d0323c2eb39e3ec81901f4b83e091db8a6a76d316a333" dependencies = [ "shlex", ] @@ -331,6 +331,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "dirs" version = "5.0.1" @@ -675,9 +690,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -699,7 +714,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -804,9 +819,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.91" +version = "2.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" +checksum = "70ae51629bf965c5c098cc9e87908a3df5301051a9e087d6f9bef5c9771ed126" dependencies = [ "proc-macro2", "quote", @@ -819,7 +834,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" +dependencies = [ + "thiserror-impl 2.0.9", ] [[package]] @@ -833,6 +857,17 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -937,31 +972,20 @@ dependencies = [ "dirs", "lazy_static", "parking_lot", - "windows-hotkeys", + "win-hotkeys", ] [[package]] -name = "winapi" -version = "0.3.9" +name = "win-hotkeys" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "4e714f1a868a8f0275a0ba8da53f8e7212c9b989186acb1d2b8ffb284bfcfb56" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "crossbeam-channel", + "thiserror 2.0.9", + "windows 0.52.0", ] -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows" version = "0.48.0" @@ -972,13 +996,22 @@ dependencies = [ ] [[package]] -name = "windows-hotkeys" -version = "0.2.1" +name = "windows" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0020b6838b9b33f7050e796b405935cbb9f7fe0dccba5199242d9c1371a6aa7" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ - "thiserror", - "winapi", + "windows-core", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 15d9f14..08853e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,6 @@ [package] name = "whkd" version = "0.2.3" -authors = ["Jade Iqbal "] description = "A simple hotkey daemon for Windows" categories = ["hotkey-daemon", "windows"] repository = "https://github.com/LGUG2Z/whkd" @@ -18,4 +17,4 @@ color-eyre = "0.6" dirs = "5" lazy_static = "1" parking_lot = "0.12" -windows-hotkeys = "0.2.1" \ No newline at end of file +win-hotkeys = "0.3" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index d6bf594..81c029e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,11 +15,10 @@ use std::path::PathBuf; use std::process::ChildStdin; use std::process::Command; use std::process::Stdio; -use windows_hotkeys::error::HkError; -use windows_hotkeys::keys::ModKey; -use windows_hotkeys::keys::VKey; -use windows_hotkeys::HotkeyManager; -use windows_hotkeys::HotkeyManagerImpl; +use win_hotkeys::error::WHKError; +use win_hotkeys::keys::ModKey; +use win_hotkeys::keys::VKey; +use win_hotkeys::HotkeyManager; mod parser; mod whkdrc; @@ -59,7 +58,7 @@ impl HkmData { pub fn register(&self, hkm: &mut HotkeyManager<()>, shell: Shell) -> Result<()> { let cmd = self.command.clone(); - if let Err(error) = hkm.register(self.vkey, self.mod_keys.as_slice(), move || { + if let Err(error) = hkm.register_hotkey(self.vkey, self.mod_keys.as_slice(), move || { if let Some(session_stdin) = SESSION_STDIN.lock().as_mut() { if matches!(shell, Shell::Pwsh | Shell::Powershell) { println!("{cmd}"); @@ -79,7 +78,7 @@ impl HkmData { } impl TryFrom<&HotkeyBinding> for HkmData { - type Error = HkError; + type Error = WHKError; fn try_from(value: &HotkeyBinding) -> Result { let (trigger, mods) = value.keys.split_last().unwrap(); @@ -156,7 +155,6 @@ fn main() -> Result<()> { } let mut hkm = HotkeyManager::new(); - hkm.set_no_repeat(false); let mut mapped = HashMap::new(); for (keys, app_bindings) in &whkdrc.app_bindings { @@ -174,7 +172,7 @@ fn main() -> Result<()> { let mod_keys = v[0].mod_keys.as_slice(); let v = v.clone(); - hkm.register(vkey, mod_keys, move || { + hkm.register_hotkey(vkey, mod_keys, move || { if let Some(session_stdin) = SESSION_STDIN.lock().as_mut() { for e in &v { let cmd = &e.command;