Adds pystray-based tray icon (green play button) that runs alongside uvicorn. Double-click opens the web UI in the browser, Exit triggers graceful shutdown. Disabled with --no-tray flag for headless/service mode.
This commit is contained in:
+22
-6
@@ -216,6 +216,11 @@ def main():
|
||||
action="store_true",
|
||||
help="Show the current API token and exit",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--no-tray",
|
||||
action="store_true",
|
||||
help="Disable system tray icon (for headless/service mode)",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -235,12 +240,23 @@ def main():
|
||||
print("\nAuthentication is DISABLED (no tokens configured)")
|
||||
return
|
||||
|
||||
uvicorn.run(
|
||||
"media_server.main:app",
|
||||
host=args.host,
|
||||
port=args.port,
|
||||
reload=False,
|
||||
)
|
||||
# Start system tray icon (unless disabled)
|
||||
tray_icon = None
|
||||
if not args.no_tray:
|
||||
from .tray import start_tray
|
||||
|
||||
tray_icon = start_tray(args.host, args.port)
|
||||
|
||||
try:
|
||||
uvicorn.run(
|
||||
"media_server.main:app",
|
||||
host=args.host,
|
||||
port=args.port,
|
||||
reload=False,
|
||||
)
|
||||
finally:
|
||||
if tray_icon is not None:
|
||||
tray_icon.stop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user