#include "workspace.hpp" #include #include #include #include #include #include "monitor.hpp" namespace qs::i3::ipc { I3Monitor* I3Workspace::monitor() const { return this->mMonitor; } QVariantMap I3Workspace::lastIpcObject() const { return this->mLastIpcObject; } void I3Workspace::updateFromObject(const QVariantMap& obj) { Qt::beginPropertyUpdateGroup(); this->bId = obj.value("id").value(); this->bName = obj.value("name").value(); this->bNum = obj.value("num").value(); this->bUrgent = obj.value("urgent").value(); this->bFocused = obj.value("focused").value(); Qt::endPropertyUpdateGroup(); auto monitorName = obj.value("output").value(); if (obj != this->mLastIpcObject) { this->mLastIpcObject = obj; emit this->lastIpcObjectChanged(); } if (monitorName != this->mMonitorName) { auto* monitor = this->ipc->findMonitorByName(monitorName); if (monitorName.isEmpty() || monitor == nullptr) { // is null when output is disabled this->mMonitor = nullptr; this->mMonitorName = ""; } else { this->mMonitorName = monitorName; this->mMonitor = monitor; } emit this->monitorChanged(); } } } // namespace qs::i3::ipc