Skip to content

Chapter 16 of 17

Package the App ​

Describe Notes for launchers and software centers, give it an icon, and build packages that install it like any other desktop app.

A Linux desktop learns about an installed app from two files: a desktop entry, which launchers read for the app's name, icon and command, and AppStream metadata, which software centers read for its description, screenshots and releases. gtkx deploy generates both from gtkx.config.ts and package.json, validates them, and packages them with the build. Deploying covers every target and option.

Application metadata ​

The scaffold's deploy block holds placeholders. Replace it with Notes' own metadata:

gtkx.config.ts
ts
import { defineConfig } from "@gtkx/config";

export default defineConfig({
    libraries: ["GtkSource-5"],
    applicationId: "dev.gtkx.Notes",
    applicationIcon: "data/icons",
    deploy: {
        name: "Notes",
        genericName: "Markdown Notes",
        summary: "Write Markdown notes kept as plain files",
        description: [
            "Notes keeps each note as a Markdown file in a folder, so notes sync with any tool and outlive the app.",
            "It previews Markdown, searches the full text, filters by tag, completes links to other notes, " +
                "and shows changes made by other editors or sync tools as they happen.",
        ],
        categories: ["Utility", "TextEditor"],
        keywords: ["Notes", "Markdown", "Notebook", "Writing"],
        urls: {
            bugtracker: "https://github.com/gtkx-org/gtkx/issues",
            "vcs-browser": "https://github.com/gtkx-org/gtkx",
        },
        screenshots: [
            {
                file: "assets/screenshot.png",
                caption: "Reading a note as rendered Markdown",
                isDefault: true,
            },
            {
                file: "assets/screenshot-editor.png",
                caption: "Writing Markdown with syntax highlighting",
            },
        ],
        releases: [
            {
                version: "1.0.0",
                date: "2026-11-07",
                notes: ["Initial release."],
            },
        ],
        branding: { light: "#f8e45c", dark: "#865e3c" },
        isDbusActivatable: true,
        screenshotBaseUrl:
            "https://raw.githubusercontent.com/gtkx-org/gtkx/main/tutorial",
        targets: ["flatpak", "deb", "rpm", "appimage"],
        depends: { deb: ["libgtksourceview-5-0"] },
    },
});

name, genericName, summary, keywords and categories go into the desktop entry; the categories come from the freedesktop category registry. The description paragraphs, urls, screenshots, releases and the branding colors are for software centers. List each new version in releases, newest first, with its notes.

isDbusActivatable makes the launcher start Notes through the session bus instead of running its command, and GTKX installs the D-Bus service file this needs. targets lists the formats npm run deploy builds. The RPM package already requires GtkSourceView's shared library, which RPM resolves to whichever package ships it. A Debian package can depend only on package names, so depends.deb names the one that ships the library. Without it, the .deb installs on a system that lacks GtkSourceView and Notes fails to start; see Runtime and library requirements.

GTKX takes the version, license and homepage from package.json, and the developer from author, which the scaffold set to your Git user.name. Set the others there:

package.json
json
{
    "version": "1.0.0",
    "license": "MPL-2.0",
    "homepage": "https://gtkx.dev"
}

Notes runs as a single instance: opening it from the launcher while it runs activates the running instance instead of starting a second one. Present the window there, or the launcher appears to do nothing, as The application element explains:

src/app.tsx
tsx
import { AdwApplication, AdwStyleManager } from "@gtkx/jsx/adw";
import { GSimpleAction } from "@gtkx/jsx/gio";
import { quit, SettingsProvider, useSetting } from "@gtkx/react";
import { Window } from "./components/window.js";
import { COLOR_SCHEMES, schema } from "./settings.js";

const NotesApplication = () => {
    const [colorScheme] = useSetting(schema, "color-scheme");

    return (
        <AdwApplication
            styleManager={
                <AdwStyleManager
                    colorScheme={COLOR_SCHEMES[colorScheme].value}
                />
            }
            onActivate={(application) =>
                application.getActiveWindow()?.present()
            }
            actionAccels={[
                { detailedActionName: "win.new-note", accels: ["<Control>n"] },
                { detailedActionName: "win.rename-note", accels: ["F2"] },
                {
                    detailedActionName: "win.preview",
                    accels: ["<Control><Shift>p"],
                },
                {
                    detailedActionName: "win.preferences",
                    accels: ["<Control>comma"],
                },
                {
                    detailedActionName: "win.shortcuts",
                    accels: ["<Control>question"],
                },
                { detailedActionName: "app.quit", accels: ["<Control>q"] },
            ]}
            actions={<GSimpleAction name="quit" onActivate={quit} />}
        >
            <Window />
        </AdwApplication>
    );
};

export const App = () => (
    <SettingsProvider schema={schema}>
        <NotesApplication />
    </SettingsProvider>
);

Notes is translated, so its metadata needs French text too. The next npm run deploy adds the name, summary, description, keywords, screenshot captions and release notes to the template and to po/fr.po. Translate them as in Translate the App, and the packages carry them in both the desktop entry and the AppStream metadata; see Translate package metadata.

Icons and screenshots ​

applicationIcon: "data/icons" points at an icon theme directory. GTKX adds it to the icon theme under npm run dev and installs it with every package, so the desktop finds the icon by the application ID. Replace the scaffold's placeholder with the Notes icon and add its symbolic variant, both from the finished app's data/icons; the GNOME HIG describes both kinds of app icon:

text
data/icons/hicolor/scalable/apps/dev.gtkx.Notes.svg
data/icons/hicolor/symbolic/apps/dev.gtkx.Notes-symbolic.svg

The About dialog shows the icon and the version. virtual:gtkx-config is a module GTKX generates from gtkx.config.ts, and its applicationId names the icon; the version is read from package.json:

src/dialogs/about.tsx
tsx
import * as Gtk from "@gtkx/gi/gtk";
import { useTranslation } from "@gtkx/i18n";
import { AdwAboutDialog } from "@gtkx/jsx/adw";
import { applicationId } from "virtual:gtkx-config";
import packageManifest from "../../package.json" with { type: "json" };

export const About = ({ onClose }: { onClose: () => void }) => {
    const { t } = useTranslation();

    return (
        <AdwAboutDialog
            onClosed={onClose}
            applicationName={t("Notes")}
            applicationIcon={applicationId}
            version={packageManifest.version}
            developerName="GTKX"
            website="https://gtkx.dev"
            issueUrl="https://github.com/gtkx-org/gtkx/issues"
            copyright="© 2026 GTKX Contributors"
            licenseType={Gtk.License.MPL_2_0}
            developers={[t("GTKX Contributors")]}
            comments={t("Markdown notes kept as plain files, built with GTKX.")}
        />
    );
};

screenshots lists the PNGs in assets/. Software centers download each one from its path under screenshotBaseUrl, which defaults to the project's GitHub or GitLab remote and default branch; Notes points at the copies in the GTKX repository. Push the screenshots before you publish a package.

Build the packages ​

Preview the metadata first. The command builds the app, validates the desktop entry and AppStream metadata, writes them to build/<arch>/metadata/ and the package manifests to build/<arch>/targets/, and stops before creating packages:

bash
npm run deploy -- --print-manifests

An excerpt of the generated desktop entry shows where the values went. The command, gtkx-notes, is the name in package.json:

build/x64/metadata/dev.gtkx.Notes.desktop
ini
[Desktop Entry]
Type=Application
Name=Notes
GenericName=Markdown Notes
Comment=Write Markdown notes kept as plain files
Exec=gtkx-notes
Icon=dev.gtkx.Notes
Categories=Utility;TextEditor;
Keywords=Notes;Markdown;Notebook;Writing;
DBusActivatable=true

npm run deploy builds each target in targets into build/out. The Flatpak can't reach the notes folder until Prepare for Flathub grants it, so build the other formats now:

bash
npm run deploy -- --target deb,rpm,appimage

The first run downloads the Node.js runtime that the packages bundle and the packaging tools. The command reports any missing system tool with an installation hint; see Build tools.

Run it ​

Install the package for your distribution, on Fedora with sudo dnf install ./build/out/*.rpm and on Debian or Ubuntu with sudo apt install ./build/out/*.deb. Notes appears in the launcher with its icon. The package is named gtkx-notes, which is also what you remove later. The AppImage runs without installing:

bash
./build/out/Notes-*.AppImage

Open the main menu and choose About Notes.

The Notes window with the About dialog open: the yellow Notes icon with a Markdown heading mark, the name Notes, the developer GTKX, the version 1.0.0, and Details and Report an Issue rows.The Notes window with the About dialog open in the dark style: the yellow Notes icon with a Markdown heading mark, the name Notes, the developer GTKX, the version 1.0.0, and Details and Report an Issue rows.
Captured from src/dialogs/about.tsx above, after choosing About Notes.