mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
hyprland/ipc: follow workspace id changes
This commit is contained in:
1 parent
d7ee6d125c
commit
4befab5bc6
2 files changed
+26
No files matched your search
@@ -1,3 +1,4 @@
|
||||
## Bug Fixes
|
||||
|
||||
- Fixed ScriptModel not sending role updates on changed data that compares equal by key or structure.
|
||||
- Fixed Hyprland workspaces keeping their old id after Hyprland changes it.
|
||||
@@ -452,6 +452,31 @@ void HyprlandIpc::onEvent(HyprlandIpcEvent* event) {
|
||||
<< (*workspaceIter)->bindableName().value() << "to" << name;
|
||||
|
||||
(*workspaceIter)->bindableName().setValue(name);
|
||||
} else if (event->name == "changeworkspaceid") {
|
||||
auto args = event->parseView(2);
|
||||
auto oldAddress = QString::fromUtf8(args.at(0));
|
||||
auto newAddress = QString::fromUtf8(args.at(1));
|
||||
|
||||
const auto& mList = this->mWorkspaces.valueList();
|
||||
|
||||
auto workspaceIter = std::ranges::find_if(mList, [&](HyprlandWorkspace* m) {
|
||||
return m->bindableAddress().value() == oldAddress;
|
||||
});
|
||||
|
||||
if (workspaceIter == mList.end()) return;
|
||||
auto* workspace = *workspaceIter;
|
||||
|
||||
qCDebug(logHyprlandIpc) << "Workspace with address" << oldAddress << "changed id to"
|
||||
<< newAddress;
|
||||
|
||||
// Hyprland names a workspace after its new id unless it was renamed.
|
||||
auto name = workspace->bindableName().value();
|
||||
if (name == oldAddress) name = newAddress;
|
||||
|
||||
// The list is sorted by id, so the workspace moves to its new place in it.
|
||||
this->mWorkspaces.removeObject(workspace);
|
||||
workspace->updateInitial(newAddress, name);
|
||||
this->mWorkspaces.insertObjectSorted(workspace, &HyprlandIpc::compareWorkspaces);
|
||||
} else if (event->name == "fullscreen") {
|
||||
if (auto* workspace = this->bFocusedWorkspace.value()) {
|
||||
workspace->bindableHasFullscreen().setValue(event->data == "1");
|
||||
|
||||
Reference in new issue
Block a user