Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

livesplit-hotkey: Add Hook::new_consuming on macOS #755

Merged
merged 1 commit into from
Jan 20, 2024

Conversation

tmandry
Copy link
Contributor

@tmandry tmandry commented Jan 14, 2024

This was also requested in #710 for Windows, so there is some demand for it, though I recognize it diverges from the crate's original use case. If it's not something you want to support I can make a bespoke implementation elsewhere, but this happened to be the cleanest implementation/API I could find of a global shortcut library for macOS.

The API puts the choice of consuming or not on the Hook because it allows us to mark non-consuming hooks listen-only, which removes them as a potential bottleneck from the system input pipeline. I think this is probably desirable for your use case but I'm not certain.

After making this change I verified locally that both new and new_consuming work as expected, on macOS 13.5.2.

@tmandry tmandry changed the title livesplit-hotkey: Add new_consuming on macOS livesplit-hotkey: Add consuming Hook API on macOS Jan 14, 2024
@tmandry tmandry changed the title livesplit-hotkey: Add consuming Hook API on macOS livesplit-hotkey: Add Hook::new_consuming on macOS Jan 14, 2024
@CryZe CryZe added enhancement An improvement for livesplit-core. feature A new user visible feature for livesplit-core. hotkey This is about the hotkey implementation. labels Jan 16, 2024
Copy link
Collaborator

@CryZe CryZe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original LiveSplit actually had a setting for this, so it would make sense for this crate to support this feature as well. We probably can't make it work on all platforms, but we could always fall back to the other implementation if necessary. I'll push some more changes that at least ensures that every platform has the same API later today.

crates/livesplit-hotkey/src/macos/mod.rs Outdated Show resolved Hide resolved
@CryZe CryZe added this to the v0.14 milestone Jan 16, 2024
@CryZe
Copy link
Collaborator

CryZe commented Jan 16, 2024

Alright, I rebased your changes onto the new API introduced in #757

Copy link
Collaborator

@CryZe CryZe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you this looks good now.

@CryZe CryZe merged commit bd1418f into LiveSplit:master Jan 20, 2024
72 checks passed
@tmandry tmandry deleted the new-consuming branch January 30, 2024 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement for livesplit-core. feature A new user visible feature for livesplit-core. hotkey This is about the hotkey implementation.
Projects
Development

Successfully merging this pull request may close these issues.

[livesplit-hotkey] Ability to prevent hotkeys from propagating to other programs
2 participants