#pragma once #include "modules/meta/event_module.hpp" #include "settings.hpp" POLYBAR_NS // fwd namespace alsa { class mixer; class control; } // namespace alsa namespace modules { enum class mixer { NONE = 0, MASTER, SPEAKER, HEADPHONE }; enum class control { NONE = 0, HEADPHONE }; using mixer_t = shared_ptr; using control_t = shared_ptr; class alsa_module : public event_module { public: explicit alsa_module(const bar_settings&, string); void teardown(); bool has_event(); bool update(); string get_format() const; string get_output(); bool build(builder* builder, const string& tag) const; static constexpr auto TYPE = "internal/alsa"; static constexpr auto EVENT_INC = "inc"; static constexpr auto EVENT_DEC = "dec"; static constexpr auto EVENT_TOGGLE = "toggle"; protected: bool input(const string& action, const string& data); private: static constexpr auto FORMAT_VOLUME = "format-volume"; static constexpr auto FORMAT_MUTED = "format-muted"; static constexpr auto TAG_RAMP_VOLUME = ""; static constexpr auto TAG_RAMP_HEADPHONES = ""; static constexpr auto TAG_BAR_VOLUME = ""; static constexpr auto TAG_LABEL_VOLUME = ""; static constexpr auto TAG_LABEL_MUTED = ""; progressbar_t m_bar_volume; ramp_t m_ramp_volume; ramp_t m_ramp_headphones; label_t m_label_volume; label_t m_label_muted; map m_mixer; map m_ctrl; int m_headphoneid{0}; bool m_mapped{false}; int m_interval{5}; atomic m_muted{false}; atomic m_headphones{false}; atomic m_volume{0}; }; } // namespace modules POLYBAR_NS_END