Search code examples
linuxwindowspython-3.xkeypress

How to detect key-press combinations in background on linux & windows with python?


how can I detect key-press combinations in background using python for linux and windows ?

for example,

when Ctrl+v is detected execute doThis() in background

when Tab is detected execute doThat() in background


Solution

  • on windows this can be done using pyhook

    on ubuntu I did it with help of this pyxhook

    Edit: another awesome library for Windows & Linux - keyboard