core/global: add Quickshell.iconPath

Replaces "image://icon/" in user facing code.
This commit is contained in:
outfoxxed 2024-07-11 00:09:34 -07:00
parent 24f54f579f
commit bb33c9a0c4
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 10 additions and 0 deletions

View file

@ -19,6 +19,7 @@
#include <unistd.h>
#include "generation.hpp"
#include "iconimageprovider.hpp"
#include "qmlscreen.hpp"
#include "rootwrapper.hpp"
@ -188,6 +189,10 @@ QVariant QuickshellGlobal::env(const QString& variable) { // NOLINT
return qEnvironmentVariable(vstr.data());
}
QString QuickshellGlobal::iconPath(const QString& icon) {
return IconImageProvider::requestString(icon, "");
}
QuickshellGlobal* QuickshellGlobal::create(QQmlEngine* engine, QJSEngine* /*unused*/) {
auto* qsg = new QuickshellGlobal();
auto* generation = EngineGeneration::findEngineGeneration(engine);