hyprland/ipc: handle renameworkspace

This commit is contained in:
outfoxxed 2025-01-22 04:14:55 -08:00
parent b336129c34
commit 3c7dfcb220
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 28 additions and 1 deletions

View file

@ -352,6 +352,22 @@ void HyprlandIpc::onEvent(HyprlandIpcEvent* event) {
auto* monitor = this->findMonitorByName(monitorName, true);
workspace->setMonitor(monitor);
} else if (event->name == "renameworkspace") {
auto args = event->parseView(2);
auto id = args.at(0).toInt();
auto name = QString::fromUtf8(args.at(1));
const auto& mList = this->mWorkspaces.valueList();
auto workspaceIter =
std::ranges::find_if(mList, [id](const HyprlandWorkspace* m) { return m->id() == id; });
if (workspaceIter == mList.end()) return;
qCDebug(logHyprlandIpc) << "Workspace with id" << id << "renamed from"
<< (*workspaceIter)->name() << "to" << name;
(*workspaceIter)->setName(name);
}
}