Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to set the Exec and Icon in *.desktop file with help of installer?

How to set the Exec and Icon in *.desktop file with help of installer?

Scheduled Pinned Locked Moved Solved General and Desktop
qt 5.13.1ubuntu 18.04linuxshellbinarycreator
2 Posts 1 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Yash001
    wrote on 15 Oct 2019, 20:44 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      Yash001
      wrote on 17 Oct 2019, 17:59 last edited by
      #2

      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.

      1. inside the @TargetDir@/
      2. 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;");
          }
      }
      
      1 Reply Last reply
      2

      2/2

      17 Oct 2019, 17:59

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved