diff --git a/.gitattributes b/.gitattributes index aa66f8d5..976a0281 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,6 +8,7 @@ # text files to be packed /platform/linux/install.sh eol=lf /platform/linux/redpandaide.desktop.in eol=lf +/platform/linux/redpandaide.svg eol=lf /platform/linux/templates/*/*.txt eol=lf /platform/linux/templates/*/*.template eol=lf /platform/linux/templates/*/*.fs eol=lf diff --git a/BUILD.md b/BUILD.md index 81a2f658..0dbb2360 100644 --- a/BUILD.md +++ b/BUILD.md @@ -18,6 +18,7 @@ qmake variables: - `PREFIX`: default to `/usr/local`. It should be set to `/usr` or `/opt/redpanda-cpp` when packaging. - `LIBEXECDIR`: directory for auxiliary executables, default to `$PREFIX/libexec`. Arch Linux uses `/usr/lib`. +- `XDG_ADAPTIVE_ICON=ON`: install the icon file following [freedesktop.org Icon Theme Specification](https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html) for adaptiveness to themes and sizes. Required by AppImage; recommended for Linux packaging if `PREFIX` set to `/usr`. ## Ubuntu diff --git a/BUILD_cn.md b/BUILD_cn.md index 8ee00298..a330c5db 100644 --- a/BUILD_cn.md +++ b/BUILD_cn.md @@ -21,6 +21,7 @@ qmake 变量: - `PREFIX`:默认值是 `/usr/local`。打包时应该定义为 `/usr` 或 `/opt/redpanda-cpp`。 - `LIBEXECDIR`:辅助程序的路径,默认值是 `$PREFIX/libexec`。Arch Linux 使用 `/usr/lib`。 +- `XDG_ADAPTIVE_ICON=ON`:遵循 [freedesktop.org 图标主题规范](https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html)安装图标,以适应不同的主题和尺寸。AppImage 需要启用此项;Linux 打包 `PREFIX=/usr` 时推荐启用此项。 ## Ubuntu diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro index 303f62f1..5b6f2583 100644 --- a/Red_Panda_CPP.pro +++ b/Red_Panda_CPP.pro @@ -55,9 +55,17 @@ linux: { docs.files += LICENSE INSTALLS += docs - pixmaps.path = $${PREFIX}/share/pixmaps - pixmaps.files += platform/linux/redpandaide.png - INSTALLS += pixmaps + equals(XDG_ADAPTIVE_ICON, "ON") { + xdgicons.path = $${PREFIX}/share/icons/hicolor/scalable/apps/ + xdgicons.files += platform/linux/redpandaide.svg + REDPANDA_ICON_PATH = redpandaide + INSTALLS += xdgicons + } else { + pixmaps.path = $${PREFIX}/share/pixmaps + pixmaps.files += platform/linux/redpandaide.png + REDPANDA_ICON_PATH = $${PREFIX}/share/pixmaps/redpandaide.png + INSTALLS += pixmaps + } desktop.path = $${PREFIX}/share/applications desktop.files += platform/linux/redpandaide.desktop diff --git a/packages/appimage/01-in-docker.sh b/packages/appimage/01-in-docker.sh index 55289e8b..bdb117bb 100755 --- a/packages/appimage/01-in-docker.sh +++ b/packages/appimage/01-in-docker.sh @@ -5,7 +5,7 @@ set -xe # build RedPanda C++ mkdir -p /build/redpanda-build cd /build/redpanda-build -/opt/qt5/bin/qmake PREFIX='/usr' QMAKE_RPATHDIR='/_PlaceHolder' /build/RedPanda-CPP/Red_Panda_CPP.pro +/opt/qt5/bin/qmake PREFIX='/usr' XDG_ADAPTIVE_ICON=ON QMAKE_RPATHDIR='/_PlaceHolder' /build/RedPanda-CPP/Red_Panda_CPP.pro make -j$(nproc) # install RedPanda C++ to AppDir @@ -15,8 +15,8 @@ make install INSTALL_ROOT=/build/RedPandaIDE.AppDir cd /build/RedPandaIDE.AppDir ln -s usr/bin/RedPandaIDE AppRun ln -s usr/share/applications/redpandaide.desktop redpandaide.desktop -ln -s usr/share/pixmaps/redpandaide.png redpandaide.png -ln -s usr/share/pixmaps/redpandaide.png .DirIcon +ln -s usr/share/icons/hicolor/scalable/apps/redpandaide.svg redpandaide.svg +cp /build/RedPanda-CPP/platform/linux/redpandaide.png .DirIcon # copy dependency mkdir -p usr/lib @@ -31,4 +31,4 @@ appimagetool --appimage-extract-and-run RedPandaIDE.AppDir RedPandaIDE-$CARCH.Ap # copy back to host mkdir -p /build/RedPanda-CPP/dist -/bin/cp RedPandaIDE-$CARCH.AppImage /build/RedPanda-CPP/dist +cp RedPandaIDE-$CARCH.AppImage /build/RedPanda-CPP/dist diff --git a/packages/archlinux/PKGBUILD b/packages/archlinux/PKGBUILD index 95b4e7d8..7f514f10 100644 --- a/packages/archlinux/PKGBUILD +++ b/packages/archlinux/PKGBUILD @@ -30,6 +30,7 @@ build() { qmake \ PREFIX='/usr' \ LIBEXECDIR='/usr/lib' \ + XDG_ADAPTIVE_ICON=ON \ "$srcdir/$_pkgname/Red_Panda_CPP.pro" make } diff --git a/platform/linux/redpandaide.desktop.in b/platform/linux/redpandaide.desktop.in index f1af2bc8..1742260a 100644 --- a/platform/linux/redpandaide.desktop.in +++ b/platform/linux/redpandaide.desktop.in @@ -11,5 +11,5 @@ StartupNotify=false Terminal=false Type=Application Categories=Development;Qt; -Icon=$${PREFIX}/share/pixmaps/redpandaide +Icon=$${REDPANDA_ICON_PATH} Path=$${PREFIX}/bin diff --git a/platform/linux/redpandaide.svg b/platform/linux/redpandaide.svg new file mode 100644 index 00000000..0650e2d2 --- /dev/null +++ b/platform/linux/redpandaide.svg @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +