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] [module/dwm]
type = internal/dwm type = internal/dwm
format = <label-state> <label-layout> <label-title> format = <label-tags> <label-layout>> <label-title>
enable-click = false enable-click = false

View File

@ -56,11 +56,11 @@ namespace modules {
auto input(string&& cmd) -> bool override; auto input(string&& cmd) -> bool override;
private: 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%"}; 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: * of the following labels based on the tag state:
* * label-focused * * label-focused
* * label-unfocused * * label-unfocused
@ -68,7 +68,7 @@ namespace modules {
* * label-urgent * * label-urgent
* * label-empty * * 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 * 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); m_ipc = factory_util::unique<dwmipc::Connection>(socket_path);
// Load configuration // 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 // 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( m_state_labels.insert(
std::make_pair(state_t::FOCUSED, load_optional_label(m_conf, name(), "label-focused", DEFAULT_STATE_LABEL))); std::make_pair(state_t::FOCUSED, load_optional_label(m_conf, name(), "label-focused", DEFAULT_STATE_LABEL)));
m_state_labels.insert(std::make_pair( m_state_labels.insert(std::make_pair(
@ -164,7 +165,7 @@ namespace modules {
} else { } else {
builder->node(m_layout_label); builder->node(m_layout_label);
} }
} else if (tag == TAG_LABEL_STATE) { } else if (tag == TAG_LABEL_TAGS) {
bool first = true; bool first = true;
for (const auto& tag : m_tags) { for (const auto& tag : m_tags) {
// Don't insert separator before first tag // Don't insert separator before first tag