mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat: wireplumber support
Adds basic support for showing volume via wireplumber. Allows specifying the node-id or falling back to the default Audio/Sink node id if node-id is not set. If tooltip on hover is enabled, will show `{node_name}` by default otherwise `tooltip-format`. Format replacements: `{volume}` - Volume in percentage `{node_name}` - The node's nickname (`node.nick` property)
This commit is contained in:
40
include/modules/wireplumber.hpp
Normal file
40
include/modules/wireplumber.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <wp/wp.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
#include "AButton.hpp"
|
||||
|
||||
namespace waybar::modules {
|
||||
|
||||
class Wireplumber : public AButton {
|
||||
public:
|
||||
Wireplumber(const std::string&, const Json::Value&);
|
||||
~Wireplumber();
|
||||
auto update() -> void;
|
||||
|
||||
private:
|
||||
void loadRequiredApiModules();
|
||||
void prepare();
|
||||
void activatePlugins();
|
||||
static void updateVolume(waybar::modules::Wireplumber* self);
|
||||
static void updateNodeName(waybar::modules::Wireplumber* self);
|
||||
static uint32_t getDefaultNodeId(waybar::modules::Wireplumber* self);
|
||||
static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
|
||||
static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
|
||||
|
||||
WpCore* wp_core_;
|
||||
GPtrArray* apis_;
|
||||
WpObjectManager* om_;
|
||||
uint32_t pending_plugins_;
|
||||
bool muted_;
|
||||
double volume_;
|
||||
uint32_t node_id_{0};
|
||||
std::string node_name_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace waybar::modules
|
Reference in New Issue
Block a user