feat(github): Option to hide notification count if empty
This commit is contained in:
parent
6ef1721b61
commit
de04fa3eac
2 changed files with 4 additions and 2 deletions
|
@ -24,6 +24,7 @@ namespace modules {
|
||||||
label_t m_label{};
|
label_t m_label{};
|
||||||
string m_accesstoken{};
|
string m_accesstoken{};
|
||||||
unique_ptr<http_downloader> m_http{};
|
unique_ptr<http_downloader> m_http{};
|
||||||
|
bool m_empty_notifications{false};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ namespace modules {
|
||||||
*/
|
*/
|
||||||
void github_module::setup() {
|
void github_module::setup() {
|
||||||
m_accesstoken = m_conf.get<string>(name(), "token");
|
m_accesstoken = m_conf.get<string>(name(), "token");
|
||||||
m_interval = m_conf.get<chrono::seconds>(name(), "interval", 60s);
|
m_interval = m_conf.get(name(), "interval", 60s);
|
||||||
|
m_empty_notifications = m_conf.get(name(), "empty-notifications", m_empty_notifications);
|
||||||
|
|
||||||
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL});
|
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL});
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ namespace modules {
|
||||||
|
|
||||||
if (m_label) {
|
if (m_label) {
|
||||||
m_label->reset_tokens();
|
m_label->reset_tokens();
|
||||||
m_label->replace_token("%notifications%", to_string(notifications));
|
m_label->replace_token("%notifications%", notifications || m_empty_notifications ? to_string(notifications) : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue