Ubuntu – How to create a desktop entry for an application located in the user space

desktoplauncherunity

I compiled the latest QGIS sources into ~/bin/qgis. I can start the application from the command line running ~/bin/qgis/bin/qgis. Now I want to have application launcher entry. So I copied the .desktop file of the QGIS distribution installation:

cp /usr/share/applications/qgis.desktop ~/.local/share/applications

Next I renamed it:

cd ~/.local/share/applications
mv qgis.desktop qgis-custom.desktop

Next I edited the paths for TryExec and Exec in the file:

[Desktop Entry]
Type=Application
Name=QGIS Desktop Latest
Version=1.0
GenericName=Geographic Information System
GenericName[ar]=نظام المعلومات الجغرافي
# other translations omitted for brevity
GenericName[uz]=Geografik axborot tizimi
Icon=qgis
TryExec=/home/jjd/bin/qgis/bin/qgis
Exec=/home/jjd/bin/qgis/bin/qgis %F
Terminal=false
StartupNotify=false
Categories=Qt;Education;Science;Geography;
MimeType=application/x-qgis-project;image/tiff;image/jpeg;image/jp2;application/x-raster-aig;application/x-raster-ecw;application/x-raster-mrsid;application/x-mapinfo-mif;application/x-esri-shape;
Keywords=map;globe;postgis;wms;wfs;ogc;osgeo;

(Old .desktop file)

Finally I try to start it from the Unity launcher. Nothing happens ….
One thing that I remember which is different is that I have to export the library path in the shell:

export LD_LIBRARY_PATH=$HOME/bin/qgis/lib

I guess this is missing for the application launcher entry.

Best Answer

Since you told us that QGis needs the path ~/bin/qgis/lib in the library path, change the Desktop file as follows:

 TryExec=$HOME/bin/qgis/bin/qgis
 Exec=env LD_LIBRARY_PATH=$HOME/bin/qgis/lib $HOME/bin/qgis/bin/qgis %F
Related Question