Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate persistent_workspaces in favor of persistent-workspaces #2468

Merged
merged 4 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions man/waybar-hyprland-workspaces.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Additional to workspace name matching, the following *format-icons* can be set.
"active": "",
"default": ""
},
"persistent_workspaces": {
"persistent-workspaces": {
"*": 5, // 5 workspaces by default on every monitor
"HDMI-A-1": 3 // but only three on HDMI-A-1
}
Expand All @@ -88,7 +88,7 @@ Additional to workspace name matching, the following *format-icons* can be set.
"active": "",
"default": ""
},
"persistent_workspaces": {
"persistent-workspaces": {
"*": [ 2,3,4,5 ], // 2-5 on every monitor
"HDMI-A-1": [ 1 ] // but only workspace 1 on HDMI-A-1
}
Expand Down
4 changes: 2 additions & 2 deletions man/waybar-sway-workspaces.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Addressed by *sway/workspaces*
default: false ++
If set to true. Only focused workspaces will be shown.

*persistent_workspaces*: ++
*persistent-workspaces*: ++
typeof: json (see below) ++
default: empty ++
Lists workspaces that should always be shown, even when non existent
Expand Down Expand Up @@ -112,7 +112,7 @@ an empty list denoting all outputs.

```
"sway/workspaces": {
"persistent_workspaces": {
"persistent-workspaces": {
"3": [], // Always show a workspace with name '3', on all outputs if it does not exists
"4": ["eDP-1"], // Always show a workspace with name '4', on output 'eDP-1' if it does not exists
"5": ["eDP-1", "DP-2"] // Always show a workspace with name '5', on outputs 'eDP-1' and 'DP-2' if it does not exists
Expand Down
9 changes: 8 additions & 1 deletion src/modules/hyprland/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,14 @@ void Workspaces::remove_workspace(std::string name) {

void Workspaces::fill_persistent_workspaces() {
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();

for (const std::string &key : keys) {
Expand Down
13 changes: 11 additions & 2 deletions src/modules/sway/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,18 @@ void Workspaces::onCmd(const struct Ipc::ipc_response &res) {
: true;
});

// adding persistent workspaces (as per the config file)
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.");
}

// adding persistent workspaces (as per the config file)
if (config_["persistent-workspaces"].isObject() ||
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();

for (const std::string &p_w_name : p_workspaces_names) {
Expand Down
13 changes: 11 additions & 2 deletions src/modules/wlr/workspace_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,17 @@ WorkspaceGroup::WorkspaceGroup(const Bar &bar, Gtk::Box &box, const Json::Value
}

auto WorkspaceGroup::fill_persistent_workspaces() -> void {
if (config_["persistent_workspaces"].isObject() && !workspace_manager_.all_outputs()) {
const Json::Value &p_workspaces = config_["persistent_workspaces"];
if (config_["persistent_workspaces"].isObject()) {
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();

for (const std::string &p_w_name : p_workspaces_names) {
Expand Down