|
|
@ -9,7 +9,7 @@ from PIL import Image
|
|
|
|
def is_chatterino_running():
|
|
|
|
def is_chatterino_running():
|
|
|
|
for proc in psutil.process_iter():
|
|
|
|
for proc in psutil.process_iter():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if "chatterino.exe" in proc.name():
|
|
|
|
if program_executable in proc.name():
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
|
|
|
|
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
@ -17,9 +17,8 @@ def is_chatterino_running():
|
|
|
|
|
|
|
|
|
|
|
|
# Function to run Chatterino
|
|
|
|
# Function to run Chatterino
|
|
|
|
def run_program(program_path):
|
|
|
|
def run_program(program_path):
|
|
|
|
os.startfile(program_path)
|
|
|
|
print("[DEBUG] " + "Dir: " + program_dir + " | " + program_path)
|
|
|
|
# todo: switch over to subprocess
|
|
|
|
subprocess.Popen([program_path], cwd=program_dir, shell=True)
|
|
|
|
# process = subprocess.Popen(program_path, cwd = program_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Function to display system tray icon
|
|
|
|
# Function to display system tray icon
|
|
|
|
def on_quit_callback(icon):
|
|
|
|
def on_quit_callback(icon):
|
|
|
@ -27,6 +26,7 @@ def on_quit_callback(icon):
|
|
|
|
|
|
|
|
|
|
|
|
# Define system tray icon and menu
|
|
|
|
# Define system tray icon and menu
|
|
|
|
def create_tray_icon():
|
|
|
|
def create_tray_icon():
|
|
|
|
|
|
|
|
# todo: fix tray icon not showing up
|
|
|
|
icon_image = Image.open("icon.png")
|
|
|
|
icon_image = Image.open("icon.png")
|
|
|
|
menu = pystray.Menu(
|
|
|
|
menu = pystray.Menu(
|
|
|
|
pystray.MenuItem(
|
|
|
|
pystray.MenuItem(
|
|
|
@ -39,7 +39,9 @@ if __name__ == '__main__':
|
|
|
|
print("Yandols' Chatterino Process Monitor Script")
|
|
|
|
print("Yandols' Chatterino Process Monitor Script")
|
|
|
|
|
|
|
|
|
|
|
|
# Set path to Chatterino
|
|
|
|
# Set path to Chatterino
|
|
|
|
program_path = "C:\\Program Files\\Chatterino7\\chatterino.exe"
|
|
|
|
program_dir = "C:\\Program Files\\Chatterino7"
|
|
|
|
|
|
|
|
program_executable = "chatterino.exe"
|
|
|
|
|
|
|
|
program_path = program_dir + "\\" + program_executable
|
|
|
|
|
|
|
|
|
|
|
|
# Create system tray icon
|
|
|
|
# Create system tray icon
|
|
|
|
icon = create_tray_icon()
|
|
|
|
icon = create_tray_icon()
|
|
|
|