我的桌面文件是:
[Desktop Entry]
Name=Heimer
GenericName=Mind map application
Comment=Mind map application
Exec=heimer
Icon=heimer
Type=Application
Categories=Education;
StartupNotify=true
我的 snapcraft.yaml 是:
name: heimer
version: '1.1.0'
summary: Heimer is a simple cross-platform mind map tool.
description: |
Heimer is a simple cross-platform mind map creation tool.
Emphasis on easy diagram creation, simplicity, and speed.
grade: stable
confinement: strict
icon: ../../../data/icons/heimer.png
apps:
heimer:
command: desktop-launch heimer
desktop: usr/share/applications/heimer.desktop
plugs: [home, x11, wayland]
parts:
gnu-heimer:
source: ../../../
plugin: cmake
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=/usr
build-packages:
- qtbase5-dev
- qttools5-dev
- qttools5-dev-tools
stage-packages:
- libqt5xml5
after: [desktop-qt5]
CMake 将应用程序图标安装到:
# Install icons
install(FILES data/icons/heimer.png DESTINATION share/pixmaps)
install(FILES data/icons/heimer.png DESTINATION share/icons/hicolor/64x64/apps)
桌面文件安装到:
# Install .desktop files
install(FILES ${CMAKE_BINARY_DIR}/heimer.desktop DESTINATION share/applications)
我不明白问题是什么。安装 snap 后,我的应用程序始终在启动器中显示默认系统图标(Ubuntu 18.04)。创建包或运行包时没有警告或任何东西。
注意:同样的设置也适用于 Debian 打包。我的 Debian 软件包使用完全相同的安装位置,并且图标在这种情况下工作得很好。