hyprland/ipc: expose active and focused properties + activate()

This commit is contained in:
outfoxxed 2025-03-26 02:52:23 -07:00
parent 207e6114a3
commit 62ccab5d30
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
7 changed files with 92 additions and 33 deletions

View file

@ -59,10 +59,24 @@ void HyprlandWorkspace::setMonitor(HyprlandMonitor* monitor) {
this->mMonitor = monitor;
Qt::beginPropertyUpdateGroup();
if (monitor != nullptr) {
QObject::connect(monitor, &QObject::destroyed, this, &HyprlandWorkspace::onMonitorDestroyed);
this->bActive.setBinding([this]() {
return this->mMonitor->bindableActiveWorkspace().value() == this;
});
this->bFocused.setBinding([this]() {
return this->bActive.value() && this->mMonitor->bindableFocused().value();
});
} else {
this->bActive = false;
this->bFocused = false;
}
Qt::endPropertyUpdateGroup();
emit this->monitorChanged();
}
@ -71,4 +85,8 @@ void HyprlandWorkspace::onMonitorDestroyed() {
emit this->monitorChanged();
}
void HyprlandWorkspace::activate() {
HyprlandIpc::instance()->dispatch(QString("workspace %1").arg(this->bId.value()));
}
} // namespace qs::hyprland::ipc