Code I'm running in .ipynb file (jupyter notebook in VS Code):
from pynput import keyboard
def function_1():
print('Function 1 activated')
with keyboard.GlobalHotKeys({
'<alt>+<ctrl>+c': function_1}
) as h:
h.join()
When this is running, pressing CTRL+ALT+C triggers function_1, as expected. Pressing CTRL+C (no ALT) does not trigger function_1, also as expected.
But if I press ALT-TAB to switch windows, CTRL+C now triggers function_1.
I changed the code to use '<alt>+<ctrl>+b' and get same result. CTRL+B will trigger if ALT-TAB is pressed beforehand.
Can anyone replicate or see what I'm doing wrong?