From 395a1301a83e98dafc325289630ccacda5d69607 Mon Sep 17 00:00:00 2001 From: kossLAN Date: Fri, 6 Feb 2026 03:02:58 -0500 Subject: [PATCH] core: add hasThemeIcon mapping --- changelog/next.md | 1 + src/core/qmlglobal.cpp | 2 ++ src/core/qmlglobal.hpp | 2 ++ 3 files changed, 5 insertions(+) diff --git a/changelog/next.md b/changelog/next.md index bccd7808..583a2f40 100644 --- a/changelog/next.md +++ b/changelog/next.md @@ -24,6 +24,7 @@ set shell id. - Added support for grabbing focus from popup windows. - Added support for IPC signal listeners. - Added Quickshell version checking and version gated preprocessing. +- Added a way to detect if an icon is from the system icon theme or not. ## Other Changes diff --git a/src/core/qmlglobal.cpp b/src/core/qmlglobal.cpp index 03fb8188..6c266093 100644 --- a/src/core/qmlglobal.cpp +++ b/src/core/qmlglobal.cpp @@ -314,6 +314,8 @@ QString QuickshellGlobal::iconPath(const QString& icon, const QString& fallback) return IconImageProvider::requestString(icon, "", fallback); } +bool QuickshellGlobal::hasThemeIcon(const QString& icon) { return QIcon::hasThemeIcon(icon); } + bool QuickshellGlobal::hasVersion(qint32 major, qint32 minor, const QStringList& features) { return qs::scan::env::PreprocEnv::hasVersion(major, minor, features); } diff --git a/src/core/qmlglobal.hpp b/src/core/qmlglobal.hpp index 3ca70be4..94b42f67 100644 --- a/src/core/qmlglobal.hpp +++ b/src/core/qmlglobal.hpp @@ -202,6 +202,8 @@ class QuickshellGlobal: public QObject { /// Setting the `fallback` parameter of `iconPath` will attempt to load the fallback /// icon if the requested one could not be loaded. Q_INVOKABLE static QString iconPath(const QString& icon, const QString& fallback); + /// Check if specified icon has an available icon in your icon theme + Q_INVOKABLE static bool hasThemeIcon(const QString& icon); /// Equivalent to `${Quickshell.configDir}/${path}` Q_INVOKABLE [[nodiscard]] QString shellPath(const QString& path) const; /// > [!WARNING] Deprecated: Renamed to @@shellPath() for clarity.