-
Notifications
You must be signed in to change notification settings - Fork 29
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
Keyboard shortcuts #181
Keyboard shortcuts #181
Conversation
282ff2b
to
a2b5f0f
Compare
a2b5f0f
to
86761fc
Compare
I found that it was possible to simplify this quite a bit, see this commit. I removed the The Then the I haven't fully tested this, but see what you think. |
86761fc
to
fd6dc04
Compare
Thanks! I like it. I've gone ahead and rebased everything with that change merged into the first commit. |
…cting the stop button Co-authored-by: Martin Ling <martin-git@earth.li>
This needs some documentation so that people can find out about the keyboard shortcuts. Better still would be some indication of them within the UI - maybe a new item in the dropdown menu that leads to the About dialog? |
In fact GTK has a built-in |
I did have a brief look into that, but found gtk-rs/gtk4-rs#1724 which points out that it'd need a very recent version of GTK to work without using XML to drive it. |
fd6dc04
to
dc65b2a
Compare
Ah, right. Doing it with XML doesn't look too awful, the XML file can be embedded into the binary at build time. I'm fine with not pursuing that just now though as long as the keyboard shortcuts are added to the docs instead. |
I've added the keyboard shortcuts to the docs (rendered here). I figured it was worth listing the linux/windows and mac ones separately for clarity and in case they diverge later. I tried using the inline-tab interface (like we use for build/install instructions) but it doesn't let you have sub-headings within it, so I just made them separate pages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks fine!
This adds keyboard shortcuts for common actions. Fixes #135
Initially I tried connecting them up to call Button::emit_clicked, which would've been a bit simpler, but I had issues with borrowing
UI
to get at the button & the callbacks needing to borrow it too (it also felt like a bit of a hack). So instead I've moved all the callbacks over to actions which seems to be the preferred way. This also required moving the logic for stop behaviour into a function rather than connecting/disconnecting signals.For the shortcuts themselves, I've used conventional ones where possible. For scan I used Ctrl+R and F5, to mirror common browser refresh shortcuts. For capturing, I went for Ctrl+b and Ctrl+e, for begin and end respectively. I'm open to suggestions for anything different though.
I'm leaving this as draft for now as I've just remembered I need to handle the macOS keys properly, but otherwise it's open for any feedback.