Linux Desktop Application Icon

I have a desktop app to which I have assigned an icon but when I build it for Linux the output doesn’t seem to include the icon file anywhere. To make the icon appear under Ubuntu I need the image file (to refer to in a .desktop file that is created by a script). I would therefore have thought that the file would be part of the Linux build output but it appears not to be.

Is there any way to access the icon image in a Linux build or do I have to add it as additional resource?

Peter

You must create a .desktop file for your app and place it into /usr/share/applications. You can use the other entries in that folder as examples, or wade your way through the convoluted docs at FreeDesktop.org’s Desktop Entry Specification.
Sometimes I shouldn’t respond before coffee :S

[quote=388885:@Peter Lawrence]I have a desktop app to which I have assigned an icon but when I build it for Linux the output doesn’t seem to include the icon file anywhere. To make the icon appear under Ubuntu I need the image file (to refer to in a .desktop file that is created by a script). I would therefore have thought that the file would be part of the Linux build output but it appears not to be.

Is there any way to access the icon image in a Linux build or do I have to add it as additional resource?[/quote]

Which version of Xojo are you using?

Jason,

I’m using 2018r1.

Peter

AFAIK, Linux files (a program is a file to *ix, but it has execution permission) does not contains any icon image, you must create a .desktop (or menu item or what you want) and then specify the icon file (usually .xpm) to show with it.

For file associations (this is the files used by programs, like .pdf .ods, doc, etc…) then it is configured trough mimetypes.

Jos,

Thanks for replying. Yes. I’m aware of the issues involved in getting a Linux app to display an icon but what I want to do is automate that process. My goal is to hit the Build button and end up with a finished Mac dmg and a Linux deb file etc… I was hoping that the icon embedded in the app via the IDE would somehow be exported in a Linux build but it looks like it isn’t so I may have to add it some other way. I just wanted to avoid having to add an icon in two separate places to have all of the builds complete.

Peter

I think you can’t do (automatically) it from any place that the program itself.

In package, you can’t because you don’t know what user will use the program and include the desktop entry in the pkg files/scripts.

You can install a file from the package (perhaps /usr/share/application/files…) and have it ready to create the desktop file for the user, and then:

pseudocode

[code]If platform = Linux
if not ~/Desktop/program.desktop file exist then
ask user to create it
if yes then
create desktop file
end
end
end

Continue the program[/code]

I’m planning to create it in the IDE-script that performs the builds and include it in the deb package but it looks like I will have to have the icon file stored as a separate png to use with the Linux builds. Since the icon is already embedded in the app via the ide it just would have been nice if the icon were spat out into the build folder when a Linux build happens. It seems that is not possible at the moment.

Every time I build a Linux version, I get three files in the app level of the build folder appicon_128.png, appicon_48.png, and appicon_32.png. Are those not what you are looking for?

Tim,

Yes, those are exactly the files I want but the trouble was that I wasn’t getting them. However, your confirmation that they should be there set me experimenting and prompted me to solve the problem. Thanks very much.

The issue was that I was creating an app icon by dragging a large image into the 1024 well and letting the system worry about the resizing for smaller images. That seemed to work for Mac and Windows but the Linux builds don’t produce icon images unless those three size slots are explicitly filled. Dragging from the 1024 well to the 128 well means that a build now produces a 128x128 png in the output.

Thanks again,
Peter