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

Wayland support? #3

Open
argenkiwi opened this issue May 24, 2024 · 3 comments
Open

Wayland support? #3

argenkiwi opened this issue May 24, 2024 · 3 comments

Comments

@argenkiwi
Copy link

Nice project! I came across a post on Reddit about this project, installed it but got a error on KDE Wayland. I switched to X11 and all works well!

I really like the Monkeytype-like experience. Would it also be possible to capture some keystroke stats? I am trying to find a tool that calculates average and maximum dwell (or key-hold) time but I haven't found any good ones.

@Ace4896
Copy link
Owner

Ace4896 commented May 24, 2024

Hey there, thanks for giving it a try! I haven't tried it on Wayland myself, but I imagine the 3 year old versions(!) of iced, winit etc. are causing issues. I've made some attempts to update it in the past, but never managed to finish it...

Keystroke stats would be nice to have - it was something I was heading towards for plotting graphs (like WPM/CPM over time). I've made #5 to keep track of it.

I can't guarantee anything in the near future since I'm busy with other projects and I haven't used Iced in a while, but I hope this answers your questions.

@argenkiwi
Copy link
Author

argenkiwi commented May 24, 2024 via email

@Ace4896
Copy link
Owner

Ace4896 commented May 24, 2024

For Iced, you'll want to listen for iced::keyboard::Event messages to get key press/release information. There's no timestamp in the event itself, but you could augment it with the current timestamp in the handler for calculating key-hold time later on.

In the typing test widget, I intercepted these events for hotkeys, word submission and to prevent event propagation. When a hotkey or word is submitted, a different message type is returned - you could return a message type that includes the key press/release information when it's not a hotkey. There's new APIs for custom widgets now, but the overall approach would be the same.

For global keyboard events, Iced seems to have new functions for creating subscriptions that listen to them. You could also use the approach from the events example, though you'd have to filter out non-keyboard events.

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

No branches or pull requests

2 participants