File: user.hpp

package info (click to toggle)
waybar 0.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,364 kB
  • sloc: cpp: 24,698; xml: 742; python: 146; ansic: 77; makefile: 26
file content (34 lines) | stat: -rw-r--r-- 954 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#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&);
  virtual ~User() = default;
  auto update() -> void override;

  bool handleToggle(GdkEventButton* const& e) override;

 private:
  util::SleeperThread thread_;

  static constexpr inline int defaultUserImageWidth_ = 20;
  static constexpr inline int defaultUserImageHeight_ = 20;

  long uptime_as_seconds();
  std::string get_user_login() const;
  std::string get_user_home_dir() const;
  std::string get_default_user_avatar_path() const;
  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