Skip to content

Commit

Permalink
refactor(workspaces): default value unstripped, fix man
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays committed Apr 6, 2020
1 parent 6570aef commit 27fbea2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions man/waybar-sway-workspaces.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Addressed by *sway/workspaces*

*format*: ++
typeof: string ++
default: {name} ++
default: {value} ++
The format, how information should be displayed.

*format-icons*: ++
Expand Down Expand Up @@ -62,7 +62,9 @@ Addressed by *sway/workspaces*

# FORMAT REPLACEMENTS

*{name}*: Name of the workspace, as defined by sway.
*{value}*: Name of the workspace, as defined by sway.

*{name}*: Number stripped from workspace value.

*{icon}*: Icon, as defined in *format-icons*.

Expand Down
7 changes: 4 additions & 3 deletions src/modules/sway/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,13 @@ auto Workspaces::update() -> void {
if (needReorder) {
box_.reorder_child(button, it - workspaces_.begin());
}
std::string output = getIcon((*it)["name"].asString(), *it);
std::string output = (*it)["name"].asString();
if (config_["format"].isString()) {
auto format = config_["format"].asString();
output = fmt::format(format,
fmt::arg("icon", output),
fmt::arg("name", trimWorkspaceName((*it)["name"].asString())),
fmt::arg("icon", getIcon(output, *it)),
fmt::arg("value", output)
fmt::arg("name", trimWorkspaceName(output)),
fmt::arg("index", (*it)["num"].asString()));
}
if (!config_["disable-markup"].asBool()) {
Expand Down

0 comments on commit 27fbea2

Please sign in to comment.