mirror of https://github.com/polybar/polybar.git
refactor(pulseaudio): remove headphone ramp
This commit is contained in:
parent
1792090d66
commit
8be5427c33
|
@ -31,7 +31,6 @@ namespace modules {
|
|||
static constexpr auto FORMAT_MUTED = "format-muted";
|
||||
|
||||
static constexpr auto TAG_RAMP_VOLUME = "<ramp-volume>";
|
||||
static constexpr auto TAG_RAMP_HEADPHONES = "<ramp-headphones>";
|
||||
static constexpr auto TAG_BAR_VOLUME = "<bar-volume>";
|
||||
static constexpr auto TAG_LABEL_VOLUME = "<label-volume>";
|
||||
static constexpr auto TAG_LABEL_MUTED = "<label-muted>";
|
||||
|
@ -43,14 +42,12 @@ namespace modules {
|
|||
|
||||
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;
|
||||
|
||||
pulseaudio_t m_pulseaudio;
|
||||
|
||||
atomic<bool> m_muted{false};
|
||||
atomic<bool> m_headphones{false};
|
||||
atomic<int> m_volume{0};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace modules {
|
|||
}
|
||||
if (m_formatter->has(TAG_RAMP_VOLUME)) {
|
||||
m_ramp_volume = load_ramp(m_conf, name(), TAG_RAMP_VOLUME);
|
||||
m_ramp_headphones = load_ramp(m_conf, name(), TAG_RAMP_HEADPHONES, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,10 +60,9 @@ namespace modules {
|
|||
// Consume pending events
|
||||
m_pulseaudio->process_events();
|
||||
|
||||
// Get volume, mute and headphone state
|
||||
// Get volume and mute state
|
||||
m_volume = 100;
|
||||
m_muted = false;
|
||||
m_headphones = false;
|
||||
|
||||
try {
|
||||
if (m_pulseaudio) {
|
||||
|
@ -113,10 +111,8 @@ namespace modules {
|
|||
bool pulseaudio_module::build(builder* builder, const string& tag) const {
|
||||
if (tag == TAG_BAR_VOLUME) {
|
||||
builder->node(m_bar_volume->output(m_volume));
|
||||
} else if (tag == TAG_RAMP_VOLUME && (!m_headphones || !*m_ramp_headphones)) {
|
||||
} else if (tag == TAG_RAMP_VOLUME) {
|
||||
builder->node(m_ramp_volume->get_by_percentage(m_volume));
|
||||
} else if (tag == TAG_RAMP_VOLUME && m_headphones && *m_ramp_headphones) {
|
||||
builder->node(m_ramp_headphones->get_by_percentage(m_volume));
|
||||
} else if (tag == TAG_LABEL_VOLUME) {
|
||||
builder->node(m_label_volume);
|
||||
} else if (tag == TAG_LABEL_MUTED) {
|
||||
|
|
Loading…
Reference in New Issue