refactor(workspaces): default value unstripped, fix man

pull/653/head
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*: ++ *format*: ++
typeof: string ++ typeof: string ++
default: {name} ++ default: {value} ++
The format, how information should be displayed. The format, how information should be displayed.
*format-icons*: ++ *format-icons*: ++
@ -62,7 +62,9 @@ Addressed by *sway/workspaces*
# FORMAT REPLACEMENTS # 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*. *{icon}*: Icon, as defined in *format-icons*.

View File

@ -157,12 +157,13 @@ auto Workspaces::update() -> void {
if (needReorder) { if (needReorder) {
box_.reorder_child(button, it - workspaces_.begin()); 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()) { if (config_["format"].isString()) {
auto format = config_["format"].asString(); auto format = config_["format"].asString();
output = fmt::format(format, output = fmt::format(format,
fmt::arg("icon", output), fmt::arg("icon", getIcon(output, *it)),
fmt::arg("name", trimWorkspaceName((*it)["name"].asString())), fmt::arg("value", output)
fmt::arg("name", trimWorkspaceName(output)),
fmt::arg("index", (*it)["num"].asString())); fmt::arg("index", (*it)["num"].asString()));
} }
if (!config_["disable-markup"].asBool()) { if (!config_["disable-markup"].asBool()) {