How to set the Exec and Icon in *.desktop file with help of installer?
Solved
General and Desktop
-
I am using Ubuntu 18.04 and Qt 5.13.1.
I created package of my application and *.desktop file.
*.desktop file I am setting Exec and Icon manually.Is it any way to set the Exec and Icon value with help of installer? similar like Qt does in
DigiaQt-qtcreator-Community.desktop
?Here my *.desktop file
[Desktop Entry] Type=Application Exec=***APP_PACKAGE_PATH***/SquidStat.sh Name=Squidstat GenericName=The IDE of choice for Squidstat handle. Icon=***APP_PACKAGE_PATH***/Squidstat.png StartupWMClass=qtcreator Terminal=false Categories=IDE;Qt;
In general, How can I set the APP_PACKAGE_PATH inside the installer?
-
It may save other time.
Call below function from installer.qs for creating *.desktop file
you can call prototype by
this. desktopFileCreateOnLinux()
from any function in side component script.Below script will create the two place *.desktop file.
- inside the
@TargetDir@/
- inside
~/.local/share/applications/
(it will help while searching from Show application).
prototype definition:
Component.prototype.desktopFileCreateOnLinux = function() { if ((systemInfo.kernelType === "linux") ||(systemInfo.kernelType === "Linux")) { var dir = installer.value("TargetDir"); component.addOperation("CreateDesktopEntry", "Squidstat.desktop", "Type=Application\nName=Squidstat\nExec=\'"+dir+"/SquidStat.sh\'\nGenericName=The IDE of choice for Squidstat handle.\nIcon="+dir+"/Squidstat.png\nTerminal=false\nCategories=IDE;Qt;"); component.addOperation("CreateDesktopEntry", "@TargetDir@/Squidstat.desktop", "Type=Application\nName=Squidstat\nExec=\'"+dir+"/SquidStat.sh\'\nGenericName=The IDE of choice for Squidstat handle.\nIcon="+dir+"/Squidstat.png\nTerminal=false\nCategories=IDE;Qt;"); } }
- inside the