2023-12-23 09:18:30 +03:00
|
|
|
#!/usr/bin/python
|
|
|
|
import time
|
2023-12-23 14:26:01 +03:00
|
|
|
import subprocess
|
|
|
|
from tendo import singleton
|
|
|
|
import monitors.dbus_autofill_monitor
|
|
|
|
import sys
|
2023-12-23 15:24:46 +03:00
|
|
|
import goldwarden
|
|
|
|
from threading import Thread
|
2023-12-23 09:18:30 +03:00
|
|
|
|
2023-12-23 14:26:01 +03:00
|
|
|
try:
|
|
|
|
subprocess.Popen(["python3", "/app/bin/background.py"], start_new_session=True)
|
|
|
|
except:
|
|
|
|
pass
|
2023-12-23 09:18:30 +03:00
|
|
|
|
2023-12-23 15:44:41 +03:00
|
|
|
is_hidden = "--hidden" in sys.argv
|
|
|
|
|
|
|
|
if not is_hidden:
|
2023-12-23 14:26:01 +03:00
|
|
|
try:
|
|
|
|
subprocess.Popen(["python3", "/app/bin/settings.py"], start_new_session=True)
|
|
|
|
except:
|
|
|
|
pass
|
2023-12-23 09:18:30 +03:00
|
|
|
|
2023-12-23 14:26:01 +03:00
|
|
|
try:
|
|
|
|
me = singleton.SingleInstance()
|
|
|
|
except:
|
|
|
|
exit()
|
2023-12-23 09:18:30 +03:00
|
|
|
|
2023-12-23 15:24:46 +03:00
|
|
|
def run_daemon():
|
|
|
|
# todo: do a proper check
|
2023-12-23 15:44:41 +03:00
|
|
|
if is_hidden:
|
|
|
|
time.sleep(20)
|
2023-12-23 15:24:46 +03:00
|
|
|
if not goldwarden.is_daemon_running():
|
|
|
|
goldwarden.run_daemon()
|
|
|
|
|
|
|
|
if not goldwarden.is_daemon_running():
|
|
|
|
print("daemon not running.. autostarting")
|
|
|
|
daemonThread = Thread(target=run_daemon)
|
|
|
|
daemonThread.start()
|
|
|
|
|
|
|
|
print("starting autofill monitor")
|
|
|
|
|
2023-12-23 09:18:30 +03:00
|
|
|
def on_autofill():
|
2023-12-23 14:26:01 +03:00
|
|
|
subprocess.Popen(["python3", "/app/bin/autofill.py"], start_new_session=True)
|
2023-12-23 09:18:30 +03:00
|
|
|
monitors.dbus_autofill_monitor.on_autofill = on_autofill
|
|
|
|
|
2023-12-23 14:26:01 +03:00
|
|
|
while True:
|
|
|
|
time.sleep(60)
|