Files
Waybar/include/modules/wireplumber.hpp
T

50 lines
1.5 KiB
C++
Raw Normal View History

2022-11-16 12:23:12 -08:00
#pragma once
#include <fmt/format.h>
#include <wp/wp.h>
#include <algorithm>
#include <array>
2022-11-24 12:28:52 +01:00
#include "ALabel.hpp"
2022-11-16 12:23:12 -08:00
namespace waybar::modules {
2022-11-24 12:28:52 +01:00
class Wireplumber : public ALabel {
public:
Wireplumber(const std::string&, const Json::Value&);
2023-03-02 16:57:07 +03:00
virtual ~Wireplumber();
auto update() -> void override;
2022-11-16 12:23:12 -08:00
2022-11-24 12:28:52 +01:00
private:
2024-02-15 09:37:36 +13:00
void asyncLoadRequiredApiModules();
2022-11-24 12:28:52 +01:00
void prepare();
void activatePlugins();
static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id);
2022-11-24 12:28:52 +01:00
static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
2024-02-15 09:37:36 +13:00
static void onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
waybar::modules::Wireplumber* self);
static void onMixerApiLoaded(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
2022-11-24 12:28:52 +01:00
static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);
2022-11-16 12:23:12 -08:00
2023-06-05 22:03:46 +03:00
bool handleScroll(GdkEventScroll* e) override;
2022-11-24 12:28:52 +01:00
WpCore* wp_core_;
GPtrArray* apis_;
WpObjectManager* om_;
WpPlugin* mixer_api_;
WpPlugin* def_nodes_api_;
gchar* default_node_name_;
2022-11-24 12:28:52 +01:00
uint32_t pending_plugins_;
bool muted_;
double volume_;
double min_step_;
2022-11-24 12:28:52 +01:00
uint32_t node_id_{0};
std::string node_name_;
2022-11-16 12:23:12 -08:00
};
2022-11-24 12:28:52 +01:00
} // namespace waybar::modules