diff options
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/src/Caelestia/Internal/hyprextras.cpp | 30 | ||||
| -rw-r--r-- | plugin/src/Caelestia/Internal/hyprextras.hpp | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/plugin/src/Caelestia/Internal/hyprextras.cpp b/plugin/src/Caelestia/Internal/hyprextras.cpp index 23495b2..0504d70 100644 --- a/plugin/src/Caelestia/Internal/hyprextras.cpp +++ b/plugin/src/Caelestia/Internal/hyprextras.cpp @@ -51,10 +51,40 @@ HyprDevices* HyprExtras::devices() const { } void HyprExtras::message(const QString& message) { + if (message.isEmpty()) { + return; + } + makeRequest(message, [](bool, const QByteArray&) { }); } +void HyprExtras::batchMessage(const QStringList& messages) { + if (messages.isEmpty()) { + return; + } + + makeRequest("[[BATCH]]" + messages.join(";"), [](bool, const QByteArray&) { + }); +} + +void HyprExtras::applyOptions(const QVariantHash& options) { + if (options.isEmpty()) { + return; + } + + QString request = "[[BATCH]]"; + for (auto it = options.constBegin(); it != options.constEnd(); ++it) { + request += QString("keyword %1 %2;").arg(it.key(), it.value().toString()); + } + + makeRequest(request, [this](bool success, const QByteArray&) { + if (success) { + refreshOptions(); + } + }); +} + void HyprExtras::refreshOptions() { if (!m_optionsRefresh.isNull()) { m_optionsRefresh->close(); diff --git a/plugin/src/Caelestia/Internal/hyprextras.hpp b/plugin/src/Caelestia/Internal/hyprextras.hpp index ca1b2f2..f1863ed 100644 --- a/plugin/src/Caelestia/Internal/hyprextras.hpp +++ b/plugin/src/Caelestia/Internal/hyprextras.hpp @@ -21,6 +21,8 @@ public: [[nodiscard]] HyprDevices* devices() const; Q_INVOKABLE void message(const QString& message); + Q_INVOKABLE void batchMessage(const QStringList& messages); + Q_INVOKABLE void applyOptions(const QVariantHash& options); Q_INVOKABLE void refreshOptions(); Q_INVOKABLE void refreshDevices(); |