mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat: add pulseaudio module
This commit is contained in:
@ -20,20 +20,6 @@ namespace waybar::modules {
|
||||
Network(Json::Value config);
|
||||
auto update() -> void;
|
||||
operator Gtk::Widget &();
|
||||
typedef struct {
|
||||
int flags;
|
||||
char essid[IW_ESSID_MAX_SIZE + 1];
|
||||
uint8_t bssid[ETH_ALEN];
|
||||
int quality;
|
||||
int quality_max;
|
||||
int quality_average;
|
||||
int signal_level;
|
||||
int signal_level_max;
|
||||
int noise_level;
|
||||
int noise_level_max;
|
||||
int bitrate;
|
||||
double frequency;
|
||||
} wireless_info_t;
|
||||
private:
|
||||
void _parseEssid(struct nlattr **bss);
|
||||
void _parseSignal(struct nlattr **bss);
|
||||
|
36
include/modules/pulseaudio.hpp
Normal file
36
include/modules/pulseaudio.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <pulse/pulseaudio.h>
|
||||
#include <json/json.h>
|
||||
#include <gtkmm.h>
|
||||
#include <fmt/format.h>
|
||||
#include <thread>
|
||||
#include "util/chrono.hpp"
|
||||
#include "IModule.hpp"
|
||||
|
||||
namespace waybar::modules {
|
||||
|
||||
class Pulseaudio : public IModule {
|
||||
public:
|
||||
Pulseaudio(Json::Value config);
|
||||
auto update() -> void;
|
||||
operator Gtk::Widget &();
|
||||
private:
|
||||
static void _subscribeCb(pa_context *context,
|
||||
pa_subscription_event_type_t type, uint32_t idx, void *data);
|
||||
static void _contextStateCb(pa_context *c, void *data);
|
||||
static void _sinkInfoCb(pa_context *context, const pa_sink_info *i,
|
||||
int eol, void *data);
|
||||
static void _serverInfoCb(pa_context *context, const pa_server_info *i,
|
||||
void *data);
|
||||
Gtk::Label _label;
|
||||
std::thread _thread;
|
||||
Json::Value _config;
|
||||
pa_mainloop *_mainloop;
|
||||
pa_mainloop_api *_mainloop_api;
|
||||
pa_context *_context;
|
||||
int _volume;
|
||||
bool _muted;
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user