Make sure status.py exits

This commit is contained in:
Bernd Schoolmann 2024-05-25 09:32:34 +02:00
parent 259d8eb437
commit b9b10fd6e8
No known key found for this signature in database

View File

@ -7,6 +7,7 @@ gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1') gi.require_version('Adw', '1')
from gi.repository import GLib, Gio from gi.repository import GLib, Gio
import sys import sys
from threading import Timer
def set_status(message): def set_status(message):
bus = Gio.bus_get_sync(Gio.BusType.SESSION, None) bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
@ -29,9 +30,13 @@ def set_status(message):
sys.exit(0) sys.exit(0)
except Exception as e: except Exception as e:
print(e) print(e)
sys.exit(0)
if len(sys.argv) > 1: if len(sys.argv) > 1:
set_status(sys.argv[1]) set_status(sys.argv[1])
thread = Timer(10, sys.exit, [0])
thread.start()
loop = GLib.MainLoop() loop = GLib.MainLoop()
loop.run() loop.run()