howto wait for key pressed with autokey?
for AutoKey i found the wait_for_keypress but its not what i searching for.
its wait for a defined keypress or key combination.
i want wait for a,b,... z is pressed.
i searched here:
and tried soe of this exaples without success:
i seached the web for
autokey -autohotkey keywait manual
the following solution only works with root rights:
sudo apt install python3-pip
pip3 install keyboard
sudo autokey
then this works (tested in Kubuntu 20.04, see Details below):
import keyboard as keyboard2 # must be different name becouse of name conflicts
while True:
key = keyboard2.read_key()
if keyboard2.is_pressed(' '):
keyboard.send_keys("You pressed space")
if key == "p":
break
tested with:
Operating System: Kubuntu 20.04
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8