Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    qt 5.13.1 ubuntu 18.04 linux shell binarycreator
    1
    2
    1406
    Loading More Posts
    • 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
      Yash001 last edited by

      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 Reply Quote 0
      • Y
        Yash001 last edited by

        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 Reply Quote 2
        • Y
          Yash001 last edited by

          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 Reply Quote 2
          • First post
            Last post