mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-06 19:14:57 +11:00
sway: add urgent and focused dispatchers to workspaces flake: add sway toggle WIP sway: add monitor status sway: handle multiple ipc events in one line sway: reuse socket connection for dispatches & better command type handling WIP sway: add associated monitor to a workspace i3/sway: update to allow for i3 compatibility i3/sway: manage setting the focused monitors i3/sway: fix multi monitor crash i3/sway: fix linting errors i3/sway: update nix package flag naming to i3 i3/sway: add documentation, fix module.md and impl monitorFor i3/sway: handle more workspace ipc events i3/sway: fix review i3/sway: fix crash due to newline breaking up an IPC message i3/sway: handle broken messages by forwarding to the next magic sequence i3/sway: break loop when buffer is empty i3/sway: fix monitor focus & focused monitor signal not being emitted i3/sway: use datastreams instead of qbytearrays for socket reading i3/sway: fix lint issues i3/sway: drop second socket connection, remove dispatch return value, recreate IPC connection on fatal error i3/sway: handle run_command responses i3/sway: remove reconnection on unknown event i3/sway: fix formatting, lint & avoid writing to socket if connection is not open
73 lines
1.9 KiB
C++
73 lines
1.9 KiB
C++
#include "workspace.hpp"
|
|
|
|
#include <qcontainerfwd.h>
|
|
#include <qstring.h>
|
|
#include <qtmetamacros.h>
|
|
#include <qtypes.h>
|
|
|
|
#include "monitor.hpp"
|
|
|
|
namespace qs::i3::ipc {
|
|
|
|
qint32 I3Workspace ::id() const { return this->mId; }
|
|
QString I3Workspace::name() const { return this->mName; }
|
|
qint32 I3Workspace ::num() const { return this->mNum; }
|
|
bool I3Workspace ::urgent() const { return this->mUrgent; }
|
|
bool I3Workspace::focused() const { return this->mFocused; }
|
|
I3Monitor* I3Workspace::monitor() const { return this->mMonitor; }
|
|
QVariantMap I3Workspace::lastIpcObject() const { return this->mLastIpcObject; }
|
|
|
|
void I3Workspace::updateFromObject(const QVariantMap& obj) {
|
|
auto id = obj.value("id").value<qint32>();
|
|
auto name = obj.value("name").value<QString>();
|
|
auto num = obj.value("num").value<qint32>();
|
|
auto urgent = obj.value("urgent").value<bool>();
|
|
auto focused = obj.value("focused").value<bool>();
|
|
auto monitorName = obj.value("output").value<QString>();
|
|
|
|
if (id != this->mId) {
|
|
this->mId = id;
|
|
emit this->idChanged();
|
|
}
|
|
|
|
if (name != this->mName) {
|
|
this->mName = name;
|
|
emit this->nameChanged();
|
|
}
|
|
|
|
if (num != this->mNum) {
|
|
this->mNum = num;
|
|
emit this->numChanged();
|
|
}
|
|
|
|
if (urgent != this->mUrgent) {
|
|
this->mUrgent = urgent;
|
|
emit this->urgentChanged();
|
|
}
|
|
|
|
if (focused != this->mFocused) {
|
|
this->mFocused = focused;
|
|
emit this->focusedChanged();
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|
|
|
|
void I3Workspace::setFocus(bool focus) { this->mFocused = focus; }
|
|
|
|
} // namespace qs::i3::ipc
|