From 4ad69aaa20a335847f6213bfb819604b3fbba5b3 Mon Sep 17 00:00:00 2001 From: Kishi <41839133+Kishi85@users.noreply.github.com> Date: Fri, 12 Jun 2026 19:05:50 +0200 Subject: [PATCH] fix(tray): fix compiling without system tray enabled (#5284) --- cmake/compile_definitions/common.cmake | 3 +-- src/main.cpp | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/compile_definitions/common.cmake b/cmake/compile_definitions/common.cmake index 180b5f31..204a668e 100644 --- a/cmake/compile_definitions/common.cmake +++ b/cmake/compile_definitions/common.cmake @@ -125,8 +125,6 @@ if(NOT SUNSHINE_ASSETS_DIR_DEF) endif() list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR_DEF}") -list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_TRAY=${SUNSHINE_TRAY}) - # Publisher metadata list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_PUBLISHER_NAME="${SUNSHINE_PUBLISHER_NAME}") list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_PUBLISHER_WEBSITE="${SUNSHINE_PUBLISHER_WEBSITE}") @@ -166,3 +164,4 @@ else() set(SUNSHINE_TRAY 0) message(STATUS "Tray icon disabled") endif() +list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_TRAY=${SUNSHINE_TRAY}) diff --git a/src/main.cpp b/src/main.cpp index 13df6784..eb42cf1b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -116,7 +116,9 @@ void mainThreadLoop(const std::shared_ptr> &shutdown_event) // Main thread event loop BOOST_LOG(info) << "Starting main loop"sv; +#if defined SUNSHINE_TRAY && SUNSHINE_TRAY >= 1 while (system_tray::process_tray_events() == 0); +#endif BOOST_LOG(info) << "Main loop has exited"sv; }