bazzet
February 27, 2018, 4:52am
1
Hey,
How do I get my snap to appear in window manager menus, with an icon?
Here is a simple project that does not currently work: https://upload.run/egzune
I followed the instructions here: https://docs.snapcraft.io/build-snaps/metadata
What do I need to change in that project to get it working?
bazzet
February 27, 2018, 12:51pm
2
Anyone? There must be something obvious that i am missing here…
Can you put the assets onto a repo maybe?
I suspect that you might be missing a desktop file.
bazzet
February 27, 2018, 1:30pm
4
What do you mean, assets? Move my icon and .desktop file into another folder?
I have a .desktop file in the ”gui” folder, are you saying that i need more than one?
Can you share just the desktop
file here in a post?
bazzet
February 27, 2018, 9:28pm
6
[Desktop Entry]
Name=icontest
Comment=icontest
TryExec=icontest
Exec=icontest %U
StartupNotify=true
Terminal=false
Type=Application
Icon=${SNAP}/meta/gui/icontest.png
NoDisplay=true
Name[en_US]=icontest.desktop
fiber
February 27, 2018, 10:00pm
7
What ended up working in my case…
a path relative to the prime directory pointing to a desktop file
(found in https://docs.snapcraft.io/build-snaps/metadata )
Aha! I built the snap on my machine and went looking for the myproject.desktop
file in the prime
folder snapcraft creates when building the snap. The original lives in the data
folder in my project but snapcraft copied it over to a subfolder in its prime
folder. Once you have that location you can add it to your snapcraft.yml
config:
---- 8< ----
apps:
myproject:
command: desktop-launch myproject
desktop: share/applications/myproject.desktop
---- 8< ----
With the path being the relative path within the prime
directory.
I am no snapcraft expert, YMMV.
bazzet
February 27, 2018, 10:08pm
8
Do you mind sharing a working snapcraft.yaml ?
I get this when i build mine using the modified project that I posted:
The path 'prime/share/applications/icontest.desktop' set for 'desktop' in 'icontest' does not exist.
bazzet
February 27, 2018, 10:37pm
9
Where exactly is this ‘data’ folder supposed to be in my folder structure?
edit: and how am I supposed to know this when it isn’t in the documentation?
bazzet
February 28, 2018, 4:16am
10
Ok I finally got it.
I was looking in the wrong direction. The problem was actually the .desktop file missing some entries, as @sergiusens might have suggested in the future…