File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,22 @@ void HyprlandIpc::onEvent(HyprlandIpcEvent* event) {
352352 auto * monitor = this ->findMonitorByName (monitorName, true );
353353
354354 workspace->setMonitor (monitor);
355+ } else if (event->name == " renameworkspace" ) {
356+ auto args = event->parseView (2 );
357+ auto id = args.at (0 ).toInt ();
358+ auto name = QString::fromUtf8 (args.at (1 ));
359+
360+ const auto & mList = this ->mWorkspaces .valueList ();
361+
362+ auto workspaceIter =
363+ std::ranges::find_if (mList , [id](const HyprlandWorkspace* m) { return m->id () == id; });
364+
365+ if (workspaceIter == mList .end ()) return ;
366+
367+ qCDebug (logHyprlandIpc) << " Workspace with id" << id << " renamed from"
368+ << (*workspaceIter)->name () << " to" << name;
369+
370+ (*workspaceIter)->setName (name);
355371 }
356372}
357373
Original file line number Diff line number Diff line change 1111namespace qs ::hyprland::ipc {
1212
1313qint32 HyprlandWorkspace::id () const { return this ->mId ; }
14+
1415QString HyprlandWorkspace::name () const { return this ->mName ; }
16+
17+ void HyprlandWorkspace::setName (QString name) {
18+ if (name == this ->mName ) return ;
19+ this ->mName = std::move (name);
20+ emit this ->nameChanged ();
21+ }
22+
1523QVariantMap HyprlandWorkspace::lastIpcObject () const { return this ->mLastIpcObject ; }
1624
1725void HyprlandWorkspace::updateInitial (qint32 id, QString name) {
Original file line number Diff line number Diff line change @@ -32,11 +32,14 @@ class HyprlandWorkspace: public QObject {
3232 void updateFromObject (QVariantMap object);
3333
3434 [[nodiscard]] qint32 id () const ;
35+
3536 [[nodiscard]] QString name () const ;
37+ void setName (QString name);
38+
3639 [[nodiscard]] QVariantMap lastIpcObject () const ;
3740
38- void setMonitor (HyprlandMonitor* monitor);
3941 [[nodiscard]] HyprlandMonitor* monitor () const ;
42+ void setMonitor (HyprlandMonitor* monitor);
4043
4144signals:
4245 void idChanged ();
You can’t perform that action at this time.
0 commit comments