Skip to content

Commit f4eceff

Browse files
fix(linux): migrate to qt tray
1 parent 3fb10a0 commit f4eceff

16 files changed

Lines changed: 99 additions & 78 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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ 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/qt5-buildtools \
113+
devel/qt5-dbus \
114+
devel/qt5-qmake \
114115
ftp/curl \
115116
graphics/libdrm \
116117
graphics/wayland \
@@ -127,7 +128,8 @@ jobs:
127128
x11/libXfixes \
128129
x11/libXrandr \
129130
x11/libXtst \
130-
x11-servers/xorg-server
131+
x11-servers/xorg-server \
132+
x11-toolkits/qt5-widgets
131133
132134
# create symlink for shebang bash compatibility
133135
ln -s /usr/local/bin/bash /bin/bash

.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/linux.cmake

Lines changed: 21 additions & 17 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()
@@ -201,26 +205,26 @@ endif()
201205

202206
# tray icon
203207
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)
208+
find_package(Qt6 QUIET COMPONENTS Widgets DBus)
209+
if(Qt6_FOUND)
210+
set(TRAY_QT_VERSION 6)
207211
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+
find_package(Qt5 QUIET COMPONENTS Widgets DBus)
213+
if(Qt5_FOUND)
214+
set(TRAY_QT_VERSION 5)
215+
else()
216+
message(FATAL_ERROR
217+
"Could not find Qt5 or Qt6 (Widgets and DBus components required for the tray icon). "
218+
"Install qtbase5-dev (Debian/Ubuntu), qt5-qtbase-devel (Fedora), or qt5-base (Arch). "
219+
"Alternatively disable the tray with -DSUNSHINE_ENABLE_TRAY=OFF")
220+
endif()
212221
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})
221222

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})
223+
list(APPEND PLATFORM_TARGET_FILES "${CMAKE_SOURCE_DIR}/third-party/tray/src/tray_linux.cpp")
224+
if(TRAY_QT_VERSION EQUAL 6)
225+
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES Qt6::Widgets Qt6::DBus)
226+
else()
227+
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES Qt5::Widgets Qt5::DBus)
224228
endif()
225229

226230
set(SUNSHINE_TRAY_PREFIX "${PROJECT_FQDN}")

cmake/packaging/linux.cmake

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,35 @@ if(${SUNSHINE_TRAY} STREQUAL 1)
154154
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
155155
RENAME "${PROJECT_FQDN}-locked.svg")
156156

157-
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
157+
if(TRAY_QT_VERSION EQUAL 6)
158+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
158159
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
159-
libayatana-appindicator3-1, \
160-
libnotify4")
161-
set(CPACK_RPM_PACKAGE_REQUIRES "\
160+
libqt6widgets6, \
161+
libqt6dbus6"
162+
)
163+
set(CPACK_RPM_PACKAGE_REQUIRES "\
162164
${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-
)
165+
qt6-qtbase"
166+
)
167+
list(APPEND CPACK_FREEBSD_PACKAGE_DEPS
168+
x11-toolkits/qt6-widgets
169+
devel/qt6-dbus
170+
)
171+
else()
172+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
173+
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
174+
libqt5widgets5, \
175+
libqt5dbus5"
176+
)
177+
set(CPACK_RPM_PACKAGE_REQUIRES "\
178+
${CPACK_RPM_PACKAGE_REQUIRES}, \
179+
qt5-qtbase"
180+
)
181+
list(APPEND CPACK_FREEBSD_PACKAGE_DEPS
182+
x11-toolkits/qt5-widgets
183+
devel/qt5-dbus
184+
)
185+
endif()
168186
endif()
169187

170188
# 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()

docs/building.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ pkg install -y \
2626
devel/cmake \
2727
devel/evdev-proto \
2828
devel/git \
29-
devel/libayatana-appindicator \
3029
devel/libevdev \
31-
devel/libnotify \
3230
devel/ninja \
3331
devel/pkgconf \
32+
devel/qt5-buildtools \
33+
devel/qt5-dbus \
34+
devel/qt5-qmake \
3435
ftp/curl \
3536
graphics/libdrm \
3637
graphics/wayland \
@@ -44,7 +45,8 @@ pkg install -y \
4445
x11/libxcb \
4546
x11/libXfixes \
4647
x11/libXrandr \
47-
x11/libXtst
48+
x11/libXtst \
49+
x11-toolkits/qt5-widgets
4850
```
4951

5052
#### Linux

packaging/linux/Arch/PKGBUILD

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ fi
3131
depends=(
3232
'avahi'
3333
'curl'
34-
'libayatana-appindicator'
3534
'libcap'
3635
'libdrm'
3736
'libevdev'
3837
'libmfx'
39-
'libnotify'
4038
'libpipewire'
4139
'libpulse'
4240
'libva'
@@ -49,6 +47,7 @@ depends=(
4947
'numactl'
5048
'openssl'
5149
'opus'
50+
'qt5-base'
5251
'udev'
5352
'which'
5453
)

packaging/linux/copr/Sunshine.spec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ BuildRequires: libcap-devel
3030
BuildRequires: libcurl-devel
3131
BuildRequires: libdrm-devel
3232
BuildRequires: libevdev-devel
33-
BuildRequires: libnotify-devel
3433
BuildRequires: libva-devel
3534
BuildRequires: libX11-devel
3635
BuildRequires: libxcb-devel
@@ -56,7 +55,6 @@ BuildRequires: libappstream-glib
5655
# needed for npm from nvm
5756
BuildRequires: libatomic
5857
%endif
59-
BuildRequires: libayatana-appindicator3-devel
6058
BuildRequires: libgudev
6159
BuildRequires: mesa-libGL-devel
6260
BuildRequires: mesa-libgbm-devel
@@ -69,6 +67,7 @@ BuildRequires: opus-devel
6967
BuildRequires: pulseaudio-libs-devel
7068
BuildRequires: python3-jinja2
7169
BuildRequires: python3-setuptools
70+
BuildRequires: qt5-qtbase-devel
7271
BuildRequires: systemd-udev
7372
%{?sysusers_requires_compat}
7473
# for unit tests
@@ -79,14 +78,14 @@ BuildRequires: xorg-x11-server-Xvfb
7978
# OpenSUSE-specific BuildRequires
8079
BuildRequires: AppStream
8180
BuildRequires: appstream-glib
82-
BuildRequires: libappindicator3-devel
8381
BuildRequires: libgudev-1_0-devel
8482
BuildRequires: Mesa-libGL-devel
8583
BuildRequires: libgbm-devel
8684
BuildRequires: libminiupnpc-devel
8785
BuildRequires: libnuma-devel
8886
BuildRequires: libopus-devel
8987
BuildRequires: libpulse-devel
88+
BuildRequires: libqt5-qtbase-devel
9089
BuildRequires: npm
9190
BuildRequires: python311
9291
BuildRequires: python311-Jinja2
@@ -145,7 +144,6 @@ Requires: which >= 2.21
145144

146145
%if 0%{?fedora}
147146
# Fedora runtime requirements
148-
Requires: libayatana-appindicator3 >= 0.5.3
149147
Requires: libcap >= 2.22
150148
Requires: libcurl >= 7.0
151149
Requires: libdrm > 2.4.97
@@ -157,11 +155,11 @@ Requires: libX11 >= 1.7.3.1
157155
Requires: numactl-libs >= 2.0.14
158156
Requires: openssl >= 3.0.2
159157
Requires: pulseaudio-libs >= 10.0
158+
Requires: qt5-qtbase
160159
%endif
161160

162161
%if 0%{?suse_version}
163162
# OpenSUSE runtime requirements
164-
Requires: libappindicator3-1
165163
Requires: libcap2
166164
Requires: libcurl4
167165
Requires: libdrm2
@@ -173,6 +171,8 @@ Requires: libX11-6
173171
Requires: libnuma1
174172
Requires: libopenssl3
175173
Requires: libpulse0
174+
Requires: libQt5DBus5
175+
Requires: libQt5Widgets5
176176
%endif
177177

178178
%description
Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)