Ubuntu 18.04LTS Create Desktop Icon For New Application

Background

Want to create an application icon (shortcut) for Ubuntu 18.04LTS, and could not easily find a method for doing this really simple operation, so have created this blog so I don’t have to search around again in the future

On my development virtual machine I am using Ubuntu 18.04LTS and the Eclipse IDE for PHP Developers.  Recently was forced to upgrade my version of Eclipse IDE, could not use the bundled Snap installation package as it was too old, so had to download from Eclipse their website.  Down loading the installation and launch I installed Eclipse to /opt/ directory, however wanted an icon to launch from desktop.

Creating an application launch for Ubuntu 18.04LTS

For reference Ubuntu 18.04LTS Gnome desktop follows the Freedesktop spec found here.  For example this worked for my purposes:

[Desktop Entry]
Version=1.0
Name=Eclipse IDE for PHP Developers
Comment=Eclipse Version 2020-03 (4.15.0) IDE for PHP Developers
Exec=/opt/php-2020-03/eclipse/eclipse
Path=/opt/php-2020-03/eclipse/
Icon=/opt/php-2020-03/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=Utility;Development;

Please Note:

  • Version should be 1.0, as it refers to the .desktop file version and not the installed program version.
  • Name is the name that will be shown within the desktop menu structure
  • Exec is the full path to the excutable itself
  • Path is the directory to be set as the current directory when the executable it to be run.  Normally this does not need to be added, however have added it for completeness.
  • Icon the path to the icon file associated with the executable, noted that .svg files and xpm work.
  • Mimetype not shown in the above example, however this specifieds the kind of files the application is allowed to open.
  • StartupWMClass maybe required for some java program to solve various issues with allocated memory etc.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.