How is it possible to detect when a terminal (CPython 3.9) is in focus ? Cant find any solution for that.
In a Python script, I have a global keyboard hook that takes every keyboard-input, where I need it to ignore input when terminal is off focus.
I'm using this package: https://github.com/boppreh/keyboard, that works fine cross-platform (Win32 and Linux) except that it also receives when in off-focus.