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

macos: add keyboard support #81

Merged
merged 4 commits into from
Jan 26, 2024
Merged

macos: add keyboard support #81

merged 4 commits into from
Jan 26, 2024

Conversation

kiwiz
Copy link
Contributor

@kiwiz kiwiz commented Jan 24, 2024

keycode is doing all the heavy lifting here.

I encountered some odd behaviour with Caps lock (which I've mapped to Control) getting stuck, but keys appear to be translated properly otherwise.

Copy link
Owner

@feschber feschber left a comment

Choose a reason for hiding this comment

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

Awesome work! I didn't know about this crate.

It seems to work for me without issues. The only thing that does not work is repeating keys, it seems.

You could take some inspiration from

async fn spawn_repeat_task(&mut self, key: u32) {
but that may as well be a new PR.

Rust format is complaining but other than that, lgtm!

src/backend/consumer/macos.rs Outdated Show resolved Hide resolved
@feschber feschber mentioned this pull request Jan 25, 2024
4 tasks
Copy link
Contributor Author

@kiwiz kiwiz left a comment

Choose a reason for hiding this comment

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

Pushed up my attempt to integrate the key repeating logic. I tried turning key_event into a method, but it might be simpler to just event_source and to pass it into key_event in the event handler and the timer?

src/backend/consumer/macos.rs Outdated Show resolved Hide resolved
@kiwiz
Copy link
Contributor Author

kiwiz commented Jan 25, 2024

That should do it! I'm new to Rust so feedback welcome.

@feschber feschber merged commit 5cc8cda into feschber:main Jan 26, 2024
3 checks passed
@feschber
Copy link
Owner

That should do it! I'm new to Rust so feedback welcome.

Thank you, looking good!
Aren't we all new to Rust?

I fixed one clippy complaint and updated the README, hope you don't mind :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants