Hello there!
On KDE Plasma (tried on openSUSE, KDE Neon, KUbuntu…), the icon for our application O20 (https://snapcraft.io/office20) has no icon when browsing the applications/Office category of the launcher. However, the icon appears as expected when searching for O20.Word in the launcher. Also, the icons for all other snaps appear as expected.
This is my snapcraft.yaml:
---
name: office20
version: "20.2.4"
summary: "The free and open source Office365 clone for Linux"
description: "A modern office suite built with Qt5, KDE, SnapCraft, and GitLab."
grade: stable
confinement: strict
base: core18
architectures:
- amd64
apps:
word:
command: kf5-launch $SNAP/usr/bin/o20.word
common-id: org.gitlab.o20.word.desktop
desktop: usr/share/applications/io.gitlab.o20.word.desktop
plugs:
- browser-support
- desktop
- desktop-legacy
- home
- kde-frameworks-5-plug
- pulseaudio
- opengl
- unity7
- x11
plugs:
kde-frameworks-5-plug:
interface: content
content: kde-frameworks-5-core18-all
default-provider: kde-frameworks-5-core18
target: kf5
parts:
o20base:
plugin: cmake
source-type: git
source: https://gitlab.com/abstractsoftware/o20/o20coreapps.git
source-commit: "b129b74c79743dc5c7707a0efc52d0925281fcc7"
build-packages:
- build-essential
- libegl1-mesa-dev
- sonnet-plugins
build-snaps:
- kde-frameworks-5-core18-sdk
stage-packages:
- flite
- hunspell-en-us
- pandoc
configflags:
- "-DKDE_INSTALL_USE_QT_SYS_PATHS=ON"
- "-DCMAKE_INSTALL_PREFIX=/usr"
- "-DCMAKE_BUILD_TYPE=Release"
- "-DENABLE_TESTING=OFF"
- "-DBUILD_TESTING=OFF"
- "-DKDE_SKIP_TEST_SETTINGS=ON"
override-pull: |
snapcraftctl pull
sed -i.bak -e 's|Icon=io.gitlab.o20.word|Icon=/usr/share/icons/hicolor/scalable/apps/io.gitlab.o20.word.svg|g' dev/o20.word/io.gitlab.o20.word.desktop
kde-frameworks-5-env:
plugin: dump
source: https://github.com/apachelogger/kf5-snap-env.git
I have tried a lot of things but none of them worked. Why is this happening?
I hope this was the right place to put this.
Here is my workarounds - this is not a fix, but may assist in development troubleshooting.
I’ve experienced this issue with both Blender 3D and Audacity.
With Audacity I edited the .desktop file /var/lib/snapd/desktop/applications/audacity_audacity.desktop and removed .svg from the end of the line Icon=.
With Blender I tried the same but it did not fix this. I ended up copying the blender.svg icon into that directory (/var/lib/snapd/desktop/applications) and shortened the icon line altogether to simply be Icon=blender.svg which works.
This will lbreak again when a new revision is applied from updating via snap refresh as the .desktop files will be recreated to reflect the new revision number.
Yes, solution #1 (same as for Audacity) worked! However, as the developer of the application, I would like to fix this for all users.
Maybe just replacing io.gitlab.o20.word.svg
with io.gitlab.o20.word
(removing the svg extension?) will work? But this might also break for other DE’s…
You are the developer of the application? Here’s a few suggestions…
-
This could be a weird path issue and nought to do with distro…
-
The .svg icon being provided may not be a conforming .svg, in fact it might not even be a real .svg at all - it might be an incorrectly named png, jpg, etc … because linux is quite forgiving and without the extension it will load the graphic using the format that the system determines it to be.
-
If the issue is distro specific, can there be a post installation script that could detect the distro name and use sed to find and replace .svg for the .desktop file maybe like this ?
sed -i ‘s/audacity.svg/audacity/g’ /var/lib/snapd/desktop/applications/audacity_audacity.desktop
I have not done ‘distro’ identify before but I will research and post findings. In the interim here’s a link:
https://unix.stackexchange.com/questions/35183/how-do-i-identify-which-linux-distro-is-running
Once we can identify the distro, grep can be used to identify the string and then it would be something like:
distro=$(command to get distro)
if grep ‘suse’ <<< $distro; then
sed -i ‘s/audacity.svg/audacity/g’ /var/lib/snapd/desktop/applications/audacity_audacity.desktop
fi
This works for OpenSuSE:
cat /etc/*-release
So for my distro:
distro=$(cat /etc/*-release)
if grep ‘suse’ <<< $distro; then
sed -i ‘s/audacity.svg/audacity/g’ /var/lib/snapd/desktop/applications/audacity_audacity.desktop
fi
Well, I tried replacing the path to svg icon with a png, and it works. So I guess it must be some sort of DE problem. So maybe just deploying my application with a nonscalable icon will work.
Option 3 would be good, because then I can keep the scalable icon, however I don’t think my snap can access /var/lib/snapd/. Also I would need to know what DE I’m on, not what distro, because it seems to happen for all KDE desktops.
Yeah I’m using Plasma…
de=$DESKTOP_SESSION
if grep ‘plasma’ <<< “$de”; then
sed -i ‘s/audacity.svg/audacity/g’ /var/lib/snapd/desktop/applications/audacity_audacity.desktop
fi
Here’s some more info on DE identification:
https://askubuntu.com/questions/125062/how-can-i-find-which-desktop-enviroment-i-am-using
In OpenSuSE SNAPS must be installed as root. This gives write permissions to system folders. I’m guessing that the SNAP daemon installation itself must create sudoers style permission or set crontabs to run as root for use during updates and if your POST install / refresh script is hooked into the end of that should be able to take advantage.
Some info on SNAP post-refresh hook:
Might be worth considering Window Manager type as well.
So in saying all that this is going to be UBER tricky NEED HELP ! because the machine may have multiple window managers and/or desktop environments so how do you compose the icon path to be able to work for all of them from a single .desktop file? … I don’t know if can be done … is there someone very high level can this be referred to ? (Popey)
BTW … I am seriously looking forward to your app … thanks !
1 Like
Thank you @michaelmcdonald… I think it will be easier to just change the icons to png.
1 Like