forked from quickshell/quickshell
feat: add Quickshell.env
This commit is contained in:
parent
14e1d2d162
commit
b5110b759e
2
docs
2
docs
|
@ -1 +1 @@
|
|||
Subproject commit 79579222a31dc1f6355e0c3020917c29165f766c
|
||||
Subproject commit 8b40a464af5c1338d842e61f8ec517d142454cbc
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <qqmllist.h>
|
||||
#include <qtmetamacros.h>
|
||||
#include <qtypes.h>
|
||||
#include <qvariant.h>
|
||||
|
||||
#include "qmlscreen.hpp"
|
||||
|
||||
|
@ -50,6 +51,9 @@ public:
|
|||
/// [Reloadable]: ../reloadable
|
||||
Q_INVOKABLE void reload(bool hard);
|
||||
|
||||
/// Returns the string value of an environment variable or null if it is not set.
|
||||
Q_INVOKABLE QVariant env(const QString& variable);
|
||||
|
||||
signals:
|
||||
void screensChanged();
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include <qtclasshelpermacros.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
#include "datastream.hpp"
|
||||
#include "../core/reload.hpp"
|
||||
#include "datastream.hpp"
|
||||
|
||||
///! Unix socket listener.
|
||||
class Socket: public DataStream {
|
||||
|
|
Loading…
Reference in a new issue