Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 9406  / 3 Years ago, mon, september 20, 2021, 1:50:59

This is an extension to the question how to include an environment variable in the launcher? . This question explains how to use the environment variable for the Exec part of the .desktop file but not the icon



an example:



[Desktop Entry]
Name=My Application name
Comment=a comment
Exec=sh -c '$HOME/.bin/path/to/bin'
Icon= $HOME/.bin/path/to/icon


This Launcher will work but the icon is not shown. I can't use something like



Icon=sh -c '$HOME/.bin/path/to/icon'


for the icon... what to do instead?


More From » gnome

 Answers
4

Honestly the best way to use an icon in a launcher is to make sure the icon file is in the icon search path. Referring to the freedesktop.org icon directory scheme and base directory definitions, icons should be searched for in at least the following directories on Ubuntu systems:




  • $HOME/.icons

  • $HOME/.local/share/icons

  • /usr/local/share/icons

  • /usr/share/icons

  • /usr/share/pixmaps



So if you want to use your own icon and do not have root privileges, install the icon into either $HOME/.icons or $HOME/.local/share/icons. Using the latter, you can even mimic the system icon directory structure with multi-resolution icons using the same base name under directories like $HOME/.local/share/icons/hicolor/48x48/apps and $HOME/.local/share/icons/hicolor/256x256/apps.



If the icon is in one of these searchable directories, you can simply use Icon=myapp in the .desktop file.


[#24834] Tuesday, September 21, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aclavadoug

Total Points: 317
Total Questions: 103
Total Answers: 125

Location: Bangladesh
Member since Wed, Mar 24, 2021
3 Years ago
;