refactor(workspaces): default value unstripped, fix man

This commit is contained in:
Alex 2020-04-06 12:42:04 +02:00
parent 6570aefeec
commit 27fbea2b5a
2 changed files with 8 additions and 5 deletions

View File

@ -19,7 +19,7 @@ Addressed by *sway/workspaces*
*format*: ++
typeof: string ++
default: {name} ++
default: {value} ++
The format, how information should be displayed.
*format-icons*: ++
@ -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*.

View File

@ -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()) {