|
|
|
@ -5,6 +5,7 @@ import os
|
|
|
|
|
import subprocess
|
|
|
|
|
import pystray
|
|
|
|
|
from PIL import Image
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
# Function to check if Chatterino is running
|
|
|
|
|
def is_chatterino_running():
|
|
|
|
@ -19,7 +20,9 @@ def is_chatterino_running():
|
|
|
|
|
# Function to run Chatterino
|
|
|
|
|
def run_program(program_path):
|
|
|
|
|
subprocess.Popen([program_path], cwd=program_dir)
|
|
|
|
|
print("Started Chatterino.")
|
|
|
|
|
now = datetime.now()
|
|
|
|
|
timenow = now.strftime("%H:%M:%S")
|
|
|
|
|
print("[" + timenow + "] Started Chatterino.")
|
|
|
|
|
|
|
|
|
|
# Function to display system tray icon
|
|
|
|
|
def on_quit_callback(icon):
|
|
|
|
@ -52,9 +55,13 @@ if __name__ == '__main__':
|
|
|
|
|
# Loop to check if Chatterino is running every 10 minutes
|
|
|
|
|
while True:
|
|
|
|
|
if is_chatterino_running():
|
|
|
|
|
print("Chatterino is running. Rechecking in 10 minutes.")
|
|
|
|
|
now = datetime.now()
|
|
|
|
|
timenow = now.strftime("%H:%M:%S")
|
|
|
|
|
print("[" + timenow + "] Chatterino is running. Rechecking in 10 minutes.")
|
|
|
|
|
else:
|
|
|
|
|
print("Chatterino is not running. Starting in 30 seconds...")
|
|
|
|
|
now = datetime.now()
|
|
|
|
|
timenow = now.strftime("%H:%M:%S")
|
|
|
|
|
print("[" + timenow + "] Chatterino is not running. Starting in 30 seconds...")
|
|
|
|
|
time.sleep(30)
|
|
|
|
|
run_program(program_path)
|
|
|
|
|
time.sleep(1) # wait for system tray icon to initialize
|
|
|
|
|