forked from quickshell/quickshell
feat: add Quickshell.env
This commit is contained in:
parent
14e1d2d162
commit
b5110b759e
4 changed files with 15 additions and 2 deletions
|
@ -8,8 +8,10 @@
|
|||
#include <qqmlcontext.h>
|
||||
#include <qqmlengine.h>
|
||||
#include <qqmllist.h>
|
||||
#include <qtenvironmentvariables.h>
|
||||
#include <qtmetamacros.h>
|
||||
#include <qtypes.h>
|
||||
#include <qvariant.h>
|
||||
|
||||
#include "qmlscreen.hpp"
|
||||
#include "rootwrapper.hpp"
|
||||
|
@ -74,3 +76,10 @@ void QuickshellGlobal::updateScreens() {
|
|||
|
||||
emit this->screensChanged();
|
||||
}
|
||||
|
||||
QVariant QuickshellGlobal::env(const QString& variable) { // NOLINT
|
||||
auto vstr = variable.toStdString();
|
||||
if (!qEnvironmentVariableIsSet(vstr.data())) return QVariant();
|
||||
|
||||
return qEnvironmentVariable(vstr.data());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue