I am facing a problem here that I am not able to find the solution obviously. I have some code (I will append it at the end) that when a combo of keys is pressed it executes some code. As I explain on title, I am doing this with pynput.keyboard, but even when CMD is not in focus, when I am pressing CTRL + S ( the combo in script is E + S ) it seems the script executes what E + S is programmed for. Also when I am pressing CTRL + C, I get an error from clipboard_monitor library (it has nothing to do with the current question), instead of just "os._exit(0)" as it is instructed in "try - except" (when E + Q is pressed the program exits as it is supposed to). Finally, I append the libraries I am using. If you are in need of any other part of the code let me know. Any ideas?
Cheers
import clipboard_monitor, os, shutil, sys, subprocess
from time import sleep as Freeze
from tqdm import tqdm
from pynput import keyboard
from threading import Thread
from urllib.error import URLError, HTTPError
from urllib.request import urlretrieve as DL
def poweron(self):
try:
with keyboard.GlobalHotKeys({
'e+s': self.execute,
'e+c': self.showlst,
'e+x': self.clrlst,
'e+z': self.clrdir,
'e+q': self.quit}) as q:
q.join()
except KeyboardInterrupt:
os._exit(0)
else:
pass