hyprland/workspaces: react on renameworkspace event
parent
f7ff005dd5
commit
9c49f46b01
|
@ -34,6 +34,7 @@ class Workspace {
|
|||
void set_persistent(bool value = true) { is_persistent_ = value; };
|
||||
void set_urgent(bool value = true) { is_urgent_ = value; };
|
||||
void set_windows(uint value) { windows_ = value; };
|
||||
void set_name(std::string value) { name_ = value; };
|
||||
|
||||
void update(const std::string& format, const std::string& icon);
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ Workspaces::Workspaces(const std::string &id, const Bar &bar, const Json::Value
|
|||
gIPC->registerForIPC("destroyworkspace", this);
|
||||
gIPC->registerForIPC("focusedmon", this);
|
||||
gIPC->registerForIPC("moveworkspace", this);
|
||||
gIPC->registerForIPC("renameworkspace", this);
|
||||
gIPC->registerForIPC("openwindow", this);
|
||||
gIPC->registerForIPC("closewindow", this);
|
||||
gIPC->registerForIPC("movewindow", this);
|
||||
|
@ -132,6 +133,16 @@ void Workspaces::onEvent(const std::string &ev) {
|
|||
update_window_count();
|
||||
} else if (eventName == "urgent") {
|
||||
set_urgent_workspace(payload);
|
||||
} else if (eventName == "renameworkspace") {
|
||||
std::string workspace_id_str = payload.substr(0, payload.find(','));
|
||||
int workspace_id = workspace_id_str == "special" ? -99 : std::stoi(workspace_id_str);
|
||||
std::string new_name = payload.substr(payload.find(',') + 1);
|
||||
for (auto &workspace : workspaces_) {
|
||||
if (workspace->id() == workspace_id) {
|
||||
workspace->set_name(new_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dp.emit();
|
||||
|
|
Loading…
Reference in New Issue