Right click menu items don't work?

I have a snap for sublime-text, the snap opens fine from the command line and gnome shell BUT if I right click and select “New File” or “New Window” nothing happens.

Here is my yaml file https://github.com/om26er/sublime-text/blob/a864aedd4363723e2d3492c17b1929a7692ce0fe/snap/snapcraft.yaml

Is there anything specific I should be doing to get them working ?

Another variant of the yaml file I tried that didn’t work either https://github.com/om26er/sublime-text/blob/dbc5dcd7cd0cefdbc31b71896c7bb658955e98f4/snap/snapcraft.yaml (note the different in install scriplet).

Here is how the desktop file looks like

[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=/Icon/256x256/sublime-text.png
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;

[Desktop Action Window]
Name=New Window
Exec=sublime_text -n
OnlyShowIn=Unity;

[Desktop Action Document]
Name=New File
Exec=sublime_text --command new_file
OnlyShowIn=Unity;

Who shall I contact regarding desktop integration of snaps or if there are any links to docs, let me know.

om26er: oh, interesting
om26er: I think our sanitization breaks the desktop file
om26er: can you pastebin the generated destkop file in /var/lib/snapd/desktop/applications
om26er: or better, a diff from the vanilla one
om26er: I suspect we strip something and it’s broken then

We seem to be eating Exec line of sub entries

$ cat /var/lib/snapd/desktop/applications/sublime-text_subl.desktop

[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/sublime-text_subl.desktop /snap/bin/sublime-text.subl %U
Terminal=false
MimeType=text/plain;
Icon=/snap/sublime-text/1/Icon/256x256/sublime-text.png
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;

[Desktop Action Window]
Name=New Window
OnlyShowIn=Unity;

[Desktop Action Document]
Name=New File
OnlyShowIn=Unity;
1 Like

and here is how the desktop file from original source looks like:

[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;

[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;

[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;

Do note that I replace /opt/sublime_text/sublime_text with sublime_text in my snap: https://github.com/om26er/sublime-text/blob/dbc5dcd7cd0cefdbc31b71896c7bb658955e98f4/snap/snapcraft.yaml#L23

Hello typing a longer message as I could not just type “bump”.

This also affects other snaps: I’ve been working on WebTorrent Desktop and have exactly the same behaviour where the Exec= lines in the [Desktop Action...] sections are stripped.