The pulseaudio/slider module had partial support for a "target" config
option but changeVolume() in the audio backend was hardcoded to only
modify sink volume. This adds full source volume control:
- Add AudioTarget enum (Sink/Source) to audio_backend
- Extend changeVolume() overloads with AudioTarget parameter
- Store and use pa_cvolume for source (with mono channel default)
- Add sourceVolumeModifyCb for source volume change confirmation
- Add "target" config option to the pulseaudio module for scroll control
- Document "target" in both pulseaudio and pulseaudio-slider man pages
Usage:
"pulseaudio/slider#in": { "target": "source" }
"pulseaudio#in": { "target": "source" }
29 lines
612 B
C++
29 lines
612 B
C++
#pragma once
|
|
|
|
#include <fmt/format.h>
|
|
|
|
#include <algorithm>
|
|
#include <array>
|
|
#include <memory>
|
|
|
|
#include "ALabel.hpp"
|
|
#include "util/audio_backend.hpp"
|
|
|
|
namespace waybar::modules {
|
|
|
|
class Pulseaudio : public ALabel {
|
|
public:
|
|
Pulseaudio(const std::string&, const Json::Value&);
|
|
virtual ~Pulseaudio() = default;
|
|
auto update() -> void override;
|
|
|
|
private:
|
|
bool handleScroll(GdkEventScroll* e) override;
|
|
const std::vector<std::string> getPulseIcon() const;
|
|
|
|
std::shared_ptr<util::AudioBackend> backend = nullptr;
|
|
util::AudioTarget target = util::AudioTarget::Sink;
|
|
};
|
|
|
|
} // namespace waybar::modules
|