Trying to understand how to incorporate my .desktop file

I am trying to add the .desktop file to my codebase, so that it ends up in my gui folder. Is there config for this, or do I have to copy the file to the correct location myself? Thanks, I’m a newbie. :slight_smile:

Please share your snap yaml with us.

Hi can you kindly share a better readable format? You can use pastebin to share also if that helps.

name:  shareandcollaborate-com
version: "0.0.6"
summary: ShareAndCollaborate.com Host
description: |
  ShareAndCollaborate.com is an online or self-hosted network software social & organization space, 
  with file-sharing, email, calendaring, collaboration, and more. 
  Use it online or install and host it yourself.
contact: todd_hiltz@hotmail.com
website: https://ShareAndCollaborate.com
type: "app"
#icon: "icon.png"
icon: gui/icon.png
#base: core24
base: core22 
grade: stable
#confinement: classic
confinement: strict
license: "AGPL-3.0-or-later"
compression: xz
apps:
  shareandcollaborate-com:
    #command: usr/lib/shareandcollaborate.com/shareandcollaborate.com --no-sandbox
    command: usr/lib/shareandcollaborate.com/shareandcollaborate.com --no-sandbox
    #command: desktop-launch shareandcollaborate-com
    #desktop: gui/shareandcollaborate-com.desktop
    # Is this required for the shareandcollaborate-com command to work? 9-18-2025. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    extensions: [gnome]                
    plugs: 
    - network
    - network-bind
    - opengl
    - desktop
    - desktop-legacy
    - unity7
    - wayland
    - x11
    - home
    - pulseaudio
    - audio-playback
    - browser-support
    - cups
    #
    #- camera
    - removable-media
    # added below 9-17-2025. REMOVED 9-18-2025 7-08am ast <<<<<<<<<<<<<<<<<<<<<<<<<<<<
    #- fuse-support
    #- mount-observe
    #
    #- system-files
    #extensions: [gnome-3-28]
    - browser-support
    #Tray icon not displayed in Ubuntu with Snap #26854
    #https://github.com/JGCarroll/joplin-desktop-snap/commit/428d39046ba3e49076a6b1fb9a50a8262914f309
    #- password-manager-service
    #Adding audio 9-8-2025.
    #https://medium.com/@Jeff_Duke_io/working-with-html5-audio-in-electron-645b2d2202bd
    #- private-shmem
    #- audio-record
    # added below 9-17-2025. REMOVED 9-18-2025 7-08am ast <<<<<<<<<<<<<<<<<<<<<<<<<<<<
    #DO WE NEED THIS??????? COMMENTED OUT 9-28-2025
    #environment:
    #  XDG_RUNTIME_DIR: $SNAP_USER_RUNTIME # This may already be in your base snap, but check your snapcraft.yaml
    #  # Add this if your app directly needs access to the session bus
    #  DBUS_SESSION_BUS_ADDRESS: "unix:path=$SNAP_USER_RUNTIME/bus"
parts:
  my-static-files:
    plugin: dump
    source: gui
    #organize: 
    #  'gui/acornicon.png': 'meta/gui/acornicon.png'
    #  'gui/icon.icns': 'meta/gui/icon.icns'
    #  'gui/icon.ico': 'meta/gui/icon.ico'
    #  'gui/icon.png': 'meta/gui/icon.png'
    #source: gui
    #organize:
    #  'path/to/source/file.txt': 'path/in/snap/destination/file.txt'
    #  'another/source/dir': 'another/destination/dir'
  shareandcollaborate-com:
    plugin: dump
    source: ./out/make/deb/x64/shareandcollaborate.com_0.0.6_amd64.deb
    source-type: deb
    stage-packages:
      - libasound2
      - libnotify4
      - libnspr4
      - libnss3
      - libpcre3
      - libpulse0
      - libxss1
      - libxtst6
      # added below 9-17-2025. REMOVED 9-18-2025 7-08am ast <<<<<<<<<<<<<<<<<<<<<<<<<<<<
      #- libfuse2
      #  libfuse2t64 9-17-2025

The top level icon keyword takes the icon from the local repo where the snapcraft.yaml file is. Not from within the parts. Are you building this from a repo hosted somewhere?

I am doing it on bare metal, … it is an electron application, wrapped in a snap. Not sure if “bare metal” is the correct term, but using a dedicated Ubuntu 24.04 laptop for this purpose. Thanks for engaging, I appreciate the input.

Just put your icon in a reasonable path and point to that exact path in your .desktop file. Finally, to point to that desktop file set this in the apps section

apps:
  app-name:
    command:
    desktop: <path>.desktop

1 Like

I finally have my application icon displayed in the left-side application bar in Ubuntu 24.04. Thank you. Happy Monday! :smiley: Releasing as the next candidate, … a few minutes later … I just installed it from the snap store, and it works. … it has the application icon, and the “Open” button works, meaning that the .desktop file has been configured correctly. Thanks again, this has been a roadblock for me lately. :beer: :smiley: And it “Pins to Dash”. that rocks…

1 Like