Skip to content

Commit 8334eb9

Browse files
fix(linux): migrate to qt tray
1 parent dc2dc61 commit 8334eb9

22 files changed

Lines changed: 204 additions & 131 deletions

File tree

.github/workflows/ci-flatpak.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ jobs:
1717
name: ${{ matrix.arch }}
1818
env:
1919
APP_ID: dev.lizardbyte.app.Sunshine
20+
FREEDESKTOP_SDK_VERSION: "25.08"
21+
KDE_PLATFORM_VERSION: "6.10"
2022
MATRIX_ARCH: ${{ matrix.arch }}
2123
NODE_VERSION: "20"
22-
PLATFORM_VERSION: "24.08"
2324
permissions:
2425
contents: read
2526
runs-on: ${{ matrix.runner }}
@@ -77,9 +78,9 @@ jobs:
7778
7879
sudo su "$(whoami)" -c "flatpak --user install -y flathub \
7980
org.flatpak.Builder \
80-
org.freedesktop.Platform/${MATRIX_ARCH}/${PLATFORM_VERSION} \
81-
org.freedesktop.Sdk/${MATRIX_ARCH}/${PLATFORM_VERSION} \
82-
org.freedesktop.Sdk.Extension.node${NODE_VERSION}/${MATRIX_ARCH}/${PLATFORM_VERSION} \
81+
org.kde.Platform/${MATRIX_ARCH}/${KDE_PLATFORM_VERSION} \
82+
org.kde.Sdk/${MATRIX_ARCH}/${KDE_PLATFORM_VERSION} \
83+
org.freedesktop.Sdk.Extension.node${NODE_VERSION}/${MATRIX_ARCH}/${FREEDESKTOP_SDK_VERSION} \
8384
"
8485
8586
flatpak run org.flatpak.Builder --version
@@ -96,7 +97,7 @@ jobs:
9697
run: |
9798
python \
9899
./packaging/linux/flatpak/deps/flatpak-builder-tools/pip/flatpak-pip-generator.py \
99-
--runtime="org.freedesktop.Sdk//${PLATFORM_VERSION}" \
100+
--runtime="org.kde.Sdk//${KDE_PLATFORM_VERSION}" \
100101
--output glad-dependencies \
101102
--build-only \
102103
--requirements-file=./third-party/glad/requirements.txt

.github/workflows/ci-freebsd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ jobs:
105105
devel/cmake-core \
106106
devel/evdev-proto \
107107
devel/git \
108-
devel/libayatana-appindicator \
109108
devel/libevdev \
110-
devel/libnotify \
111109
devel/llvm${{ env.FREEBSD_CLANG_VERSION }} \
112110
devel/ninja \
113111
devel/pkgconf \
112+
devel/qt6-base \
114113
ftp/curl \
115114
graphics/libdrm \
115+
graphics/qt6-svg \
116116
graphics/wayland \
117117
lang/python314 \
118118
multimedia/libva \

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
path = packaging/linux/flatpak/deps/flatpak-builder-tools
33
url = https://github.com/flatpak/flatpak-builder-tools.git
44
branch = master
5-
[submodule "packaging/linux/flatpak/deps/shared-modules"]
6-
path = packaging/linux/flatpak/deps/shared-modules
7-
url = https://github.com/flathub/shared-modules.git
8-
branch = master
95
[submodule "third-party/build-deps"]
106
path = third-party/build-deps
117
url = https://github.com/LizardByte/build-deps.git

cmake/compile_definitions/common.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ set(SUNSHINE_TARGET_FILES
6262
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Rtsp.h"
6363
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/RtspParser.c"
6464
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Video.h"
65-
"${CMAKE_SOURCE_DIR}/third-party/tray/src/tray.h"
6665
"${CMAKE_SOURCE_DIR}/src/upnp.cpp"
6766
"${CMAKE_SOURCE_DIR}/src/upnp.h"
6867
"${CMAKE_SOURCE_DIR}/src/cbs.cpp"
@@ -159,3 +158,11 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
159158
${Boost_LIBRARIES}
160159
${OPENSSL_LIBRARIES}
161160
${PLATFORM_LIBRARIES})
161+
162+
# tray icon
163+
if(SUNSHINE_ENABLE_TRAY)
164+
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES tray::tray)
165+
else()
166+
set(SUNSHINE_TRAY 0)
167+
message(STATUS "Tray icon disabled")
168+
endif()

cmake/compile_definitions/linux.cmake

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
if(FREEBSD)
44
add_compile_definitions(SUNSHINE_PLATFORM="freebsd")
5+
# FreeBSD installs packages to /usr/local/lib, which is not in the default linker search path.
6+
# link_directories() is directory-scoped and propagates to all subdirectories (including tests/),
7+
# so all targets (sunshine, test_sunshine) can resolve libraries found via pkg_check_modules.
8+
link_directories(/usr/local/lib)
59
else()
610
add_compile_definitions(SUNSHINE_PLATFORM="linux")
711
endif()
@@ -199,37 +203,6 @@ if(NOT ${CUDA_FOUND}
199203
message(FATAL_ERROR "Couldn't find either cuda, libva, pipewire, wayland, x11, or (libdrm and libcap)")
200204
endif()
201205

202-
# tray icon
203-
if(${SUNSHINE_ENABLE_TRAY})
204-
pkg_check_modules(APPINDICATOR ayatana-appindicator3-0.1)
205-
if(APPINDICATOR_FOUND)
206-
list(APPEND SUNSHINE_DEFINITIONS TRAY_AYATANA_APPINDICATOR=1)
207-
else()
208-
pkg_check_modules(APPINDICATOR appindicator3-0.1)
209-
if(APPINDICATOR_FOUND)
210-
list(APPEND SUNSHINE_DEFINITIONS TRAY_LEGACY_APPINDICATOR=1)
211-
endif ()
212-
endif()
213-
pkg_check_modules(LIBNOTIFY libnotify)
214-
if(NOT APPINDICATOR_FOUND OR NOT LIBNOTIFY_FOUND)
215-
message(STATUS "APPINDICATOR_FOUND: ${APPINDICATOR_FOUND}")
216-
message(STATUS "LIBNOTIFY_FOUND: ${LIBNOTIFY_FOUND}")
217-
message(FATAL_ERROR "Couldn't find either appindicator or libnotify")
218-
else()
219-
include_directories(SYSTEM ${APPINDICATOR_INCLUDE_DIRS} ${LIBNOTIFY_INCLUDE_DIRS})
220-
link_directories(${APPINDICATOR_LIBRARY_DIRS} ${LIBNOTIFY_LIBRARY_DIRS})
221-
222-
list(APPEND PLATFORM_TARGET_FILES "${CMAKE_SOURCE_DIR}/third-party/tray/src/tray_linux.c")
223-
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES ${APPINDICATOR_LIBRARIES} ${LIBNOTIFY_LIBRARIES})
224-
endif()
225-
226-
set(SUNSHINE_TRAY_PREFIX "${PROJECT_FQDN}")
227-
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_TRAY_PREFIX="${SUNSHINE_TRAY_PREFIX}")
228-
else()
229-
set(SUNSHINE_TRAY 0)
230-
message(STATUS "Tray icon disabled")
231-
endif()
232-
233206
# These need to be set before adding the inputtino subdirectory in order for them to be picked up
234207
set(LIBEVDEV_CUSTOM_INCLUDE_DIR "${EVDEV_INCLUDE_DIR}")
235208
set(LIBEVDEV_CUSTOM_LIBRARY "${EVDEV_LIBRARY}")

cmake/compile_definitions/macos.cmake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,3 @@ set(PLATFORM_TARGET_FILES
5858
"${CMAKE_SOURCE_DIR}/third-party/TPCircularBuffer/TPCircularBuffer.c"
5959
"${CMAKE_SOURCE_DIR}/third-party/TPCircularBuffer/TPCircularBuffer.h"
6060
${APPLE_PLIST_FILE})
61-
62-
if(SUNSHINE_ENABLE_TRAY)
63-
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
64-
${COCOA})
65-
list(APPEND PLATFORM_TARGET_FILES
66-
"${CMAKE_SOURCE_DIR}/third-party/tray/src/tray_darwin.m")
67-
endif()

cmake/compile_definitions/windows.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,3 @@ list(PREPEND PLATFORM_LIBRARIES
105105
ws2_32
106106
wsock32
107107
)
108-
109-
if(SUNSHINE_ENABLE_TRAY)
110-
list(APPEND PLATFORM_TARGET_FILES
111-
"${CMAKE_SOURCE_DIR}/third-party/tray/src/tray_windows.c")
112-
endif()

cmake/dependencies/common.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/Simple-Web-Server")
1919
# libdisplaydevice
2020
add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/libdisplaydevice")
2121

22+
if(SUNSHINE_ENABLE_TRAY)
23+
add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/tray")
24+
endif()
25+
2226
# common dependencies
2327
include("${CMAKE_MODULE_PATH}/dependencies/nlohmann_json.cmake")
2428
find_package(PkgConfig REQUIRED)

cmake/packaging/linux.cmake

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -138,33 +138,50 @@ set(CPACK_RPM_PACKAGE_AUTOREQ ON)
138138
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
139139
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps"
140140
RENAME "${PROJECT_FQDN}.svg")
141+
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
142+
DESTINATION "${SUNSHINE_ASSETS_DIR}/web/images"
143+
RENAME "logo-sunshine.svg")
141144

142145
# tray icon
143146
if(${SUNSHINE_TRAY} STREQUAL 1)
144-
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
145-
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
146-
RENAME "${PROJECT_FQDN}-tray.svg")
147-
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-playing.svg"
148-
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
149-
RENAME "${PROJECT_FQDN}-playing.svg")
150-
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-pausing.svg"
151-
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
152-
RENAME "${PROJECT_FQDN}-pausing.svg")
153-
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-locked.svg"
154-
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
155-
RENAME "${PROJECT_FQDN}-locked.svg")
147+
# Icons used by the Qt tray backend are no longer installed to the hicolor icon theme,
148+
# because Qt6 will not allow icons not part of the theme... so we will use icons from our web directory instead
156149

157-
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
150+
if(TRAY_QT_VERSION EQUAL 6)
151+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
158152
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
159-
libayatana-appindicator3-1, \
160-
libnotify4")
161-
set(CPACK_RPM_PACKAGE_REQUIRES "\
153+
libqt6widgets6, \
154+
libqt6dbus6, \
155+
libqt6svg6"
156+
)
157+
set(CPACK_RPM_PACKAGE_REQUIRES "\
162158
${CPACK_RPM_PACKAGE_REQUIRES}, \
163-
libappindicator-gtk3 >= 12.10.0")
164-
list(APPEND CPACK_FREEBSD_PACKAGE_DEPS
165-
devel/libayatana-appindicator
166-
devel/libnotify
167-
)
159+
qt6-qtbase, \
160+
qt6-qtsvg"
161+
)
162+
list(APPEND CPACK_FREEBSD_PACKAGE_DEPS
163+
x11-toolkits/qt6-widgets
164+
devel/qt6-dbus
165+
graphics/qt6-svg
166+
)
167+
else()
168+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
169+
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
170+
libqt5widgets5, \
171+
libqt5dbus5, \
172+
libqt5svg5"
173+
)
174+
set(CPACK_RPM_PACKAGE_REQUIRES "\
175+
${CPACK_RPM_PACKAGE_REQUIRES}, \
176+
qt5-qtbase, \
177+
qt5-qtsvg"
178+
)
179+
list(APPEND CPACK_FREEBSD_PACKAGE_DEPS
180+
x11-toolkits/qt5-widgets
181+
devel/qt5-dbus
182+
graphics/qt5-svg
183+
)
184+
endif()
168185
endif()
169186

170187
# desktop file

cmake/targets/linux.cmake

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# linux specific target definitions
22

3-
# Using newer c++ compilers / features on older distros causes runtime dyn link errors
4-
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
5-
-static-libgcc
6-
-static-libstdc++
7-
)
3+
if(NOT FREEBSD)
4+
# Using newer c++ compilers / features on older distros causes runtime dyn link errors
5+
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
6+
-static-libgcc
7+
-static-libstdc++
8+
)
9+
endif()

0 commit comments

Comments
 (0)