enigo-rs / enigo

Cross platform input simulation in Rust
MIT License
893 stars 95 forks source link

all: Add serde aliases to make serialized tokens less verbose #281

Closed pentamassiv closed 1 month ago

pentamassiv commented 1 month ago

The DSL was replaced by using serde to serialize and deserialize tokens. The serialized strings are more verbose. I've added serde aliases so that users don't have to type much more than before. This shortens the serialized string from the serde example from:

[Text("Hello World! ❤\u{fe0f}"),MoveMouse(10,10,Rel),Scroll(5,Vertical),Button(Left,Click),Key(Unicode('🔥'),Click),Key(Control,Press),Key(Unicode('a'),Click),Key(Control,Release)]

to:

[t("Hello World! ❤\u{fe0f}"),m(10,10,r),s(5,v),b(l,c),k(uni('🔥'),c),k(ctrl,p),k(uni('a'),c),k(ctrl,r)]