From 8acedeef87d7be4597ed31e8f4c708eb9df34993 Mon Sep 17 00:00:00 2001 From: patrick96 Date: Fri, 15 May 2020 20:45:38 +0200 Subject: [PATCH] modules: Fix resolving of type of disabled modules --- include/modules/meta/factory.hpp | 2 +- include/modules/unsupported.hpp | 1 + src/components/controller.cpp | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/modules/meta/factory.hpp b/include/modules/meta/factory.hpp index 750e0427..33deb885 100644 --- a/include/modules/meta/factory.hpp +++ b/include/modules/meta/factory.hpp @@ -73,7 +73,7 @@ namespace { } else if (name == mpd_module::TYPE) { return new mpd_module(bar, move(module_name)); } 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)); } else if (name == alsa_module::TYPE) { return new alsa_module(bar, move(module_name)); diff --git a/include/modules/unsupported.hpp b/include/modules/unsupported.hpp index 6b3ee61c..f345717d 100644 --- a/include/modules/unsupported.hpp +++ b/include/modules/unsupported.hpp @@ -14,6 +14,7 @@ namespace modules { MODULE_NAME(const bar_settings, string) { \ throw application_error("No built-in support for '" + string{MODULE_TYPE} + "'"); \ } \ + static constexpr auto TYPE = MODULE_TYPE; \ string type() const { \ return ""; \ } \ diff --git a/src/components/controller.cpp b/src/components/controller.cpp index fe7099ac..3b3e01dd 100644 --- a/src/components/controller.cpp +++ b/src/components/controller.cpp @@ -457,17 +457,24 @@ void controller::process_inputdata() { const std::map> legacy_actions{ A_MAP("datetoggle", date_module, EVENT_TOGGLE), +#if ENABLE_ALSA A_MAP("volup", alsa_module, EVENT_INC), A_MAP("voldown", alsa_module, EVENT_DEC), A_MAP("volmute", alsa_module, EVENT_TOGGLE), +#endif +#if ENABLE_PULSEAUDIO A_MAP("pa_volup", pulseaudio_module, EVENT_INC), A_MAP("pa_voldown", pulseaudio_module, EVENT_DEC), A_MAP("pa_volmute", pulseaudio_module, EVENT_TOGGLE), +#endif A_MAP("xbacklight+", xbacklight_module, EVENT_INC), A_MAP("xbacklight-", xbacklight_module, EVENT_DEC), A_MAP("backlight+", backlight_module, EVENT_INC), A_MAP("backlight-", backlight_module, EVENT_DEC), +#if ENABLE_XKEYBOARD A_MAP("xkeyboard/switch", xkeyboard_module, EVENT_SWITCH), +#endif +#if ENABLE_MPD A_MAP("mpdplay", mpd_module, EVENT_PLAY), A_MAP("mpdpause", mpd_module, EVENT_PAUSE), A_MAP("mpdstop", mpd_module, EVENT_STOP), @@ -479,6 +486,7 @@ void controller::process_inputdata() { A_MAP("mpdconsume", mpd_module, EVENT_CONSUME), // Has data A_MAP("mpdseek", mpd_module, EVENT_SEEK), +#endif // Has data A_MAP("xworkspaces-focus=", xworkspaces_module, EVENT_FOCUS), 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-desknext", bspwm_module, EVENT_NEXT), A_MAP("bspwm-deskprev", bspwm_module, EVENT_PREV), +#if ENABLE_I3 // Has data A_MAP("i3wm-wsfocus-", i3_module, EVENT_FOCUS), A_MAP("i3wm-wsnext", i3_module, EVENT_NEXT), A_MAP("i3wm-wsprev", i3_module, EVENT_PREV), +#endif // Has data A_MAP("menu-open-", menu_module, EVENT_OPEN), A_MAP("menu-close", menu_module, EVENT_CLOSE),