File: wireplumber.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 (59 lines) | stat: -rw-r--r-- 1,915 bytes parent folder | download
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

#include <fmt/format.h>
#include <wp/wp.h>

#include <algorithm>
#include <array>

#include "ALabel.hpp"

namespace waybar::modules {

class Wireplumber : public ALabel {
 public:
  Wireplumber(const std::string&, const Json::Value&);
  virtual ~Wireplumber();
  auto update() -> void override;

 private:
  void asyncLoadRequiredApiModules();
  void prepare(waybar::modules::Wireplumber* self);
  void activatePlugins();
  static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
  static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id);
  static void updateSourceVolume(waybar::modules::Wireplumber* self, uint32_t id);
  static void updateSourceName(waybar::modules::Wireplumber* self, uint32_t id);  // NEW
  static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
  static void onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
                                      waybar::modules::Wireplumber* self);
  static void onMixerApiLoaded(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
  static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
  static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
  static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);

  bool handleScroll(GdkEventScroll* e) override;

  static std::list<waybar::modules::Wireplumber*> modules;

  WpCore* wp_core_;
  GPtrArray* apis_;
  WpObjectManager* om_;
  WpPlugin* mixer_api_;
  WpPlugin* def_nodes_api_;
  gchar* default_node_name_;
  uint32_t pending_plugins_;
  bool muted_;
  double volume_;
  double min_step_;
  uint32_t node_id_{0};
  std::string node_name_;
  std::string source_name_;
  gchar* type_;
  uint32_t source_node_id_;
  bool source_muted_;
  double source_volume_;
  gchar* default_source_name_;
};

}  // namespace waybar::modules