repeats / Repeat

Cross-platform mouse/keyboard record/replay and automation hotkeys/macros creation, and more advanced automation features.
Apache License 2.0
1.03k stars 76 forks source link

Ignoring certain characters in linux #6

Closed cancub closed 7 years ago

cancub commented 7 years ago

Sup, HP? Using Ubuntu 16.04 I've noticed a small bug when I set up a host removal hotkey like so:

k.type(VK_BACK_SPACE);
k.type(VK_BACK_SPACE);
k.type(VK_BACK_SPACE);
k.type("ssh-keygen -f \"/home/<user>/.ssh/known_hosts\" -R <ip>"); 

For some reason, the "w" in "known" is dropped. Result from the call to the activation key combo of Q+W+NumPad-1:

ssh-keygen -f "/home/<user>/.ssh/knon_hosts" -R <ip>

However, adding a second "w" (i.e., "knowwn") makes everything fine.

ssh-keygen -f "/home/<user>/.ssh/known_hosts" -R <ip>

It seems like this has to do with the keys used for the combo as they appear to be the letters that are being removed from the output. Using "Y+H+K" results in

ss-egen -f "/home/<user>/.ssh/known_hosts" -R <ip>

Finally, the error occurs with the key on the keyboard itself, not the character created. Using "S+2" for

ssh root@<IP>

will result in

sh root<ip>

implying that either 2 or @ (same keyboard key) will be removed by the 2 in S+2

hptruong93 commented 7 years ago

TLDR: Try enabling "Execute on release" option under Settings menu.

Take an example of typing "ase" using the key chain Q + W + E, at the time the last button of the hotkey chain is pressed down (i.e. the button E is pressed), the task is activated and your code instructs it to execute the typing commands, which happens by simulating a key press followed by a key release for each letter. The undesired behavior is caused by the fact that at the time the simulated key press followed by the simulated key release for button E is registered, you have not finished lifting your hand from the physical button E on the keyboard. This results in the OS probably receiving PRESS (real), PRESS (simulated), RELEASE (simulated), RELEASE (real) signal on button E, which caused the undesired behavior.

For further clarification, the type method assumes a standard US keyboard configuration, and therefore it types all symbols as a human would type it normally. For example, to type the "@" symbol, it would simulate a key press on SHIFT, then a key press on button 2, followed by a key release on button 2 and a key release on SHIFT. Consequently, typing "username@host" with hotkey S + 2 would result in the same problem described above.

We can resolve this by configuring Repeat to execute the compiled task AFTER the entire hotkey chain has been completely released (i.e. after you lifted you finger from the button E on the keyboard).

cancub commented 7 years ago

Yup, that looks to have solved the issue. Thanks for your help.

cancub commented 6 years ago

looks like this issue is still around

hptruong93 commented 6 years ago

Can you provide a reproducible example? I've never had problem after using to "Execute on release" option.

cancub commented 6 years ago

ahhh, it was disabled after re-installation and I completely forgot that it was an option. durr

hptruong93 commented 6 years ago

If you had use the in place binary replacement, all your configurations would have been carried over too. :)