2022-09-30 11:33:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fmt/chrono.h>
|
|
|
|
#include <gdkmm/pixbuf.h>
|
|
|
|
#include <glibmm/refptr.h>
|
|
|
|
|
|
|
|
#include "AIconLabel.hpp"
|
|
|
|
#include "util/sleeper_thread.hpp"
|
|
|
|
|
|
|
|
namespace waybar::modules {
|
|
|
|
class User : public AIconLabel {
|
|
|
|
public:
|
|
|
|
User(const std::string&, const Json::Value&);
|
2023-03-02 13:57:07 +00:00
|
|
|
virtual ~User() = default;
|
|
|
|
auto update() -> void override;
|
2022-09-30 11:33:23 +00:00
|
|
|
|
2024-01-08 16:03:42 +00:00
|
|
|
//todo bool handleToggle(GdkEventButton* const& e) override;
|
2022-11-15 13:15:26 +00:00
|
|
|
|
2022-09-30 11:33:23 +00:00
|
|
|
private:
|
|
|
|
util::SleeperThread thread_;
|
|
|
|
|
|
|
|
static constexpr inline int defaultUserImageWidth_ = 20;
|
|
|
|
static constexpr inline int defaultUserImageHeight_ = 20;
|
|
|
|
|
|
|
|
long uptime_as_seconds();
|
2022-11-11 12:15:12 +00:00
|
|
|
std::string get_user_login() const;
|
|
|
|
std::string get_user_home_dir() const;
|
|
|
|
std::string get_default_user_avatar_path() const;
|
2022-09-30 11:33:23 +00:00
|
|
|
void init_default_user_avatar(int width, int height);
|
|
|
|
void init_user_avatar(const std::string& path, int width, int height);
|
|
|
|
void init_avatar(const Json::Value& config);
|
|
|
|
void init_update_worker();
|
|
|
|
};
|
|
|
|
} // namespace waybar::modules
|