Having multiple *.desktop files in snap

Hey there…

In budgie-welcome we have multiple .desktop files of which some are “shortcuts” to a specific state in the applications. for example some of the secondary files would use an exec with something like Exec=budgie-welcome --jump-to=budgie-applets. Now if I simply drop all of my desktops in the gui folder, will this be sufficient? I’m not far enough along to test this (no working build yet). My assumption is that it will just bring in the multiple desktop files based on the extension.

Thanks for the help.

To be sure of compatibility I wouldn’t rely on the implicit assignment of desktop files by putting them in snap/. Instead I would ensure they’re somewhere inside the snap filesystem during build and assign each to their app by using desktop: in the yaml:

apps:
  app1:
    command: desktop-launch $SNAP/usr/bin/app1
    desktop: usr/share/applications/app1.desktop
    plugs: [x11, wayland, desktop, desktop-legacy]

  another-app:
    command: desktop-launch $SNAP/usr/bin/another-app
    desktop: usr/share/applications/another-app.desktop
    plugs: [x11, wayland, desktop, desktop-legacy]

Although I’m not sure you’ll be able to assign multiple desktop files to a single app with either method.

1 Like

Thanks for the feedback. I’ll see if I can get that tested once I have a successful build.

Rather than assign multiple desktop files to a single app, you could just create multiple apps for each set of commandline arguments:

apps:
  budgie-welcome:
    command: desktop-launch $SNAP/usr/bin/budgie-welcome
    desktop: path/to/budgie-chirps.desktop

  budgie-applets:
    command: desktop-launch $SNAP/usr/bin/budgie-welcome --jump-to=budgie-applets
    desktop: path/to/budgie-applets.desktop

  budgie-moo:
    command: desktop-launch $SNAP/usr/bin/budgie-welcome --jump-to=cowsay # example. I have no idea what I'm doing :slight_smile:
    desktop: path/to/cow-moos.desktop

Thats WAY better!

Great idea!