Switched over to launching Chatterino with subprocess instead.

main
YandolsZX 1 year ago
parent 7c2ac6abfa
commit 5b9b9488ae
  1. 12
      chatterino_process_monitor.py

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

Loading…
Cancel
Save