Skip to content

Commit c54648e

Browse files
authored
Merge pull request #1081 from Kiln-AI/scosman/linux_tray_optional
make linux tray failing to start a non-critical error
2 parents 4c201f7 + a562464 commit c54648e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

app/desktop/desktop.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
setup_certs()
66

77
import contextlib
8+
import logging
89
import os
910
import sys
1011
import tkinter as tk
@@ -21,6 +22,8 @@
2122
from app.desktop.desktop_server import ThreadedServer, server_config
2223
from app.desktop.util.resource_limits import setup_resource_limits
2324

25+
logger = logging.getLogger(__name__)
26+
2427
# Set writeable cache directories as soon as we start
2528
os.environ["LLAMA_INDEX_CACHE_DIR"] = os.path.join(
2629
Config.settings_dir(), "cache", "llama_index_cache"
@@ -122,8 +125,17 @@ def run_tray(self):
122125

123126
self.tray = KilnTray("kiln", tray_image, "Kiln", menu)
124127

125-
# running detached since we use tk mainloop to get events from dock icon
126-
self.tray.run_detached()
128+
try:
129+
# running detached since we use tk mainloop to get events from dock icon
130+
self.tray.run_detached()
131+
except Exception:
132+
logger.error("Error running tray", exc_info=True)
133+
# Tray not starting on MacOS or Windows is critical.
134+
# Let Linux continue to start the app as tray is more fragmented there and requires system deps.
135+
if sys.platform in ["darwin", "win32"]:
136+
raise
137+
else:
138+
self.tray = None
127139

128140
def close_splash(self):
129141
try:

0 commit comments

Comments
 (0)