diff --git a/build.sh b/build.sh index 3c8bae0a..11e24b56 100755 --- a/build.sh +++ b/build.sh @@ -40,7 +40,7 @@ function main read -r -p "$(msg "Include support for \"internal/i3\" (requires i3) ------------------- [Y/n]: ")" -n 1 p && echo [[ "${p^^}" != "Y" ]] && enable_i3="OFF" - read -r -p "$(msg "Include support for \"internal/volume\" (requires alsalib) ---------- [Y/n]: ")" -n 1 p && echo + read -r -p "$(msg "Include support for \"internal/alsa\" (requires alsalib) ---------- [Y/n]: ")" -n 1 p && echo [[ "${p^^}" != "Y" ]] && enable_alsa="OFF" read -r -p "$(msg "Include support for \"internal/pulseaudio\" (requires libpulse) ----- [Y/n]: ")" -n 1 p && echo [[ "${p^^}" != "Y" ]] && enable_pulseaudio="OFF" diff --git a/doc/config.cmake b/doc/config.cmake index f99fab72..9969767a 100644 --- a/doc/config.cmake +++ b/doc/config.cmake @@ -264,8 +264,8 @@ format-underline = #0a6cf5 label = %date% %time% -[module/volume] -type = internal/volume +[module/alsa] +type = internal/alsa format-volume = label-volume = VOL diff --git a/include/modules/volume.hpp b/include/modules/alsa.hpp similarity index 92% rename from include/modules/volume.hpp rename to include/modules/alsa.hpp index 8c86665f..4221f7eb 100644 --- a/include/modules/volume.hpp +++ b/include/modules/alsa.hpp @@ -19,9 +19,9 @@ namespace modules { using mixer_t = shared_ptr; using control_t = shared_ptr; - class volume_module : public event_module, public input_handler { + class alsa_module : public event_module, public input_handler { public: - explicit volume_module(const bar_settings&, string); + explicit alsa_module(const bar_settings&, string); void teardown(); bool has_event(); diff --git a/include/modules/meta/factory.hpp b/include/modules/meta/factory.hpp index f8a447e9..99dfcdff 100644 --- a/include/modules/meta/factory.hpp +++ b/include/modules/meta/factory.hpp @@ -32,7 +32,7 @@ #include "modules/network.hpp" #endif #if ENABLE_ALSA -#include "modules/volume.hpp" +#include "modules/alsa.hpp" #endif #if ENABLE_PULSEAUDIO #include "modules/pulseaudio.hpp" @@ -78,7 +78,7 @@ namespace { } else if (name == "internal/volume") { throw application_error("internal/volume is deprecated, use internal/alsa instead"); } else if (name == "internal/alsa") { - return new volume_module(bar, move(module_name)); + return new alsa_module(bar, move(module_name)); } else if (name == "internal/pulseaudio") { return new pulseaudio_module(bar, move(module_name)); } else if (name == "internal/network") { diff --git a/include/modules/unsupported.hpp b/include/modules/unsupported.hpp index 39822900..27f22aad 100644 --- a/include/modules/unsupported.hpp +++ b/include/modules/unsupported.hpp @@ -41,7 +41,7 @@ namespace modules { DEFINE_UNSUPPORTED_MODULE(network_module, "internal/network"); #endif #if not ENABLE_ALSA - DEFINE_UNSUPPORTED_MODULE(volume_module, "internal/volume"); + DEFINE_UNSUPPORTED_MODULE(alsa_module, "internal/alsa"); #endif #if not ENABLE_PULSEAUDIO DEFINE_UNSUPPORTED_MODULE(pulseaudio_module, "internal/pulseaudio"); diff --git a/src/modules/volume.cpp b/src/modules/alsa.cpp similarity index 95% rename from src/modules/volume.cpp rename to src/modules/alsa.cpp index 1ce45df6..3df04e32 100644 --- a/src/modules/volume.cpp +++ b/src/modules/alsa.cpp @@ -1,4 +1,4 @@ -#include "modules/volume.hpp" +#include "modules/alsa.hpp" #include "adapters/alsa/control.hpp" #include "adapters/alsa/generic.hpp" #include "adapters/alsa/mixer.hpp" @@ -16,9 +16,9 @@ POLYBAR_NS using namespace alsa; namespace modules { - template class module; + template class module; - volume_module::volume_module(const bar_settings& bar, string name_) : event_module(bar, move(name_)) { + alsa_module::alsa_module(const bar_settings& bar, string name_) : event_module(bar, move(name_)) { // Load configuration values m_mapped = m_conf.get(name(), "mapped", m_mapped); @@ -86,13 +86,13 @@ namespace modules { } } - void volume_module::teardown() { + void alsa_module::teardown() { m_mixer.clear(); m_ctrl.clear(); snd_config_update_free_global(); } - bool volume_module::has_event() { + bool alsa_module::has_event() { // Poll for mixer and control events try { if (m_mixer[mixer::MASTER] && m_mixer[mixer::MASTER]->wait(25)) { @@ -114,7 +114,7 @@ namespace modules { return false; } - bool volume_module::update() { + bool alsa_module::update() { // Consume pending events if (m_mixer[mixer::MASTER]) { m_mixer[mixer::MASTER]->process_events(); @@ -179,11 +179,11 @@ namespace modules { return true; } - string volume_module::get_format() const { + string alsa_module::get_format() const { return m_muted ? FORMAT_MUTED : FORMAT_VOLUME; } - string volume_module::get_output() { + string alsa_module::get_output() { // Get the module output early so that // the format prefix/suffix also gets wrapper // with the cmd handlers @@ -200,7 +200,7 @@ namespace modules { return m_builder->flush(); } - bool volume_module::build(builder* builder, const string& tag) const { + bool alsa_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)) { @@ -217,7 +217,7 @@ namespace modules { return true; } - bool volume_module::input(string&& cmd) { + bool alsa_module::input(string&& cmd) { if (!m_handle_events) { return false; } else if (cmd.compare(0, 3, EVENT_PREFIX) != 0) {