summaryrefslogtreecommitdiff
path: root/plugin/src/Caelestia/Internal/hyprextras.cpp
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-25 00:40:55 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-25 00:40:55 +1000
commitf0ca30692ddb70fc32e8545c07e02ed5539dc92a (patch)
treee3771a3beb5cabc05513a3d587041b4b71fc95e4 /plugin/src/Caelestia/Internal/hyprextras.cpp
parentplugin: add hypr extras (#690) (diff)
downloadcaelestia-shell-f0ca30692ddb70fc32e8545c07e02ed5539dc92a.tar.gz
caelestia-shell-f0ca30692ddb70fc32e8545c07e02ed5539dc92a.tar.bz2
caelestia-shell-f0ca30692ddb70fc32e8545c07e02ed5539dc92a.zip
plugin/hypr: add more helpers
Also refresh options on dynamic option application
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();