Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ubuntu - Right way to craft a .desktop entry for the AppImage
#1
Background: I've downloaded GIMP-3.0.6-x86_64.AppImage onto my Ubuntu 24.04.3 LTS box, then created a .local/share/applications/GIMP.desktop file with the following content...

[Desktop Entry]
Version=1.0
Name=GIMP
Exec=/home/mark/Applications/GIMP-3.0.6-x86_64.AppImage
Icon=/home/mark/.local/share/GIMP.png
Terminal=false
Type=Application
Categories=Graphics;


... and then pinned it to the left sidebar (the "dash") searching for it in the app launcher, right-clicking it, and clicking "Pin to Dash".

It... sort of works. I see the icon in my sidebar:

[Image: BpAd6NW.jpeg]

And when I click on that icon, GIMP opens. But GNOME doesn't seem to understand that the newly opened window is associated with the GIMP program whose sidebar shortcut I just clicked on. Instead, it creates a new, temporary shortcut, with a generic gear icon, in the bottom section of the dash:

[Image: SmVwbcQ.jpeg]

This behaviour differs from other AppImage-based applications I've created .desktop files for. For instance, if I open multiple windows of Zed, I see three orange dots next to my Zed icon in my sidebar, and I can right-click on the sidebar icon and go to "All Windows" to see all the open Zed windows I have open:

[Image: 8mD9TsS.jpeg]

How - if at all - can I likewise make my open GIMP window be represented by an orange dot next to my pinned GIMP shortcut, instead of by adding a new shortcut with a gear icon? Is the reason this doesn't work that I have done something wrong in crafting my .desktop file, or is GIMP missing some kind of feature that's needed for it to properly integrate with the GNOME dock in the way other programs do.
Reply
#2
I use KDE (kubuntu 24.04 / Gimp 3.0.6 appimage) so obviously some differences.  I can not see anything really wrong with your .desktop file. Just for comparison this is mine.

Code:
[Desktop Entry]
Comment=
Exec=/media/rich/DATA1/portable/gimp3/GIMP-3.0.6-x86_64.AppImage
Icon=/home/rich/icons/gimp.png
Name=Gimp-3.0
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=

A long shot -  do you have this folder   ~/.local/share/appimagekit/  and what does it contain?  A zero length text file (title only) no_desktopintegration prevents an appimage making a desktop file.

   
Reply
#3
Ooh - if I copy and paste your .desktop file (and change the file paths), it works correctly! So while you may not be able to see anything wrong with mine, and I can't tell what was wrong either, there was SOMETHING wrong with it.

I'll experiment until I figure out exactly which difference between the two is the thing that matters, then post again...

The difference that mattered was the line:

Code:
StartupNotify=true


If I add that to my .desktop file, everything works as expected. Thanks!

I don't entirely understand why it's needed; the only docs/spec I'm aware of explaining what the properties in .desktop do is https://specifications.freedesktop.org/d...-keys.html, and to someone like me who knows nothing about Freedesktop (indeed I had to Google what Freedesktop even is), most of the description of StartupNotify is incomprehensible technobabble.

But I do think I roughly understand the following gist:
  • GNOME (used by default on Ubuntu) is built on top of Freedesktop
  • There is a specification called the "Startup Notification Protocol" that desktop GUI applications can conform to in order to let Freedesktop track their startup
  • The StartupNotify key tells a Freedesktop-based desktop environment whether the application supports the Startup Notification Protocol or not. The spec doesn't dictate precisely what to do if that key is omitted, but suggests that it is "reasonable" to treat that case the same as if StartupNotify=false is specified explicitly (which would mean the application has absolutely no support for the Startup Notification Protocol).
  • Presumably, the Startup Notification Protocol is the only way GNOME gets told that a window that gets opened by the GIMP AppImage was actually related to that AppImage (and without the protocol notifications, it doesn't know how to associate the two with each other), so we need to explicitly tell GNOME to expect and handle Startup Notification Protocol notifications.
At least, that model that I've inferred / made up makes sense in my head! Thanks for the help.

(I crafted my .desktop file based on the Ask Ubuntu answer at https://askubuntu.com/a/1454276/119754, so I'll comment there suggesting that, for many applications, StartupNotify may also be necessary.)

Oh, also, just for completeness, I'll note that no, I don't have the ~/.local/share/appimagekit/ folder that you asked about - though I figure it probably doesn't matter either way, now!
Reply


Forum Jump: