1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2025-04-14 17:33:17 -04:00

fix(alsa): Add missing internal/volume alias.

This commit is contained in:
Chase Geigle 2018-09-03 14:06:53 -05:00
parent ce6ac7869e
commit 0e08f47c5c
No known key found for this signature in database
GPG key ID: 1020EF3A7626F7DC
4 changed files with 16 additions and 10 deletions

View file

@ -7,7 +7,7 @@ POLYBAR_NS
namespace modules {
using factory_function = module_interface* (*)(const bar_settings&, string);
using factory_function = module_interface* (*)(const bar_settings&, string, const logger&);
using factory_map = std::unordered_map<string, factory_function>;
factory_map& get_factory_map();
@ -19,13 +19,13 @@ namespace modules {
}
};
module_interface* make_module(string&& name, const bar_settings& bar, string module_name);
module_interface* make_module(string&& name, const bar_settings& bar, string module_name, const logger& m_log);
} // namespace modules
#define POLYBAR_MODULE(MODULE_TYPE, MODULE_NAME) \
module_interface* MODULE_TYPE##_create(const bar_settings& bar, std::string module_name) { \
return new MODULE_TYPE(bar, std::move(module_name)); \
} \
#define POLYBAR_MODULE(MODULE_TYPE, MODULE_NAME) \
module_interface* MODULE_TYPE##_create(const bar_settings& bar, std::string module_name, const logger&) { \
return new MODULE_TYPE(bar, std::move(module_name)); \
} \
module_registration<MODULE_TYPE> MODULE_TYPE##_registration(MODULE_NAME, &MODULE_TYPE##_create)
POLYBAR_NS_END

View file

@ -113,7 +113,7 @@ controller::controller(connection& conn, signal_emitter& emitter, const logger&
throw application_error("Inter-process messaging needs to be enabled");
}
m_modules[align].emplace_back(modules::make_module(move(type), m_bar->settings(), module_name));
m_modules[align].emplace_back(modules::make_module(move(type), m_bar->settings(), module_name, m_log));
created_modules++;
} catch (const runtime_error& err) {
m_log.err("Disabling module \"%s\" (reason: %s)", module_name, err.what());

View file

@ -1,10 +1,10 @@
#include "modules/alsa.hpp"
#include "adapters/alsa/control.hpp"
#include "adapters/alsa/generic.hpp"
#include "adapters/alsa/mixer.hpp"
#include "drawtypes/label.hpp"
#include "drawtypes/progressbar.hpp"
#include "drawtypes/ramp.hpp"
#include "modules/alsa.hpp"
#include "modules/meta/factory.hpp"
#include "utils/math.hpp"
@ -21,6 +21,12 @@ namespace modules {
POLYBAR_MODULE(alsa_module, "internal/alsa");
module_interface* volume_module_create(const bar_settings& bar, std::string module_name, const logger& m_log) {
m_log.warn("internal/volume is deprecated, use internal/alsa instead");
return alsa_module_create(bar, std::move(module_name), m_log);
}
module_registration<alsa_module> volume_module_registration("internal/volume", &volume_module_create);
alsa_module::alsa_module(const bar_settings& bar, string name_) : event_module<alsa_module>(bar, move(name_)) {
// Load configuration values
m_mapped = m_conf.get(name(), "mapped", m_mapped);

View file

@ -9,11 +9,11 @@ namespace modules {
return fmap;
}
module_interface* make_module(string&& name, const bar_settings& bar, string module_name) {
module_interface* make_module(string&& name, const bar_settings& bar, string module_name, const logger& m_log) {
const auto& fmap = get_factory_map();
auto it = fmap.find(name);
if (it != fmap.end()) {
return it->second(bar, move(module_name));
return it->second(bar, move(module_name), m_log);
} else {
throw application_error("Unknown module: " + name);
}