Skip to content

An open-source cross-platform alternative to AirDrop

fix(linux): install rpm icon without setuid, set StartupWMClass and require libappindicator-gtk3 (#3738)

Tien Nam Do12ec31310382
diff --git a/.github/workflows/build_linux_rpm_x64.yml b/.github/workflows/build_linux_rpm_x64.yml
index f5bd416f..c4e64225 100644
--- a/.github/workflows/build_linux_rpm_x64.yml
+++ b/.github/workflows/build_linux_rpm_x64.yml
@@ -52,15 +52,24 @@ jobs:
- name: Enable dart_distributor
run: dart pub global activate flutter_distributor
- # rpm 4.20+ runs %install in a per-package build subdirectory, while
- # flutter_app_packager stages the bundle and desktop assets in its parent.
- # Patch the Dart template variables and verify all four copy commands.
- - name: Patch flutter_app_packager for rpm 4.20
+ # Patch flutter_app_packager's hardcoded rpm spec and desktop entry:
+ # - rpm 4.20+ runs %install in a per-package build subdirectory, while
+ # flutter_app_packager stages the bundle and desktop assets in its parent.
+ # Patch the Dart template variables and verify all four copy commands.
+ # - The pixmap is installed setuid (4755); install it as 644.
+ # - The rpm desktop entry has no StartupWMClass option. It must match the
+ # GTK application id in linux/CMakeLists.txt, otherwise the desktop
+ # environment cannot map the window to the entry and shows a generic icon.
+ - name: Patch flutter_app_packager
run: |
F=$(find "$HOME/.pub-cache/hosted/pub.dev" -path '*/flutter_app_packager-*/lib/src/makers/rpm/make_rpm_config.dart' | head -1)
test -n "$F"
sed -i 's|cp -r \$appName/|cp -r ../$appName/|; s|cp -r \$appBinaryName|cp -r ../$appBinaryName|g' "$F"
test "$(grep -cF 'cp -r ../' "$F")" -eq 4
+ sed -i "s|'(4755, root, root) %{_datadir}/pixmaps/|'(644, root, root) %{_datadir}/pixmaps/|" "$F"
+ test "$(grep -cF "'(644, root, root) %{_datadir}/pixmaps/" "$F")" -eq 1
+ sed -i "s|'StartupNotify': startupNotify,|&\n 'StartupWMClass': 'org.localsend.localsend_app',|" "$F"
+ test "$(grep -cF "'StartupWMClass': 'org.localsend.localsend_app'," "$F")" -eq 1
dart pub global deactivate flutter_distributor
dart pub global activate flutter_distributor
diff --git a/app/linux/packaging/rpm/make_config.yaml b/app/linux/packaging/rpm/make_config.yaml
index 97fa592a..0a289449 100644
--- a/app/linux/packaging/rpm/make_config.yaml
+++ b/app/linux/packaging/rpm/make_config.yaml
@@ -8,7 +8,9 @@ license: MIT
icon: assets/img/logo-512.png
requires:
- - libappindicator
+ # The app links libappindicator3.so.1. Plain "libappindicator" is the GTK2
+ # variant and pulls in gtk2, which the app does not use.
+ - libappindicator-gtk3
- xdg-user-dirs
keywords: