mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
feat: add Quickshell.env
This commit is contained in:
4 files changed
+15
-2
No files matched your search
+1
-1
Submodule docs updated: 79579222a3...8b40a464af.
@@ -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();
|
||||
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user