How to include environment Variable in launcher for icon
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.
Related videos on Youtube
Jonas
Updated on September 18, 2022Comments
-
Jonas over 1 year
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 iconan 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?
-
Jonas almost 10 yearsi don't have root access, so I can't use
/usr/share....
and I want to sync the starter between different computers, which is why I need a more generic soluteion with$HOME
or something like this... -
TuKsn almost 10 years@Jonas i've updated my answer.
-
Jonas almost 10 yearsthanks! Yes that might work...but isn't there any easier solution? Why does gnome shell not evaluate environment variables?
-
TuKsn almost 10 yearsSorry i dont't know.