hyprland/ipc: track workspace fullscreen state
This commit is contained in:
parent
bfd35223ea
commit
02e06ea577
3 changed files with 16 additions and 0 deletions
|
@ -381,6 +381,15 @@ void HyprlandIpc::onEvent(HyprlandIpcEvent* event) {
|
|||
<< (*workspaceIter)->bindableName().value() << "to" << name;
|
||||
|
||||
(*workspaceIter)->bindableName().setValue(name);
|
||||
} else if (event->name == "fullscreen") {
|
||||
if (auto* workspace = this->bFocusedWorkspace.value()) {
|
||||
workspace->bindableHasFullscreen().setValue(event->data == "1");
|
||||
}
|
||||
|
||||
// In theory knowing the current workspace would be enough to determine where
|
||||
// the fullscreen state changed, but this falls apart if you move a fullscreen
|
||||
// window between workspaces.
|
||||
this->refreshWorkspaces(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ void HyprlandWorkspace::updateInitial(qint32 id, const QString& name) {
|
|||
void HyprlandWorkspace::updateFromObject(QVariantMap object) {
|
||||
auto monitorId = object.value("monitorID").value<qint32>();
|
||||
auto monitorName = object.value("monitor").value<QString>();
|
||||
auto hasFullscreen = object.value("hasfullscreen").value<bool>();
|
||||
|
||||
auto initial = this->bId == -1;
|
||||
|
||||
|
@ -59,6 +60,7 @@ void HyprlandWorkspace::updateFromObject(QVariantMap object) {
|
|||
this->setMonitor(monitor);
|
||||
}
|
||||
|
||||
this->bHasFullscreen = hasFullscreen;
|
||||
this->mLastIpcObject = std::move(object);
|
||||
emit this->lastIpcObjectChanged();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ class HyprlandWorkspace: public QObject {
|
|||
/// If this workspace is currently active on a monitor and that monitor is currently
|
||||
/// focused. See also @@active.
|
||||
Q_PROPERTY(bool focused READ default NOTIFY focusedChanged BINDABLE bindableFocused);
|
||||
/// If this workspace currently has a fullscreen client.
|
||||
Q_PROPERTY(bool hasFullscreen READ default NOTIFY focusedChanged BINDABLE bindableHasFullscreen);
|
||||
/// Last json returned for this workspace, as a javascript object.
|
||||
///
|
||||
/// > [!WARNING] This is *not* updated unless the workspace object is fetched again from
|
||||
|
@ -53,6 +55,7 @@ public:
|
|||
[[nodiscard]] QBindable<QString> bindableName() { return &this->bName; }
|
||||
[[nodiscard]] QBindable<bool> bindableActive() { return &this->bActive; }
|
||||
[[nodiscard]] QBindable<bool> bindableFocused() { return &this->bFocused; }
|
||||
[[nodiscard]] QBindable<bool> bindableHasFullscreen() { return &this->bHasFullscreen; }
|
||||
[[nodiscard]] QBindable<HyprlandMonitor*> bindableMonitor() { return &this->bMonitor; }
|
||||
|
||||
[[nodiscard]] QVariantMap lastIpcObject() const;
|
||||
|
@ -64,6 +67,7 @@ signals:
|
|||
void nameChanged();
|
||||
void activeChanged();
|
||||
void focusedChanged();
|
||||
void hasFullscreenChanged();
|
||||
void lastIpcObjectChanged();
|
||||
void monitorChanged();
|
||||
|
||||
|
@ -80,6 +84,7 @@ private:
|
|||
Q_OBJECT_BINDABLE_PROPERTY(HyprlandWorkspace, QString, bName, &HyprlandWorkspace::nameChanged);
|
||||
Q_OBJECT_BINDABLE_PROPERTY(HyprlandWorkspace, bool, bActive, &HyprlandWorkspace::activeChanged);
|
||||
Q_OBJECT_BINDABLE_PROPERTY(HyprlandWorkspace, bool, bFocused, &HyprlandWorkspace::focusedChanged);
|
||||
Q_OBJECT_BINDABLE_PROPERTY(HyprlandWorkspace, bool, bHasFullscreen, &HyprlandWorkspace::hasFullscreenChanged);
|
||||
Q_OBJECT_BINDABLE_PROPERTY(HyprlandWorkspace, HyprlandMonitor*, bMonitor, &HyprlandWorkspace::monitorChanged);
|
||||
// clang-format on
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue