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

Better typing on Binding #4

Open
SylvanFranklin opened this issue Sep 4, 2024 · 6 comments
Open

Better typing on Binding #4

SylvanFranklin opened this issue Sep 4, 2024 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@SylvanFranklin
Copy link

SylvanFranklin commented Sep 4, 2024

#[derive(Deserialize, Debug)]
pub struct Binding {
    pub key: Option<String>,
    pub arrow: Option<Arrow>,
    // TODO: Make this optional,
    pub modifiers: Vec<String>,
    pub command: String,
}

I think there should be a dedicated struct for modifiers that has Options for each kind of command. It would make debugging and providing error messages a lot more clear.

@SylvanFranklin
Copy link
Author

It might also be worth adding a third party crate that handles types for keyboard input.

@SylvanFranklin SylvanFranklin changed the title Better typing on `` Better typing on Binding Sep 4, 2024
@Uzaaft
Copy link
Owner

Uzaaft commented Sep 4, 2024

It might also be worth adding a third party crate that handles types for keyboard input.

In general, I'd like to try and avoid pulling in a third party crate for something so simple.

@Uzaaft
Copy link
Owner

Uzaaft commented Sep 4, 2024

I think there should be a dedicated struct for modifiers that has Options for each kind of command. It would make debugging and providing error messages a lot more clear.

I like the idea of this. Would make debugging, as well as logging so much better.

@Uzaaft
Copy link
Owner

Uzaaft commented Sep 4, 2024

We do have use: https://docs.rs/global-hotkey/0.6.0/global_hotkey/
It has both Modifiers and normal keys. Isn't that sufficient?

@Uzaaft Uzaaft added enhancement New feature or request good first issue Good for newcomers labels Sep 4, 2024
@SylvanFranklin
Copy link
Author

Oh yes sorry I didn't look into the dependencies that closely, that's perfect.

@Uzaaft
Copy link
Owner

Uzaaft commented Nov 16, 2024

Working on this in an upcoming coming breaking change which will remove the toml config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants