small enhancements

This commit is contained in:
Jakub Trllo 2024-07-23 13:39:48 +02:00
parent b5f7162918
commit ebc1c62f29

View file

@ -176,9 +176,9 @@ def set_tray_server_url(tray_url: str, started: bool):
"""
file_info = get_tray_file_info()
if file_info and file_info.get("pid") != os.getpid():
tray_url = file_info.get("url")
if _get_tray_information(tray_url):
if file_info and file_info["pid"] != os.getpid():
tray_url = file_info["url"]
if not file_info["started"] or _get_tray_information(tray_url):
raise TrayIsRunningError("Tray is already running.")
filepath = _get_tray_info_filepath()
@ -281,14 +281,13 @@ def main():
state = get_tray_state()
if state == TrayState.RUNNING:
# TODO send some information to tray?
print("Tray is already running.")
return
if state == TrayState.STARTING:
# TODO try to handle stuck tray?
print("Tray is starting.")
return
# TODO try to handle stuck tray?
time.sleep(5)
state = get_tray_state()
if state == TrayState.RUNNING: