freedesktop

Provides support for some freedesktop.org specifications. More...

Since: Qbs 1.16

Properties

Detailed Description

The freedesktop module contains properties and rules for building and working with applications compliant to freedesktop.org specifications on UNIX platforms. The areas in which this module can be of use include:

This module is available on all platforms but is currently only useful on UNIX platforms.

Example usage

Application {
    ...
    Depends { name: "freedesktop" }

    Group {
        files: [
            ...

            // Declare the desktop and appstream files
            "data/my-app.desktop",
            "data/my-app.metainfo.xml",
        ]
    }

    // Add/change some fields in the desktop file
    freedesktop.desktopKeys: ({
        'Exec': FileInfo.joinPaths(qbs.installPrefix,
                                   product.installDir,
                                   product.targetName) + ' --argument',
        'X-Application-Version': product.version,
    })

    // Define the source directory for application icons
    freedesktop.hicolorRoot: project.sourceDirectory + "/icons/"

    // Declare the application icons
    Group {
        prefix: project.sourceDirectory + "/icons/"
        files: [
            "32x32/apps/my-application.png",
            "32x32@2/apps/my-application.png",
            "32x32/mimetypes/application-format.png",
            ...
            "scalable/apps/my-application.svg",
        ]
        fileTags: "freedesktop.appIcon"
    }
}

Relevant File Tags

TagAuto-tagged File NamesSinceDescription
"freedesktop.desktopfile_source"*.desktop1.16A source file with this tag is a .desktop file or fragment that will be merged into the application's final .desktop file.
"freedesktop.desktopfile"-1.16Attached to the output artifacts of the rule that produces the merged .desktop file.
"freedesktop.appstream"*.metainfo.xml, *.appdata.xml1.16Source files with this tag are AppStream metadata files which will be installed under installPrefix/share/metainfo
"freedesktop.appIcon"-1.16Source files with this tag are application icons compliant with the freedesktop.org Icon Theme Specification. These icons will be installed under installPrefix/share/icons/hicolor in their respective resolution-based directories (e.g., 48x48/apps/, 256x256/apps/), ensuring compatibility with desktop environments following this specification.

Note: After Qbs version 2.5, the hicolorRoot property must be set to define the source directory for these icons. Without setting this property, icons will not be installed.

Property Documentation

appName : string

The display name of the application which will be stored in the .desktop file.

Default: product.name


desktopKeys : var

A dictionary of key-value pairs to add to the application's .desktop file.

The contents of this property will be aggregated with the values from any .desktop file. If this property and any .desktop files contain the same key, this property will take precedence.

Default: Undefined


[since 2.5] hicolorRoot : string

Defines the source directory for application icons, which are installed according to the freedesktop.org Icon Theme Specification. It is used with the freedesktop.appIcon tag to install icons into the share/icons/hicolor directory structure (e.g., 48x48/apps/, 256x256/apps/).

If hicolorRoot is not set, icons will not be installed. Set this property to the path containing your icon files.

Default: Undefined

This property was introduced in Qt 2.5.


© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.