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

dsl: support press, more keys #134

Merged
merged 1 commit into from
Jan 29, 2023
Merged

Conversation

BrettMayson
Copy link
Contributor

Alternative to #123

Adds more supported special keys
Add support for pressing a key {RETURN}

@pentamassiv
Copy link
Collaborator

I briefly had a look at it and I have some thoughts about it but I need a little more time to write a proper review. I should be able to do it this weekend

@pentamassiv
Copy link
Collaborator

It is a good start, but in my opinion the tokenize function needs a bigger refactor and we have to better define and document how the DSL works. I find it very hard to understand.
For example we have the following test:

fn success() {
        assert_eq!(
            tokenize("{{Hello World!}} {+CTRL}hi{-CTRL}"),
            Ok(vec![
                Token::Sequence("{Hello World!} ".into()),
                Token::KeyDown(Key::Control),
                Token::Sequence("hi".into()),
                Token::KeyUp(Key::Control),
            ])
        );
}

I would not have expected the Token::Sequence("{Hello World!} ".into()) to be correct here.

In the dsl.rs example we do
enigo.key_sequence_parse("{+UNICODE}{{Hello World!}} ❤️{-UNICODE}{+CTRL}a{-CTRL}");
but the function returns Err(UnknownTag("+UNICODE")). That probably is also not what we would want.

Because this PR and also #123 do not change the current behavior but at least fix #34, I am fine if either of them are merged.

Copy link
Collaborator

@pentamassiv pentamassiv left a comment

Choose a reason for hiding this comment

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

Feel free to merge it

@BrettMayson BrettMayson merged commit 30d3a0c into enigo-rs:master Jan 29, 2023
@BrettMayson BrettMayson deleted the dsl branch January 29, 2023 05:48
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