Fixing: missing argument for fmt, workspace order
Persistant workspaces would reorder upon their first creation
This commit is contained in:
parent
071b4928dc
commit
0ec8774a08
|
@ -51,6 +51,8 @@ void Workspaces::onCmd(const struct Ipc::ipc_response &res) {
|
||||||
// adding persistant workspaces (as per the config file)
|
// adding persistant workspaces (as per the config file)
|
||||||
const Json::Value & p_workspaces = config_["persistant_workspaces"];
|
const Json::Value & p_workspaces = config_["persistant_workspaces"];
|
||||||
const std::vector<std::string> p_workspaces_names = p_workspaces.getMemberNames();
|
const std::vector<std::string> p_workspaces_names = p_workspaces.getMemberNames();
|
||||||
|
|
||||||
|
auto first_persistant_ws_idx = workspaces_.size();
|
||||||
for (const std::string &p_w_name : p_workspaces_names) {
|
for (const std::string &p_w_name : p_workspaces_names) {
|
||||||
const Json::Value &p_w = p_workspaces[p_w_name];
|
const Json::Value &p_w = p_workspaces[p_w_name];
|
||||||
auto it =
|
auto it =
|
||||||
|
@ -83,10 +85,13 @@ void Workspaces::onCmd(const struct Ipc::ipc_response &res) {
|
||||||
|
|
||||||
if (workspaces_order_.empty()) {
|
if (workspaces_order_.empty()) {
|
||||||
// Saving starting order
|
// Saving starting order
|
||||||
workspaces_order_.reserve(payload.size());
|
workspaces_order_.reserve(payload.size() + workspaces_.size() - first_persistant_ws_idx);
|
||||||
for (const Json::Value &workspace : payload) {
|
for (const Json::Value &workspace : payload) {
|
||||||
workspaces_order_.emplace_back(workspace["name"].asString());
|
workspaces_order_.emplace_back(workspace["name"].asString());
|
||||||
}
|
}
|
||||||
|
for (auto i = first_persistant_ws_idx; i < workspaces_.size() ; ++i) {
|
||||||
|
workspaces_order_.emplace_back(workspaces_[i]["name"].asString());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ordering workspaces as it was before for current output
|
// Ordering workspaces as it was before for current output
|
||||||
std::vector<Json::Value> sorted_workspaces;
|
std::vector<Json::Value> sorted_workspaces;
|
||||||
|
@ -213,7 +218,7 @@ Gtk::Button &Workspaces::addButton(const Json::Value &node) {
|
||||||
node["target_output"].asString(),
|
node["target_output"].asString(),
|
||||||
node["name"].asString()));
|
node["name"].asString()));
|
||||||
} else {
|
} else {
|
||||||
ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\""));
|
ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\"", node["name"].asString()));
|
||||||
}
|
}
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
|
|
Loading…
Reference in New Issue