modules: Fix resolving of type of disabled modules

This commit is contained in:
patrick96 2020-05-15 20:45:38 +02:00 committed by Patrick Ziegler
parent 002112df64
commit 8acedeef87
3 changed files with 12 additions and 1 deletions

View File

@ -73,7 +73,7 @@ namespace {
} else if (name == mpd_module::TYPE) { } else if (name == mpd_module::TYPE) {
return new mpd_module(bar, move(module_name)); return new mpd_module(bar, move(module_name));
} else if (name == "internal/volume") { } else if (name == "internal/volume") {
m_log.warn("internal/volume is deprecated, use %s instead", alsa_module::TYPE); m_log.warn("internal/volume is deprecated, use %s instead", string(alsa_module::TYPE));
return new alsa_module(bar, move(module_name)); return new alsa_module(bar, move(module_name));
} else if (name == alsa_module::TYPE) { } else if (name == alsa_module::TYPE) {
return new alsa_module(bar, move(module_name)); return new alsa_module(bar, move(module_name));

View File

@ -14,6 +14,7 @@ namespace modules {
MODULE_NAME(const bar_settings, string) { \ MODULE_NAME(const bar_settings, string) { \
throw application_error("No built-in support for '" + string{MODULE_TYPE} + "'"); \ throw application_error("No built-in support for '" + string{MODULE_TYPE} + "'"); \
} \ } \
static constexpr auto TYPE = MODULE_TYPE; \
string type() const { \ string type() const { \
return ""; \ return ""; \
} \ } \

View File

@ -457,17 +457,24 @@ void controller::process_inputdata() {
const std::map<string, std::pair<string, const string>> legacy_actions{ const std::map<string, std::pair<string, const string>> legacy_actions{
A_MAP("datetoggle", date_module, EVENT_TOGGLE), A_MAP("datetoggle", date_module, EVENT_TOGGLE),
#if ENABLE_ALSA
A_MAP("volup", alsa_module, EVENT_INC), A_MAP("volup", alsa_module, EVENT_INC),
A_MAP("voldown", alsa_module, EVENT_DEC), A_MAP("voldown", alsa_module, EVENT_DEC),
A_MAP("volmute", alsa_module, EVENT_TOGGLE), A_MAP("volmute", alsa_module, EVENT_TOGGLE),
#endif
#if ENABLE_PULSEAUDIO
A_MAP("pa_volup", pulseaudio_module, EVENT_INC), A_MAP("pa_volup", pulseaudio_module, EVENT_INC),
A_MAP("pa_voldown", pulseaudio_module, EVENT_DEC), A_MAP("pa_voldown", pulseaudio_module, EVENT_DEC),
A_MAP("pa_volmute", pulseaudio_module, EVENT_TOGGLE), A_MAP("pa_volmute", pulseaudio_module, EVENT_TOGGLE),
#endif
A_MAP("xbacklight+", xbacklight_module, EVENT_INC), A_MAP("xbacklight+", xbacklight_module, EVENT_INC),
A_MAP("xbacklight-", xbacklight_module, EVENT_DEC), A_MAP("xbacklight-", xbacklight_module, EVENT_DEC),
A_MAP("backlight+", backlight_module, EVENT_INC), A_MAP("backlight+", backlight_module, EVENT_INC),
A_MAP("backlight-", backlight_module, EVENT_DEC), A_MAP("backlight-", backlight_module, EVENT_DEC),
#if ENABLE_XKEYBOARD
A_MAP("xkeyboard/switch", xkeyboard_module, EVENT_SWITCH), A_MAP("xkeyboard/switch", xkeyboard_module, EVENT_SWITCH),
#endif
#if ENABLE_MPD
A_MAP("mpdplay", mpd_module, EVENT_PLAY), A_MAP("mpdplay", mpd_module, EVENT_PLAY),
A_MAP("mpdpause", mpd_module, EVENT_PAUSE), A_MAP("mpdpause", mpd_module, EVENT_PAUSE),
A_MAP("mpdstop", mpd_module, EVENT_STOP), A_MAP("mpdstop", mpd_module, EVENT_STOP),
@ -479,6 +486,7 @@ void controller::process_inputdata() {
A_MAP("mpdconsume", mpd_module, EVENT_CONSUME), A_MAP("mpdconsume", mpd_module, EVENT_CONSUME),
// Has data // Has data
A_MAP("mpdseek", mpd_module, EVENT_SEEK), A_MAP("mpdseek", mpd_module, EVENT_SEEK),
#endif
// Has data // Has data
A_MAP("xworkspaces-focus=", xworkspaces_module, EVENT_FOCUS), A_MAP("xworkspaces-focus=", xworkspaces_module, EVENT_FOCUS),
A_MAP("xworkspaces-next", xworkspaces_module, EVENT_NEXT), A_MAP("xworkspaces-next", xworkspaces_module, EVENT_NEXT),
@ -487,10 +495,12 @@ void controller::process_inputdata() {
A_MAP("bspwm-deskfocus", bspwm_module, EVENT_FOCUS), A_MAP("bspwm-deskfocus", bspwm_module, EVENT_FOCUS),
A_MAP("bspwm-desknext", bspwm_module, EVENT_NEXT), A_MAP("bspwm-desknext", bspwm_module, EVENT_NEXT),
A_MAP("bspwm-deskprev", bspwm_module, EVENT_PREV), A_MAP("bspwm-deskprev", bspwm_module, EVENT_PREV),
#if ENABLE_I3
// Has data // Has data
A_MAP("i3wm-wsfocus-", i3_module, EVENT_FOCUS), A_MAP("i3wm-wsfocus-", i3_module, EVENT_FOCUS),
A_MAP("i3wm-wsnext", i3_module, EVENT_NEXT), A_MAP("i3wm-wsnext", i3_module, EVENT_NEXT),
A_MAP("i3wm-wsprev", i3_module, EVENT_PREV), A_MAP("i3wm-wsprev", i3_module, EVENT_PREV),
#endif
// Has data // Has data
A_MAP("menu-open-", menu_module, EVENT_OPEN), A_MAP("menu-open-", menu_module, EVENT_OPEN),
A_MAP("menu-close", menu_module, EVENT_CLOSE), A_MAP("menu-close", menu_module, EVENT_CLOSE),