summaryrefslogtreecommitdiff
path: root/plugin/src/Caelestia/Internal/hyprextras.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/src/Caelestia/Internal/hyprextras.cpp')
-rw-r--r--plugin/src/Caelestia/Internal/hyprextras.cpp30
1 files changed, 30 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();