Omarchy App Templates¶
Read this when starting an app from the omarchy-app skill. Replace <name> with the app's name and <Name> with its display name. These come from Omacut and Monologue (MIT, David Heinemeier Hansson); keep that attribution in the LICENSE of any app that copies them.
<name>.pro¶
Add multimedia, concurrent, or other modules only when the app uses them.
QT += core gui qml quick quickcontrols2 dbus
CONFIG += c++17 release
TARGET = <name>
TEMPLATE = app
HEADERS += \
src/backend.h \
src/theme.h \
src/translator.h
SOURCES += \
src/main.cpp \
src/backend.cpp \
src/theme.cpp \
src/translator.cpp
RESOURCES += src/resources.qrc
bin/build¶
#!/bin/sh
set -eu
ROOT="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
mkdir -p "$ROOT/build"
cd "$ROOT/build"
qmake6 "$ROOT/<name>.pro"
make -j"$(nproc)"
echo "Built $ROOT/build/<name>"
bin/test¶
#!/bin/sh
set -eu
ROOT="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
mkdir -p "$ROOT/build/tests"
cd "$ROOT/build/tests"
qmake6 "$ROOT/tests/<name>_tests.pro"
make -j"$(nproc)"
QT_QPA_PLATFORM=offscreen ./<name>_tests
bin/install¶
#!/bin/sh
set -eu
ROOT="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
"$ROOT/bin/build"
cd "$ROOT/pkgbuild"
exec makepkg -fsi "$@"
src/main.cpp¶
// <name> — one line on what it does.
#include <QGuiApplication>
#include <QIcon>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
#include <QUrl>
#include "backend.h"
#include "theme.h"
#include "translator.h"
int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
app.setApplicationName("<name>");
app.setApplicationVersion("0.1.0");
// Matches the window to <name>.desktop, so the compositor (Wayland app_id)
// and the launcher pick up the installed icon.
app.setDesktopFileName("<name>");
app.setWindowIcon(QIcon::fromTheme("<name>"));
QQuickStyle::setStyle("Material");
// Installed before anything is translated, and every qsTr() binding is
// re-evaluated when the Omarchy language changes.
Translator translator;
app.installTranslator(&translator);
Theme theme;
Backend backend;
QQmlApplicationEngine engine;
QObject::connect(&translator, &Translator::changed, &engine, &QQmlEngine::retranslate);
engine.rootContext()->setContextProperty("translator", &translator);
engine.rootContext()->setContextProperty("theme", &theme);
engine.rootContext()->setContextProperty("backend", &backend);
engine.load(QUrl("qrc:/Main.qml"));
if (engine.rootObjects().isEmpty())
return 1;
return app.exec();
}
src/theme.h and src/theme.cpp¶
Follows the Omarchy accent live, hands QML a readable color to put on it, and tracks Hyprland's window rounding as radius. Tests construct it with a temp directory and a fake hyprctl.
#pragma once
#include <QFileSystemWatcher>
#include <QObject>
#include <QProcess>
#include <QTimer>
class Theme : public QObject {
Q_OBJECT
Q_PROPERTY(QString accent READ accent NOTIFY changed)
Q_PROPERTY(QString accentForeground READ accentForeground NOTIFY changed)
Q_PROPERTY(int radius READ radius NOTIFY changed)
public:
explicit Theme(const QString ¤tDirectory = {}, QObject *parent = nullptr, const QString &hyprctl = {});
~Theme() override;
QString accent() const { return m_accent; }
QString accentForeground() const;
int radius() const { return m_radius; }
static QString readAccent(const QString &path);
signals:
void changed();
private:
void reload();
void refreshRounding();
QString m_directory;
QString m_accent = "#FFD60A";
QFileSystemWatcher m_watcher;
QTimer m_debounce;
QString m_hyprctl;
int m_radius = 0;
QProcess m_roundingProcess;
QTimer m_roundingPoll, m_roundingTimeout;
};
// Theme watching follows Omacut (MIT, David Heinemeier Hansson).
#include "theme.h"
#include <QColor>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QJsonDocument>
#include <QJsonObject>
#include <QRegularExpression>
#include <QStandardPaths>
#include <cmath>
Theme::Theme(const QString &directory, QObject *parent, const QString &hyprctl)
: QObject(parent),
m_directory(directory.isEmpty() ? QDir::homePath() + "/.local/state/omarchy/current" : directory) {
m_debounce.setSingleShot(true);
m_debounce.setInterval(80);
connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, [this] { m_debounce.start(); });
connect(&m_watcher, &QFileSystemWatcher::fileChanged, this, [this] { m_debounce.start(); });
connect(&m_debounce, &QTimer::timeout, this, &Theme::reload);
// Corners follow Hyprland's effective rounding, which themes and personal
// overrides can both set, so ask hyprctl rather than reading its config.
// Without Hyprland the corners stay sharp, like Omarchy's default.
m_hyprctl = !hyprctl.isEmpty() ? hyprctl
: directory.isEmpty() && !qEnvironmentVariableIsEmpty("HYPRLAND_INSTANCE_SIGNATURE")
? QStandardPaths::findExecutable("hyprctl") : QString();
m_roundingTimeout.setSingleShot(true);
m_roundingTimeout.setInterval(500);
connect(&m_roundingTimeout, &QTimer::timeout, &m_roundingProcess, &QProcess::kill);
connect(&m_roundingProcess, &QProcess::errorOccurred, this, [this] { m_roundingTimeout.stop(); });
connect(&m_roundingProcess, &QProcess::finished, this, [this](int code, QProcess::ExitStatus status) {
m_roundingTimeout.stop();
const auto value = QJsonDocument::fromJson(m_roundingProcess.readAllStandardOutput()).object().value("int");
if (code != 0 || status != QProcess::NormalExit || !value.isDouble() || value.toInt(-1) < 0)
return;
if (value.toInt() != m_radius) {
m_radius = value.toInt();
emit changed();
}
});
m_roundingPoll.setInterval(1000);
connect(&m_roundingPoll, &QTimer::timeout, this, &Theme::refreshRounding);
if (!m_hyprctl.isEmpty())
m_roundingPoll.start();
reload();
}
Theme::~Theme() {
if (m_roundingProcess.state() != QProcess::NotRunning) {
m_roundingProcess.kill();
m_roundingProcess.waitForFinished(1000);
}
}
void Theme::refreshRounding() {
if (m_hyprctl.isEmpty() || m_roundingProcess.state() != QProcess::NotRunning)
return;
m_roundingProcess.start(m_hyprctl, {"-j", "getoption", "decoration:rounding"});
m_roundingTimeout.start();
}
QString Theme::readAccent(const QString &path) {
QFile file(path);
if (file.open(QIODevice::ReadOnly)) {
const QRegularExpression expression(R"re(^\s*accent\s*=\s*["'](#[0-9a-fA-F]{6})["'])re",
QRegularExpression::MultilineOption);
const auto match = expression.match(QString::fromUtf8(file.readAll()));
if (match.hasMatch())
return match.captured(1);
}
return "#FFD60A";
}
// Black or white, whichever reads on the accent (WCAG relative luminance).
QString Theme::accentForeground() const {
const QColor c(m_accent);
auto linear = [](double v) { return v <= .04045 ? v / 12.92 : std::pow((v + .055) / 1.055, 2.4); };
const double luminance = .2126 * linear(c.redF()) + .7152 * linear(c.greenF()) + .0722 * linear(c.blueF());
return luminance > .179 ? "black" : "white";
}
void Theme::reload() {
refreshRounding();
const auto paths = m_watcher.files() + m_watcher.directories();
if (!paths.isEmpty())
m_watcher.removePaths(paths);
// A theme switch replaces symlinks and files, so watch the parents too and
// re-arm after every change. Watching the nearest existing ancestor means
// installing Omarchy later works without restarting the app.
QString ancestor = m_directory;
while (!QFileInfo::exists(ancestor) && ancestor != "/")
ancestor = QFileInfo(ancestor).absolutePath();
QStringList candidates{ancestor, QFileInfo(ancestor).absolutePath(), m_directory,
m_directory + "/theme", m_directory + "/theme/colors.toml"};
candidates.removeDuplicates();
for (const auto &path : candidates)
if (QFileInfo::exists(path))
m_watcher.addPath(path);
const auto accent = readAccent(m_directory + "/theme/colors.toml");
if (accent != m_accent) {
m_accent = accent;
emit changed();
}
}
src/translator.h and src/translator.cpp¶
Follows the language picked under Omarchy's Setup > Language, live. QML writes qsTr("Save") and C++ writes tr("Save"); the English text is the key, so an untranslated string simply shows in English. A counted string is qsTr("%n clips", "", count), its forms picked by the language's plural rules. It also sets the default locale and layout direction, so numbers, dates, and right-to-left mirroring follow the language. Tests construct it with a temp language file and catalog directory.
#pragma once
#include <QFileSystemWatcher>
#include <QHash>
#include <QJsonValue>
#include <QLocale>
#include <QTimer>
#include <QTranslator>
// Follows the language picked under Omarchy's Setup > Language. Catalogs are
// flat JSON objects from English source text to translation, one per Omarchy
// language code (i18n/da.json, i18n/pt-BR.json), so QML keeps plain
// qsTr("Save") and C++ keeps tr("Save"). A counted string,
// qsTr("%n clips", "", count), maps to an object of plural forms keyed by
// CLDR category ({"one": "%n klip", "other": "%n klip"}).
class Translator : public QTranslator {
Q_OBJECT
Q_PROPERTY(QString language READ language NOTIFY changed)
public:
explicit Translator(const QString &languageFile = {}, const QString &catalogDirectory = ":/i18n",
QObject *parent = nullptr);
QString language() const { return m_language; }
bool isEmpty() const override { return m_strings.isEmpty(); }
QString translate(const char *context, const char *sourceText, const char *disambiguation = nullptr,
int n = -1) const override;
static QString readLanguage(const QString &path);
static QString pluralCategory(const QString &language, long long count);
static QLocale formatLocale(const QString &language);
signals:
void changed();
private:
void reload();
QString m_languageFile;
QString m_catalogDirectory;
QString m_language;
QHash<QString, QJsonValue> m_strings;
QFileSystemWatcher m_watcher;
QTimer m_debounce;
};
#include "translator.h"
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QGuiApplication>
#include <QJsonDocument>
#include <QJsonObject>
#include <QLocale>
#include <QRegularExpression>
Translator::Translator(const QString &languageFile, const QString &catalogDirectory, QObject *parent)
: QTranslator(parent),
m_languageFile(languageFile.isEmpty() ? QDir::homePath() + "/.config/omarchy/language" : languageFile),
m_catalogDirectory(catalogDirectory) {
m_debounce.setSingleShot(true);
m_debounce.setInterval(80);
connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, [this] { m_debounce.start(); });
connect(&m_watcher, &QFileSystemWatcher::fileChanged, this, [this] { m_debounce.start(); });
connect(&m_debounce, &QTimer::timeout, this, &Translator::reload);
reload();
}
// One registry code on the first line; anything else, or no file, is English.
QString Translator::readLanguage(const QString &path) {
QFile file(path);
if (!file.open(QIODevice::ReadOnly))
return "en";
const QString code = QString::fromUtf8(file.readLine()).trimmed();
static const QRegularExpression valid("^[a-z]{2,3}(-[A-Za-z]{2})?$");
return valid.match(code).hasMatch() ? code : "en";
}
// CLDR cardinal plural categories for whole counts, for Omarchy's languages
// (the same rules as Omarchy's shell/Commons/Plural.js).
QString Translator::pluralCategory(const QString &language, long long count) {
const long long n = count < 0 ? -count : count, n10 = n % 10, n100 = n % 100;
const bool millions = n != 0 && n % 1000000 == 0;
const bool teens = n100 >= 12 && n100 <= 14;
const QString code = language;
auto in = [&](std::initializer_list<const char *> codes) {
for (const char *c : codes) if (code == QLatin1String(c)) return true;
return false;
};
if (in({"ja", "ko", "zh-CN", "zh-TW", "th", "vi", "id", "ms"})) return "other";
if (in({"hi", "bn", "fa", "si"})) return n <= 1 ? "one" : "other";
if (in({"fr", "pt-BR"})) return n <= 1 ? "one" : millions ? "many" : "other";
if (in({"ca", "es-MX", "it", "pt"})) return n == 1 ? "one" : millions ? "many" : "other";
if (code == "fil") return (n10 == 4 || n10 == 6 || n10 == 9) ? "other" : "one";
if (code == "is") return n10 == 1 && n100 != 11 ? "one" : "other";
if (in({"cs", "sk"})) return n == 1 ? "one" : n >= 2 && n <= 4 ? "few" : "other";
if (code == "pl") return n == 1 ? "one" : n10 >= 2 && n10 <= 4 && !teens ? "few" : "many";
if (in({"ru", "uk"})) return n10 == 1 && n100 != 11 ? "one" : n10 >= 2 && n10 <= 4 && !teens ? "few" : "many";
if (in({"hr", "sr"})) return n10 == 1 && n100 != 11 ? "one" : n10 >= 2 && n10 <= 4 && !teens ? "few" : "other";
if (code == "sl") return n100 == 1 ? "one" : n100 == 2 ? "two" : n100 >= 3 && n100 <= 4 ? "few" : "other";
if (code == "lt") return n100 >= 11 && n100 <= 19 ? "other" : n10 == 1 ? "one" : n10 >= 2 ? "few" : "other";
if (code == "lv") return n10 == 0 || (n100 >= 11 && n100 <= 19) ? "zero" : n10 == 1 ? "one" : "other";
if (code == "ro") return n == 1 ? "one" : n == 0 || (n100 >= 1 && n100 <= 19) ? "few" : "other";
if (code == "ar") {
if (n <= 2) return n == 0 ? "zero" : n == 1 ? "one" : "two";
return n100 >= 3 && n100 <= 10 ? "few" : n100 >= 11 ? "many" : "other";
}
if (code == "he") return n == 1 ? "one" : n == 2 ? "two" : "other";
if (code == "ga") return n == 1 ? "one" : n == 2 ? "two" : n >= 3 && n <= 6 ? "few" : n >= 7 && n <= 10 ? "many" : "other";
return n == 1 ? "one" : "other";
}
// The locale Omarchy formats this language with, from its registry, so the
// app's numbers and dates match the desktop's (Arabic there uses Western
// digits); without Omarchy, Qt's own locale for the code.
QLocale Translator::formatLocale(const QString &language) {
QFile registry(qEnvironmentVariable("OMARCHY_PATH") + "/default/i18n/locales.json");
if (registry.open(QIODevice::ReadOnly)) {
const QString name = QJsonDocument::fromJson(registry.readAll()).object()
.value(language).toObject().value("formatLocale").toString();
if (!name.isEmpty())
return QLocale(name);
}
return QLocale(language);
}
QString Translator::translate(const char *, const char *sourceText, const char *, int n) const {
// A null string tells Qt there is no translation, so it shows the English.
const QJsonValue value = m_strings.value(QString::fromUtf8(sourceText));
if (value.isString())
return value.toString();
if (value.isObject()) {
const QJsonObject forms = value.toObject();
const QString form = forms.value(n < 0 ? "other" : pluralCategory(m_language, n)).toString();
return form.isEmpty() ? forms.value("other").toString() : form;
}
return {};
}
void Translator::reload() {
const auto paths = m_watcher.files() + m_watcher.directories();
if (!paths.isEmpty())
m_watcher.removePaths(paths);
// omarchy-language replaces the file, which drops it from the watch, and a
// first pick creates it; watch its directory too and re-arm every time.
const QString directory = QFileInfo(m_languageFile).absolutePath();
if (QFileInfo::exists(directory))
m_watcher.addPath(directory);
if (QFileInfo::exists(m_languageFile))
m_watcher.addPath(m_languageFile);
// Catalogs are compiled in, so only a different language needs a reload.
const QString language = readLanguage(m_languageFile);
if (language == m_language)
return;
// English first (it carries the plural forms of counted strings), then
// the base language and the regional file over it (pt, then pt-BR), so a
// missing string falls back toward English one step at a time.
QHash<QString, QJsonValue> strings;
QStringList codes{"en", language.section('-', 0, 0), language};
codes.removeDuplicates();
for (const auto &code : codes) {
QFile catalog(m_catalogDirectory + "/" + code + ".json");
if (!catalog.open(QIODevice::ReadOnly))
continue;
const QJsonObject object = QJsonDocument::fromJson(catalog.readAll()).object();
for (auto it = object.begin(); it != object.end(); ++it)
if ((it.value().isString() && !it.value().toString().isEmpty()) || it.value().isObject())
strings.insert(it.key(), it.value());
}
m_language = language;
m_strings = strings;
// Dates, numbers, and Qt's own day and month names follow the language
// too, and right-to-left languages mirror the window.
const QLocale locale = formatLocale(language);
QLocale::setDefault(locale);
QGuiApplication::setLayoutDirection(locale.textDirection());
emit changed();
}
src/backend.h and src/backend.cpp¶
The C++ side of the app's one job, exposed to QML as backend. Start with the single action the Space shortcut runs, then grow it.
#pragma once
#include <QObject>
class Backend : public QObject {
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
explicit Backend(QObject *parent = nullptr) : QObject(parent) {}
int count() const { return m_count; }
Q_INVOKABLE void primaryAction();
signals:
void countChanged();
private:
int m_count = 0;
};
src/Main.qml¶
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Layouts
ApplicationWindow {
id: win
width: 960
height: 680
minimumWidth: 640
minimumHeight: 460
visible: true
title: "<Name>"
color: "#0e0e10"
Material.theme: Material.Dark
Material.accent: theme.accent
Material.roundedScale: theme.radius
property bool helpVisible: false
Shortcut { sequence: "?"; context: Qt.ApplicationShortcut; onActivated: win.helpVisible = !win.helpVisible }
Shortcut { sequence: "Q"; context: Qt.ApplicationShortcut; onActivated: Qt.quit() }
Shortcut { sequence: "Space"; context: Qt.ApplicationShortcut; onActivated: backend.primaryAction() }
// Right-to-left languages mirror the window; the Translator sets the
// application's layout direction.
Item {
anchors.fill: parent
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
// The app's one job goes here.
}
}
src/resources.qrc¶
<RCC>
<qresource prefix="/">
<file alias="Main.qml">Main.qml</file>
<file alias="i18n/en.json">i18n/en.json</file>
<file alias="i18n/da.json">i18n/da.json</file>
</qresource>
</RCC>
List one <file> line per catalog in src/i18n/. English needs a file only for the plural forms of counted strings.
src/i18n/<code>.json¶
One flat JSON object per language, keyed by the English exactly as it appears in qsTr(), with Omarchy's language codes as file names ($OMARCHY_PATH/default/i18n/locales.json lists all 50: da, de, pt-BR, zh-CN, ...). Keep %1 placeholders, which .arg() fills, so a translation can reorder them. A counted string's value is an object of plural forms keyed by CLDR category: English gives one and other in en.json, and each language the categories it uses (Russian one, few, many, other; Arabic six; Japanese only other; Translator::pluralCategory lists them).
tests/<name>_tests.pro¶
QT += core gui quick quickcontrols2 testlib dbus
CONFIG += c++17 testcase
TARGET = <name>_tests
TEMPLATE = app
INCLUDEPATH += ../src
HEADERS += ../src/backend.h ../src/theme.h ../src/translator.h
SOURCES += <name>_tests.cpp ../src/backend.cpp ../src/theme.cpp ../src/translator.cpp
tests/<name>_tests.cpp¶
One private slots: case per behavior. These cover the backend, the theme fallback, accent and rounding, and the translator's language file and fallbacks, so a broken theme or catalog shows up in bin/test.
#include <QDir>
#include <QFile>
#include <QTemporaryDir>
#include <QtTest>
#include "backend.h"
#include "theme.h"
#include "translator.h"
class <Name>Tests : public QObject {
Q_OBJECT
private slots:
void primaryActionCounts()
{
Backend backend;
backend.primaryAction();
QCOMPARE(backend.count(), 1);
}
void themeFallsBack()
{
QTemporaryDir dir;
Theme theme(dir.path());
QCOMPARE(theme.accent(), QString("#FFD60A"));
QCOMPARE(theme.accentForeground(), QString("black"));
}
void themeReadsAccent()
{
QTemporaryDir dir;
QDir(dir.path()).mkpath("theme");
QFile colors(dir.path() + "/theme/colors.toml");
QVERIFY(colors.open(QIODevice::WriteOnly));
colors.write("accent = \"#112233\"\n");
colors.close();
Theme theme(dir.path());
QCOMPARE(theme.accent(), QString("#112233"));
QCOMPARE(theme.accentForeground(), QString("white"));
}
void themeFollowsHyprlandRounding()
{
QTemporaryDir dir;
const QString response = dir.filePath("response.json"), command = dir.filePath("hyprctl");
auto write = [](const QString &path, const QByteArray &data) {
QFile file(path);
return file.open(QIODevice::WriteOnly) && file.write(data) == data.size();
};
QVERIFY(write(command, "#!/bin/sh\ncat '" + response.toUtf8() + "'\n"));
QVERIFY(QFile::setPermissions(command, QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner));
QVERIFY(write(response, "{\"int\":0}"));
Theme theme(dir.path(), nullptr, command);
QCOMPARE(theme.radius(), 0);
QVERIFY(write(response, "{\"int\":6}"));
QTRY_COMPARE(theme.radius(), 6);
}
void translatorFallsBackToEnglish()
{
QTemporaryDir dir;
Translator translator(dir.path() + "/language", dir.path());
QCOMPARE(translator.language(), QString("en"));
QVERIFY(translator.translate("Main", "Save").isNull());
}
void translatorFollowsTheLanguageFile()
{
QTemporaryDir dir;
write(dir.path() + "/language", "pt-BR\n");
write(dir.path() + "/pt.json", R"({"Save": "Guardar", "Open": "Abrir"})");
write(dir.path() + "/pt-BR.json", R"({"Save": "Salvar"})");
Translator translator(dir.path() + "/language", dir.path());
QCOMPARE(translator.language(), QString("pt-BR"));
QCOMPARE(translator.translate("Main", "Save"), QString("Salvar"));
QCOMPARE(translator.translate("Main", "Open"), QString("Abrir"));
QVERIFY(translator.translate("Main", "Quit").isNull());
}
void translatorPicksPluralForms()
{
QTemporaryDir dir;
write(dir.path() + "/language", "ru\n");
write(dir.path() + "/en.json", R"({"%n clips": {"one": "%n clip", "other": "%n clips"}})");
write(dir.path() + "/ru.json", R"({"%n clips": {"one": "%n клип", "few": "%n клипа", "many": "%n клипов", "other": "%n клипа"}})");
Translator translator(dir.path() + "/language", dir.path());
QCOMPARE(translator.translate("Main", "%n clips", nullptr, 21), QString("%n клип"));
QCOMPARE(translator.translate("Main", "%n clips", nullptr, 22), QString("%n клипа"));
QCOMPARE(translator.translate("Main", "%n clips", nullptr, 25), QString("%n клипов"));
QCOMPARE(Translator::pluralCategory("ar", 11), QString("many"));
QCOMPARE(Translator::pluralCategory("ja", 1), QString("other"));
}
private:
static void write(const QString &path, const QByteArray &contents)
{
QFile file(path);
QVERIFY(file.open(QIODevice::WriteOnly));
file.write(contents);
}
};
QTEST_MAIN(<Name>Tests)
#include "<name>_tests.moc"
pkgbuild/PKGBUILD¶
pkgname=<name>
pkgver=0.1.0
pkgrel=1
pkgdesc='One line on what it does'
arch=('x86_64' 'aarch64')
license=('MIT')
depends=('qt6-base' 'qt6-declarative' 'qt6-wayland' 'xdg-desktop-portal')
makedepends=('gcc' 'make')
source=()
sha256sums=()
build() {
cd "$startdir/.."
./bin/build
}
package() {
cd "$startdir/.."
install -Dm755 build/<name> "$pkgdir/usr/bin/<name>"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
install -Dm644 "$startdir/<name>.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps/<name>.svg"
install -Dm644 "$startdir/<name>.desktop" "$pkgdir/usr/share/applications/<name>.desktop"
}
Add ffmpeg, qt6-multimedia, or qt6-svg to depends when the app uses them. Omarchy installs all three, but the package should still say what it needs. package() also installs LICENSE from the project root (the MIT text with the user's name and year) and the icon below, so both must exist.
pkgbuild/<name>.desktop¶
[Desktop Entry]
Type=Application
Name=<Name>
Comment=One line on what it does
Exec=<name> %f
Icon=<name>
Terminal=false
Categories=Utility;
StartupWMClass=<name>
Add Name[<code>]= and Comment[<code>]= lines for each language the app ships, so the launcher shows the translated name (Name[da]=…, Comment[pt_BR]=…; desktop files spell regions with an underscore).
pkgbuild/<name>.svg¶
The icon is a single square SVG. Start from a rounded square in the accent and draw the app's mark on it.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
<rect width="64" height="64" rx="14" fill="#FFD60A"/>
</svg>