A .desktop launcher file can likely just be (sort of) simplified down to something like the following
Comment=Open Google Maps
GenericName=Open Google Maps
- You need both
[Desktop Entry] and
Type=Application to say it is a application launcher.
Name is its name
Exec is the command it runs
GenericName desribe it (not always needed)
Icon is the path to a icon or a icon from the theme(s) you are using in
/usr/share/icons (not always needed, but the default icon if often annoying)
Categories - specifies the category it is in (useful for menus - not always needed)
Keywords are words that can be used to find it when you search for it (not always needed).
NoDisplay set to false make sure it is displayed (not always needed).
Terminal whether to run in terminal or not`.
For changing the icon, you just need to change the
Icon line to specify a different icon - e.g. to use a text editor icon from
or you can specify a path to a icon file
This is also possible by right-clicking on the launcher in most file mangers and selecting properties:
Then clicking on the icon and selecting a new one - note if it is in
/usr/share/applications you probably need permissions to edit the file.
I can't exactly remember why (probably made it for something), but I appear to have the following script that can create .desktop launchers - here it is:
if [ "$1" = "--help" ]; then
echo -e "\e[1mUsage:\e[0m\n create-launcher [OPTIONS...] [FILENAME] - create a launcher\n\e[1mHelp Options:\e[0m\n --help Show help options\n\e[1mApplication Options:\e[0m\n -n NAME Sets the name of the New launcher\n -c COMMAND Sets the command the launcher will be used to Launch\n -t COMMENT Sets the comment used to describe the launcher\n -i ICON Specifies an icon filename or stock icon to display.\n\n\e[1mNote\e[0m - ideally all of the above options should be used, mainly the Name option as it used to create the name of the launcher, and the command option as that is required for the launcher to work."
while getopts n:c:t:i: option
FILE=$HOME/.local/share/applications/$(echo $NAME | sed 's/ /-/g').desktop
if [ $FILE = $NOFILE ]; then
echo -e "ERROR: Please enter atleast the Name for the launcher - for more info run\n create-launcher --help"
echo "New launcher created at $FILE"
echo -e "[Desktop Entry]\nType=Application" > $FILE
echo Name=$NAME >> $FILE
echo Exec=$COMMAND >> $FILE
echo Comment=$COMMENT >> $FILE
echo Icon=$ICON >> $FILE
echo -e "Hidden=false\nNoDisplay=false\nTerminal=false\n#X-GNOME-Autostart-enabled=true" >> $FILE
chmod +x $FILE
This can be saved to a executable file, and creates a simple launcher like the following (except the fields are filled by specifying the scripts options - see
./create-launcher --help) in
~/.local/share/applications (which should mean the launcher shows in menus etc)
The last line is not important unless it is used elsewhere to start a program on login.