How can I simulate a keystroke in python? I also want to press multiple keys simultaneously.
Something like:
keystroke('CTRL+F4')
or
keystroke('Shift+A')
Consider python-uinput and evdev. Example of shift+a
with the latter:
from evdev import uinput, ecodes as e
with uinput.UInput() as ui:
ui.write(e.EV_KEY, e.KEY_LEFTSHIFT, 1)
ui.write(e.EV_KEY, e.KEY_A, 1)
ui.syn()