mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-11-08 04:16:32 +00:00
hyprland/ipc: handle renameworkspace
This commit is contained in:
3 files changed
+28
-1
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,15 @@
|
||||
namespace qs::hyprland::ipc {
|
||||
|
||||
qint32 HyprlandWorkspace::id() const { return this->mId; }
|
||||
|
||||
QString HyprlandWorkspace::name() const { return this->mName; }
|
||||
|
||||
void HyprlandWorkspace::setName(QString name) {
|
||||
if (name == this->mName) return;
|
||||
this->mName = std::move(name);
|
||||
emit this->nameChanged();
|
||||
}
|
||||
|
||||
QVariantMap HyprlandWorkspace::lastIpcObject() const { return this->mLastIpcObject; }
|
||||
|
||||
void HyprlandWorkspace::updateInitial(qint32 id, QString name) {
|
||||
|
||||
@@ -32,11 +32,14 @@ public:
|
||||
void updateFromObject(QVariantMap object);
|
||||
|
||||
[[nodiscard]] qint32 id() const;
|
||||
|
||||
[[nodiscard]] QString name() const;
|
||||
void setName(QString name);
|
||||
|
||||
[[nodiscard]] QVariantMap lastIpcObject() const;
|
||||
|
||||
void setMonitor(HyprlandMonitor* monitor);
|
||||
[[nodiscard]] HyprlandMonitor* monitor() const;
|
||||
void setMonitor(HyprlandMonitor* monitor);
|
||||
|
||||
signals:
|
||||
void idChanged();
|
||||
|
||||
Reference in new issue
Block a user