refactor: deprecate instead of remove persistent_workspaces
parent
b405dc436c
commit
c9e1899594
|
@ -231,8 +231,15 @@ void Workspaces::remove_workspace(std::string name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspaces::fill_persistent_workspaces() {
|
void Workspaces::fill_persistent_workspaces() {
|
||||||
if (config_["persistent-workspaces"].isObject()) {
|
if (config_["persistent_workspaces"].isObject()) {
|
||||||
const Json::Value persistent_workspaces = config_["persistent-workspaces"];
|
spdlog::warn(
|
||||||
|
"persistent_workspaces is deprecated. Please change config to use persistent-workspaces.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config_["persistent-workspaces"].isObject() || config_["persistent_workspaces"].isObject()) {
|
||||||
|
const Json::Value persistent_workspaces = config_["persistent-workspaces"].isObject()
|
||||||
|
? config_["persistent-workspaces"]
|
||||||
|
: config_["persistent_workspaces"];
|
||||||
const std::vector<std::string> keys = persistent_workspaces.getMemberNames();
|
const std::vector<std::string> keys = persistent_workspaces.getMemberNames();
|
||||||
|
|
||||||
for (const std::string &key : keys) {
|
for (const std::string &key : keys) {
|
||||||
|
|
|
@ -79,9 +79,18 @@ void Workspaces::onCmd(const struct Ipc::ipc_response &res) {
|
||||||
: true;
|
: true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (config_["persistent_workspaces"].isObject()) {
|
||||||
|
spdlog::warn(
|
||||||
|
"persistent_workspaces is deprecated. Please change config to use "
|
||||||
|
"persistent-workspaces.");
|
||||||
|
}
|
||||||
|
|
||||||
// adding persistent workspaces (as per the config file)
|
// adding persistent workspaces (as per the config file)
|
||||||
if (config_["persistent-workspaces"].isObject()) {
|
if (config_["persistent-workspaces"].isObject() ||
|
||||||
const Json::Value &p_workspaces = config_["persistent-workspaces"];
|
config_["persistent_workspaces"].isObject()) {
|
||||||
|
const Json::Value &p_workspaces = config_["persistent-workspaces"].isObject()
|
||||||
|
? config_["persistent-workspaces"]
|
||||||
|
: config_["persistent_workspaces"];
|
||||||
const std::vector<std::string> p_workspaces_names = p_workspaces.getMemberNames();
|
const std::vector<std::string> p_workspaces_names = p_workspaces.getMemberNames();
|
||||||
|
|
||||||
for (const std::string &p_w_name : p_workspaces_names) {
|
for (const std::string &p_w_name : p_workspaces_names) {
|
||||||
|
|
|
@ -209,8 +209,17 @@ WorkspaceGroup::WorkspaceGroup(const Bar &bar, Gtk::Box &box, const Json::Value
|
||||||
}
|
}
|
||||||
|
|
||||||
auto WorkspaceGroup::fill_persistent_workspaces() -> void {
|
auto WorkspaceGroup::fill_persistent_workspaces() -> void {
|
||||||
if (config_["persistent-workspaces"].isObject() && !workspace_manager_.all_outputs()) {
|
if (config_["persistent_workspaces"].isObject()) {
|
||||||
const Json::Value &p_workspaces = config_["persistent-workspaces"];
|
spdlog::warn(
|
||||||
|
"persistent_workspaces is deprecated. Please change config to use persistent-workspaces.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config_["persistent-workspaces"].isObject() ||
|
||||||
|
config_["persistent_workspaces"].isObject()) &&
|
||||||
|
!workspace_manager_.all_outputs()) {
|
||||||
|
const Json::Value &p_workspaces = config_["persistent-workspaces"].isObject()
|
||||||
|
? config_["persistent-workspaces"]
|
||||||
|
: config_["persistent_workspaces"];
|
||||||
const std::vector<std::string> p_workspaces_names = p_workspaces.getMemberNames();
|
const std::vector<std::string> p_workspaces_names = p_workspaces.getMemberNames();
|
||||||
|
|
||||||
for (const std::string &p_w_name : p_workspaces_names) {
|
for (const std::string &p_w_name : p_workspaces_names) {
|
||||||
|
|
Loading…
Reference in New Issue