2017-09-26 22:21:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "modules/meta/event_module.hpp"
|
2023-05-08 17:36:12 +00:00
|
|
|
#include "modules/meta/types.hpp"
|
2020-05-15 17:59:08 +00:00
|
|
|
#include "settings.hpp"
|
2017-09-26 22:21:23 +00:00
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
// fwd
|
|
|
|
class pulseaudio;
|
|
|
|
|
|
|
|
namespace modules {
|
|
|
|
using pulseaudio_t = shared_ptr<pulseaudio>;
|
|
|
|
|
2019-12-02 18:14:26 +00:00
|
|
|
class pulseaudio_module : public event_module<pulseaudio_module> {
|
2017-09-26 22:21:23 +00:00
|
|
|
public:
|
2023-05-01 12:58:52 +00:00
|
|
|
explicit pulseaudio_module(const bar_settings&, string, const config&);
|
2017-09-26 22:21:23 +00:00
|
|
|
|
|
|
|
void teardown();
|
|
|
|
bool has_event();
|
|
|
|
bool update();
|
|
|
|
string get_format() const;
|
|
|
|
string get_output();
|
|
|
|
bool build(builder* builder, const string& tag) const;
|
|
|
|
|
2023-05-08 17:36:12 +00:00
|
|
|
static constexpr auto TYPE = PULSEAUDIO_TYPE;
|
2020-05-15 17:59:08 +00:00
|
|
|
|
2020-05-24 16:35:12 +00:00
|
|
|
static constexpr auto EVENT_INC = "inc";
|
|
|
|
static constexpr auto EVENT_DEC = "dec";
|
|
|
|
static constexpr auto EVENT_TOGGLE = "toggle";
|
|
|
|
|
2017-09-26 22:21:23 +00:00
|
|
|
protected:
|
2021-01-04 09:25:52 +00:00
|
|
|
void action_inc();
|
|
|
|
void action_dec();
|
|
|
|
void action_toggle();
|
2017-09-26 22:21:23 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static constexpr auto FORMAT_VOLUME = "format-volume";
|
|
|
|
static constexpr auto FORMAT_MUTED = "format-muted";
|
|
|
|
|
|
|
|
static constexpr auto TAG_RAMP_VOLUME = "<ramp-volume>";
|
|
|
|
static constexpr auto TAG_BAR_VOLUME = "<bar-volume>";
|
|
|
|
static constexpr auto TAG_LABEL_VOLUME = "<label-volume>";
|
|
|
|
static constexpr auto TAG_LABEL_MUTED = "<label-muted>";
|
|
|
|
|
|
|
|
progressbar_t m_bar_volume;
|
|
|
|
ramp_t m_ramp_volume;
|
|
|
|
label_t m_label_volume;
|
|
|
|
label_t m_label_muted;
|
|
|
|
|
|
|
|
pulseaudio_t m_pulseaudio;
|
|
|
|
|
2018-08-06 20:47:12 +00:00
|
|
|
int m_interval{5};
|
2024-01-12 23:47:35 +00:00
|
|
|
bool m_unmute_on_scroll{false};
|
2017-09-26 22:21:23 +00:00
|
|
|
atomic<bool> m_muted{false};
|
|
|
|
atomic<int> m_volume{0};
|
2019-10-09 00:13:58 +00:00
|
|
|
atomic<double> m_decibels{0};
|
2022-04-02 21:45:54 +00:00
|
|
|
atomic<bool> m_reverse_scroll{false};
|
2017-09-26 22:21:23 +00:00
|
|
|
};
|
2020-05-15 17:59:08 +00:00
|
|
|
} // namespace modules
|
2017-09-26 22:21:23 +00:00
|
|
|
|
|
|
|
POLYBAR_NS_END
|