Add icon to local application.desktop file?

Hi
I have already successfully compiled lazarus from source and added it to my Application Launcher.
It was necessary to compile from source because I am on a Pinebook Pro with an ARM64/aarch64 processor.
I have a working ~/.local/share/applications/lazarus.desktop file

How can I get a nicer icon?

I tried editing the Icon entry like this
Icon=~/.icons/lazarus-icon.png

but it doesn’t show.

if I use this entry
Icon=text-editor

then I get an icon but, but obviously not a nice one.

What am I doing wrong?

thanks, DNJ

The local path (~) is probably not expanded.
Try replacing the tilde by the full path that you want to use i.e. /home/yourusername/.icons/lazarus-icon.png

3 Likes

Thank you for replying.
I swapped out the ~ for /home/philip but it made no difference.
The other thing is that the exec= line also has a ~ in it and lazarus does execute when I click on it.
There must be some other reason.
The png file is 256x256 pixels; is that too big?

I scaled it down to 64x64 and it still doesn’t display.

  1. copy the icon to the Unix Shared Resources directory:

    sudo cp ~/.icons/lazarus-icon.png /usr/share/pixmaps/
    
  2. Then use:

    Icon=lazarus-icon
    

:innocent:

Thank you. This helped.

I looked in /usr/share/pixmaps

I found that there were two other images in there already both 48x48 in xpm format.

I converted my icon and saved it to /usr/share/pixmaps/lazarus-icon.xpm and now it works.

1 Like

I’ve marked the below answer as the solution to your question as it is by far the best answer you’ll get:

However, if you disagree with my choice, please feel free to take any other answer as the solution to your question or even remove the solution altogether: You are in control! (I just want to avoid even more subjective opinions being posted and confusing you even more)

:innocent:
P.S. In the future, please mark a solution like this:
Solution
so that the next person that has the exact same problem you just had will benefit from your post as well as your question will now be in the “solved” status.

See this answer, which mentions:

  1. $HOME/.icons (for backwards compatibility)
  2. $XDG_DATA_DIRS/icons , which typically just means ~/.local/share/icons .
  3. /usr/share/pixmap

See also:
https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.