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

feat: add Accelerator::key and Accelerator::modifiers getters #244

Merged

Conversation

stijnfrishert
Copy link
Contributor

@stijnfrishert stijnfrishert commented Nov 5, 2024

This is a PR to expose the Modifiers and Code fields within an Accelerator, immutably. The types are public anyway, so I don't see why you shouldn't be able to inspect what you set earlier.

I personally need this to extract the modifiers and code and fill a human readable struct with them like so. I'm only using the Accelerator type from muda because it nicely represents hotkeys and supports string parsing.

struct Hotkey {
  shift: bool,
  alt: bool,
  control: bool,
  super: bool,
  key: Code,
}

Copy link
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

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

Could you also add a change file in .changes directory?

src/accelerator.rs Outdated Show resolved Hide resolved
@stijnfrishert stijnfrishert force-pushed the expose-accelerator-modifiers-code branch from 44bf293 to 7bfbc39 Compare November 5, 2024 12:44
@stijnfrishert
Copy link
Contributor Author

stijnfrishert commented Nov 5, 2024

Amended my commit and pushed the new changes, including a file in .changes, @amrbashir 👍

Copy link
Member

@amrbashir amrbashir 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

@amrbashir amrbashir changed the title Expose the Modifiers and Code on an Accelerator, immutably feat: add Accelerator::key and Accelerator::modifiers getters Nov 5, 2024
@amrbashir amrbashir merged commit 99ec648 into tauri-apps:dev Nov 5, 2024
8 checks passed
@stijnfrishert stijnfrishert deleted the expose-accelerator-modifiers-code branch November 5, 2024 13:04
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.

2 participants