2016-12-19 21:01:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "modules/meta/timer_module.hpp"
|
2017-11-07 22:29:44 +00:00
|
|
|
#include "settings.hpp"
|
2016-12-19 21:01:37 +00:00
|
|
|
#include "utils/http.hpp"
|
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
namespace modules {
|
|
|
|
/**
|
|
|
|
* Module used to query the GitHub API for notification count
|
|
|
|
*/
|
|
|
|
class github_module : public timer_module<github_module> {
|
|
|
|
public:
|
|
|
|
explicit github_module(const bar_settings&, string);
|
|
|
|
|
|
|
|
bool update();
|
|
|
|
bool build(builder* builder, const string& tag) const;
|
|
|
|
|
|
|
|
private:
|
2019-08-04 18:58:25 +00:00
|
|
|
void update_label(int);
|
2017-11-07 22:29:44 +00:00
|
|
|
int get_number_of_notification();
|
|
|
|
string request();
|
2016-12-19 21:01:37 +00:00
|
|
|
static constexpr auto TAG_LABEL = "<label>";
|
|
|
|
|
|
|
|
label_t m_label{};
|
2019-08-04 18:58:25 +00:00
|
|
|
string m_api_url;
|
2016-12-19 21:01:37 +00:00
|
|
|
string m_accesstoken{};
|
|
|
|
unique_ptr<http_downloader> m_http{};
|
2016-12-20 04:53:45 +00:00
|
|
|
bool m_empty_notifications{false};
|
2016-12-19 21:01:37 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
POLYBAR_NS_END
|