mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-04 19:04:56 +11:00
hyprland/ipc: expose active and focused properties + activate()
This commit is contained in:
parent
207e6114a3
commit
62ccab5d30
7 changed files with 92 additions and 33 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue