MCPcopy Create free account
hub / github.com/Alexays/Waybar / getPulseIcon

Method getPulseIcon

src/modules/pulseaudio.cpp:44–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42};
43
44const std::vector<std::string> waybar::modules::Pulseaudio::getPulseIcon() const {
45 std::vector<std::string> res;
46 auto sink_muted = backend->getSinkMuted();
47 if (sink_muted) {
48 res.emplace_back(backend->getCurrentSinkName() + "-muted");
49 }
50 res.push_back(backend->getCurrentSinkName());
51 res.push_back(backend->getDefaultSourceName());
52 std::string nameLC = backend->getSinkPortName() + backend->getFormFactor();
53 std::transform(nameLC.begin(), nameLC.end(), nameLC.begin(), ::tolower);
54 for (auto const& port : ports) {
55 if (nameLC.find(port) != std::string::npos) {
56 if (sink_muted) {
57 res.emplace_back(port + "-muted");
58 }
59 res.push_back(port);
60 break;
61 }
62 }
63 if (sink_muted) {
64 res.emplace_back("default-muted");
65 }
66 return res;
67}
68
69auto waybar::modules::Pulseaudio::update() -> void {
70 auto format = format_;

Callers

nothing calls this directly

Calls 7

getSinkMutedMethod · 0.80
getCurrentSinkNameMethod · 0.80
getDefaultSourceNameMethod · 0.80
getSinkPortNameMethod · 0.80
getFormFactorMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected