dwm: Rename label-state to label-tags

label-tags is more indicative of what the label represents.
This commit is contained in:
Mihir Lad 2020-07-21 01:30:04 -04:00
parent 5967ac3b0b
commit 33a8226827
3 changed files with 8 additions and 7 deletions

View File

@ -168,7 +168,7 @@ label-urgent-padding = 2
[module/dwm]
type = internal/dwm
format = <label-state> <label-layout> <label-title>
format = <label-tags> <label-layout>> <label-title>
enable-click = false

View File

@ -56,11 +56,11 @@ namespace modules {
auto input(string&& cmd) -> bool override;
private:
static constexpr const char* DEFAULT_FORMAT_TAGS{"<label-state> <label-layout> <label-title>"};
static constexpr const char* DEFAULT_FORMAT_TAGS{"<label-tags> <label-layout> <label-title>"};
static constexpr const char* DEFAULT_STATE_LABEL{"%name%"};
/**
* The state label is used to represent a tag. This label is replaced by one
* The tags label is replaced with the tags. Each tag is displayed using one
* of the following labels based on the tag state:
* * label-focused
* * label-unfocused
@ -68,7 +68,7 @@ namespace modules {
* * label-urgent
* * label-empty
*/
static constexpr const char* TAG_LABEL_STATE{"<label-state>"};
static constexpr const char* TAG_LABEL_TAGS{"<label-tags>"};
/**
* The layout label is replaced by the current layout symbol

View File

@ -28,10 +28,11 @@ namespace modules {
m_ipc = factory_util::unique<dwmipc::Connection>(socket_path);
// Load configuration
m_formatter->add(DEFAULT_FORMAT, DEFAULT_FORMAT_TAGS, {TAG_LABEL_STATE, TAG_LABEL_LAYOUT, TAG_LABEL_TITLE});
m_formatter->add(
DEFAULT_FORMAT, DEFAULT_FORMAT_TAGS, {TAG_LABEL_TAGS, TAG_LABEL_LAYOUT, TAG_LABEL_TITLE});
// Populate m_state_labels map with labels and their states
if (m_formatter->has(TAG_LABEL_STATE)) {
if (m_formatter->has(TAG_LABEL_TAGS)) {
m_state_labels.insert(
std::make_pair(state_t::FOCUSED, load_optional_label(m_conf, name(), "label-focused", DEFAULT_STATE_LABEL)));
m_state_labels.insert(std::make_pair(
@ -164,7 +165,7 @@ namespace modules {
} else {
builder->node(m_layout_label);
}
} else if (tag == TAG_LABEL_STATE) {
} else if (tag == TAG_LABEL_TAGS) {
bool first = true;
for (const auto& tag : m_tags) {
// Don't insert separator before first tag