asterics / AsTeRICS

The Assistive Technology Rapid Integration & Construction Set
http://www.asterics.eu
Other
57 stars 27 forks source link

KeyCapture - extension for key combinations #175

Open benjaminaigner opened 7 years ago

benjaminaigner commented 7 years ago

The key capture plugin should support keycode combinations (e.g., CTRL+ALT+DEL) as property to trigger the event, similar to the actuator.keyboard plugin.

Following changes are necessary:

deinhofer commented 6 years ago

Just tried to capture any key event: This looks very promising because the NativeKeyEvent class of jnativehook already provides all the information in a convinient way. You can differ between action keys and normal keys and even get the pressed character out (correctly modified, e.g. h or H). Special characters in german also work on Linux and Windows (Mac was not tested yet).

aasasdfghjklöä#+üpoß1235{}{F1}{}{F2}{}{F3}{Shift}{F3}{}{Right Shift}RT{}{Right Shift}5%{}{Right Shift}

The code needed is: nativeKeyReleased

        if(nke.isActionKey()) {
            System.out.print("{"+nke.getModifiersText(nke.getModifiers())+"}{"+nke.getKeyText(nke.getKeyCode())+"}");
        }

nativeKeyTyped

        if(!nke.isActionKey()) {
            System.out.print(nke.getKeyChar());
        }

So we have everything for this feature and could e.g. learn command combinations, crossplatform!! :-)

Security Notes As this could easily be misused for password logging, how should we handle security here?

In combinatoin with #79 this could be the solution for unifying key notation within Asterics.

klues commented 5 years ago

for space nke.getKeyText(nke.getKeyCode()).equals("Leertaste") on my german windows 10. This might be a problem.

also applies for other special keys like Strg or Punkt.