Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 1 addition & 49 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 2 additions & 15 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ futures-util = "0.3.32"

[target.'cfg(target_os = "macos")'.dependencies]
tauri-nspanel = { git = "https://github.com/ahkohd/tauri-nspanel", branch = "v2.1" }
core-graphics = "0.24"
core-graphics = "0.25"
core-foundation = "0.10"

[dev-dependencies]
Expand Down
12 changes: 6 additions & 6 deletions src-tauri/src/activator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use core_foundation::runloop::{kCFRunLoopCommonModes, CFRunLoop};
use core_foundation::string::CFString;
use core_graphics::event::{
CGEvent, CGEventFlags, CGEventTap, CGEventTapLocation, CGEventTapOptions, CGEventTapPlacement,
CGEventType, EventField,
CGEventType, CallbackResult, EventField,
};

/// Maximum temporal proximity between trigger events to qualify as an activation signal.
Expand Down Expand Up @@ -216,18 +216,18 @@ where
CGEventTapPlacement::HeadInsertEventTap,
CGEventTapOptions::ListenOnly,
vec![CGEventType::FlagsChanged],
move |_proxy, _event_type, event| -> Option<CGEvent> {
move |_proxy, _event_type, event: &CGEvent| -> CallbackResult {
if !cb_active.load(Ordering::SeqCst) {
CFRunLoop::get_current().stop();
return None;
return CallbackResult::Keep;
}

let keycode = event.get_integer_value_field(EventField::KEYBOARD_EVENT_KEYCODE);
let flags = event.get_flags();

// Filter for primary triggers (Modifier keys)
if keycode != KC_PRIMARY_L && keycode != KC_PRIMARY_R {
return None;
return CallbackResult::Keep;
}

// Check specific bitmask for the Command key state
Expand All @@ -238,15 +238,15 @@ where
cb_on_activation();
}

None
CallbackResult::Keep
},
);

match tap_result {
Ok(tap) => {
unsafe {
let loop_source = tap
.mach_port
.mach_port()
.create_runloop_source(0)
.expect("failed to create run loop source");

Expand Down