feat(github): Option to hide notification count if empty
This commit is contained in:
parent
6ef1721b61
commit
de04fa3eac
@ -24,6 +24,7 @@ namespace modules {
|
||||
label_t m_label{};
|
||||
string m_accesstoken{};
|
||||
unique_ptr<http_downloader> m_http{};
|
||||
bool m_empty_notifications{false};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,8 @@ namespace modules {
|
||||
*/
|
||||
void github_module::setup() {
|
||||
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});
|
||||
|
||||
@ -57,7 +58,7 @@ namespace modules {
|
||||
|
||||
if (m_label) {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user