diff --git a/include/modules/alsa.hpp b/include/modules/alsa.hpp index eae9cefb..2b3f52ca 100644 --- a/include/modules/alsa.hpp +++ b/include/modules/alsa.hpp @@ -1,7 +1,7 @@ #pragma once -#include "settings.hpp" #include "modules/meta/event_module.hpp" +#include "settings.hpp" POLYBAR_NS @@ -9,7 +9,7 @@ POLYBAR_NS namespace alsa { class mixer; class control; -} +} // namespace alsa namespace modules { enum class mixer { NONE = 0, MASTER, SPEAKER, HEADPHONE }; @@ -29,6 +29,8 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/alsa"; + protected: bool input(string&& cmd); @@ -62,6 +64,6 @@ namespace modules { atomic<bool> m_headphones{false}; atomic<int> m_volume{0}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/backlight.hpp b/include/modules/backlight.hpp index b62220df..751735c8 100644 --- a/include/modules/backlight.hpp +++ b/include/modules/backlight.hpp @@ -2,13 +2,12 @@ #include "components/config.hpp" #include "modules/meta/inotify_module.hpp" -#include "modules/meta/input_handler.hpp" #include "settings.hpp" POLYBAR_NS namespace modules { - class backlight_module : public inotify_module<backlight_module>, public input_handler { + class backlight_module : public inotify_module<backlight_module> { public: struct brightness_handle { void filepath(const string& path); @@ -27,6 +26,8 @@ namespace modules { bool on_event(inotify_event* event); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/backlight"; + protected: bool input(string&& cmd); diff --git a/include/modules/battery.hpp b/include/modules/battery.hpp index 1fc11b47..07fba087 100644 --- a/include/modules/battery.hpp +++ b/include/modules/battery.hpp @@ -54,6 +54,8 @@ namespace modules { string get_format() const; bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/battery"; + protected: state current_state(); int current_percentage(); @@ -106,6 +108,6 @@ namespace modules { chrono::system_clock::time_point m_lastpoll; thread m_subthread; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/bspwm.hpp b/include/modules/bspwm.hpp index 2f739088..be97cf8b 100644 --- a/include/modules/bspwm.hpp +++ b/include/modules/bspwm.hpp @@ -47,6 +47,8 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/bspwm"; + protected: bool input(string&& cmd); @@ -91,6 +93,6 @@ namespace modules { // used while formatting output size_t m_index{0U}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/counter.hpp b/include/modules/counter.hpp index 4c498e93..a386185d 100644 --- a/include/modules/counter.hpp +++ b/include/modules/counter.hpp @@ -12,11 +12,13 @@ namespace modules { bool update(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/counter"; + private: static constexpr auto TAG_COUNTER = "<counter>"; int m_counter{0}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/cpu.hpp b/include/modules/cpu.hpp index 40e9c87d..003c9fb2 100644 --- a/include/modules/cpu.hpp +++ b/include/modules/cpu.hpp @@ -1,7 +1,7 @@ #pragma once -#include "settings.hpp" #include "modules/meta/timer_module.hpp" +#include "settings.hpp" POLYBAR_NS @@ -24,6 +24,8 @@ namespace modules { bool update(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/cpu"; + protected: bool read_values(); float get_load(size_t core) const; @@ -46,6 +48,6 @@ namespace modules { float m_total = 0; vector<float> m_load; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/date.hpp b/include/modules/date.hpp index 3e42fb8d..6639b759 100644 --- a/include/modules/date.hpp +++ b/include/modules/date.hpp @@ -1,10 +1,10 @@ #pragma once -#include "modules/meta/timer_module.hpp" - -#include <iostream> -#include <iomanip> #include <ctime> +#include <iomanip> +#include <iostream> + +#include "modules/meta/timer_module.hpp" POLYBAR_NS @@ -16,6 +16,8 @@ namespace modules { bool update(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/date"; + protected: bool input(string&& cmd); @@ -41,6 +43,6 @@ namespace modules { std::atomic<bool> m_toggled{false}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/fs.hpp b/include/modules/fs.hpp index 0ee56721..115dddcd 100644 --- a/include/modules/fs.hpp +++ b/include/modules/fs.hpp @@ -1,8 +1,8 @@ #pragma once #include "components/config.hpp" -#include "settings.hpp" #include "modules/meta/timer_module.hpp" +#include "settings.hpp" POLYBAR_NS @@ -42,6 +42,8 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/fs"; + private: static constexpr auto FORMAT_MOUNTED = "format-mounted"; static constexpr auto FORMAT_UNMOUNTED = "format-unmounted"; @@ -66,6 +68,6 @@ namespace modules { // used while formatting output size_t m_index{0_z}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/github.hpp b/include/modules/github.hpp index 0eab224e..a45701f5 100644 --- a/include/modules/github.hpp +++ b/include/modules/github.hpp @@ -18,6 +18,8 @@ namespace modules { bool build(builder* builder, const string& tag) const; string get_format() const; + static constexpr auto TYPE = "internal/github"; + private: void update_label(int); int get_number_of_notification(); diff --git a/include/modules/i3.hpp b/include/modules/i3.hpp index 1559377a..8139cf12 100644 --- a/include/modules/i3.hpp +++ b/include/modules/i3.hpp @@ -51,6 +51,8 @@ namespace modules { bool update(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/i3"; + protected: bool input(string&& cmd); diff --git a/include/modules/ipc.hpp b/include/modules/ipc.hpp index bb681a62..63e4fe70 100644 --- a/include/modules/ipc.hpp +++ b/include/modules/ipc.hpp @@ -32,6 +32,8 @@ namespace modules { bool build(builder* builder, const string& tag) const; void on_message(const string& message); + static constexpr auto TYPE = "custom/ipc"; + private: static constexpr const char* TAG_OUTPUT{"<output>"}; vector<unique_ptr<hook>> m_hooks; @@ -39,6 +41,6 @@ namespace modules { string m_output; size_t m_initial; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/memory.hpp b/include/modules/memory.hpp index 5f06d0ab..e85624a1 100644 --- a/include/modules/memory.hpp +++ b/include/modules/memory.hpp @@ -15,6 +15,8 @@ namespace modules { bool update(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/memory"; + private: static constexpr const char* TAG_LABEL{"<label>"}; static constexpr const char* TAG_BAR_USED{"<bar-used>"}; @@ -40,6 +42,6 @@ namespace modules { ramp_t m_ramp_swapused; ramp_t m_ramp_swapfree; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/menu.hpp b/include/modules/menu.hpp index 2706c8d5..c3599126 100644 --- a/include/modules/menu.hpp +++ b/include/modules/menu.hpp @@ -22,6 +22,8 @@ namespace modules { bool build(builder* builder, const string& tag) const; void update() {} + static constexpr auto TYPE = "custom/menu"; + protected: bool input(string&& cmd); @@ -42,6 +44,6 @@ namespace modules { std::atomic<int> m_level{-1}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/meta/base.hpp b/include/modules/meta/base.hpp index 05e40a48..e75821e9 100644 --- a/include/modules/meta/base.hpp +++ b/include/modules/meta/base.hpp @@ -22,7 +22,6 @@ using std::map; #define DEFAULT_FORMAT "format" -#define DEFINE_MODULE(name, type) struct name : public type<name> #define CONST_MOD(name) static_cast<name const&>(*this) #define CAST_MOD(name) static_cast<name*>(this) @@ -101,6 +100,11 @@ namespace modules { public: virtual ~module_interface() {} + /** + * The type users have to specify in the module section `type` key + */ + virtual string type() const = 0; + /** * Module name w/o 'module/' prefix */ @@ -123,6 +127,8 @@ namespace modules { module(const bar_settings bar, string name); ~module() noexcept; + string type() const; + string name_raw() const; string name() const; bool running() const; @@ -134,6 +140,8 @@ namespace modules { bool input(string&& cmd); string input_handler_name() const; + static constexpr auto TYPE = ""; + protected: void broadcast(); void idle(); @@ -155,8 +163,8 @@ namespace modules { mutex m_sleeplock; std::condition_variable m_sleephandler; - string m_name; - string m_name_raw; + const string m_name; + const string m_name_raw; unique_ptr<builder> m_builder; unique_ptr<module_formatter> m_formatter; vector<thread> m_threads; diff --git a/include/modules/meta/base.inl b/include/modules/meta/base.inl index 3213fac7..a9058618 100644 --- a/include/modules/meta/base.inl +++ b/include/modules/meta/base.inl @@ -46,6 +46,11 @@ namespace modules { return m_name_raw; } + template <typename Impl> + string module<Impl>::type() const { + return string(CONST_MOD(Impl).TYPE); + } + template <typename Impl> bool module<Impl>::running() const { return static_cast<bool>(m_enabled); diff --git a/include/modules/meta/factory.hpp b/include/modules/meta/factory.hpp index bbe3c22b..750e0427 100644 --- a/include/modules/meta/factory.hpp +++ b/include/modules/meta/factory.hpp @@ -1,7 +1,6 @@ #pragma once #include "common.hpp" - #include "modules/backlight.hpp" #include "modules/battery.hpp" #include "modules/bspwm.hpp" @@ -43,9 +42,7 @@ #if ENABLE_XKEYBOARD #include "modules/xkeyboard.hpp" #endif -#if not(ENABLE_I3 && ENABLE_MPD && ENABLE_NETWORK && ENABLE_ALSA && ENABLE_PULSEAUDIO && ENABLE_CURL && ENABLE_XKEYBOARD) #include "modules/unsupported.hpp" -#endif POLYBAR_NS @@ -53,63 +50,63 @@ using namespace modules; namespace { module_interface* make_module(string&& name, const bar_settings& bar, string module_name, const logger& m_log) { - if (name == "internal/counter") { + if (name == counter_module::TYPE) { return new counter_module(bar, move(module_name)); - } else if (name == "internal/backlight") { + } else if (name == backlight_module::TYPE) { return new backlight_module(bar, move(module_name)); - } else if (name == "internal/battery") { + } else if (name == battery_module::TYPE) { return new battery_module(bar, move(module_name)); - } else if (name == "internal/bspwm") { + } else if (name == bspwm_module::TYPE) { return new bspwm_module(bar, move(module_name)); - } else if (name == "internal/cpu") { + } else if (name == cpu_module::TYPE) { return new cpu_module(bar, move(module_name)); - } else if (name == "internal/date") { + } else if (name == date_module::TYPE) { return new date_module(bar, move(module_name)); - } else if (name == "internal/github") { + } else if (name == github_module::TYPE) { return new github_module(bar, move(module_name)); - } else if (name == "internal/fs") { + } else if (name == fs_module::TYPE) { return new fs_module(bar, move(module_name)); - } else if (name == "internal/memory") { + } else if (name == memory_module::TYPE) { return new memory_module(bar, move(module_name)); - } else if (name == "internal/i3") { + } else if (name == i3_module::TYPE) { return new i3_module(bar, move(module_name)); - } else if (name == "internal/mpd") { + } 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 internal/alsa instead"); + m_log.warn("internal/volume is deprecated, use %s instead", alsa_module::TYPE); return new alsa_module(bar, move(module_name)); - } else if (name == "internal/alsa") { + } else if (name == alsa_module::TYPE) { return new alsa_module(bar, move(module_name)); - } else if (name == "internal/pulseaudio") { + } else if (name == pulseaudio_module::TYPE) { return new pulseaudio_module(bar, move(module_name)); - } else if (name == "internal/network") { + } else if (name == network_module::TYPE) { return new network_module(bar, move(module_name)); #if DEBUG - } else if (name == "internal/systray") { + } else if (name == systray_module::TYPE) { return new systray_module(bar, move(module_name)); #endif - } else if (name == "internal/temperature") { + } else if (name == temperature_module::TYPE) { return new temperature_module(bar, move(module_name)); - } else if (name == "internal/xbacklight") { + } else if (name == xbacklight_module::TYPE) { return new xbacklight_module(bar, move(module_name)); - } else if (name == "internal/xkeyboard") { + } else if (name == xkeyboard_module::TYPE) { return new xkeyboard_module(bar, move(module_name)); - } else if (name == "internal/xwindow") { + } else if (name == xwindow_module::TYPE) { return new xwindow_module(bar, move(module_name)); - } else if (name == "internal/xworkspaces") { + } else if (name == xworkspaces_module::TYPE) { return new xworkspaces_module(bar, move(module_name)); - } else if (name == "custom/text") { + } else if (name == text_module::TYPE) { return new text_module(bar, move(module_name)); - } else if (name == "custom/script") { + } else if (name == script_module::TYPE) { return new script_module(bar, move(module_name)); - } else if (name == "custom/menu") { + } else if (name == menu_module::TYPE) { return new menu_module(bar, move(module_name)); - } else if (name == "custom/ipc") { + } else if (name == ipc_module::TYPE) { return new ipc_module(bar, move(module_name)); } else { throw application_error("Unknown module: " + name); } } -} +} // namespace POLYBAR_NS_END diff --git a/include/modules/mpd.hpp b/include/modules/mpd.hpp index 2979c628..0059c628 100644 --- a/include/modules/mpd.hpp +++ b/include/modules/mpd.hpp @@ -2,9 +2,9 @@ #include <chrono> -#include "utils/env.hpp" #include "adapters/mpd.hpp" #include "modules/meta/event_module.hpp" +#include "utils/env.hpp" POLYBAR_NS @@ -24,6 +24,8 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/mpd"; + protected: bool input(string&& cmd); @@ -103,6 +105,6 @@ namespace modules { string m_toggle_on_color; string m_toggle_off_color; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/network.hpp b/include/modules/network.hpp index 87d0c44c..62ba08f7 100644 --- a/include/modules/network.hpp +++ b/include/modules/network.hpp @@ -18,6 +18,8 @@ namespace modules { string get_format() const; bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/network"; + protected: void subthread_routine(); @@ -53,6 +55,6 @@ namespace modules { bool m_accumulate{false}; bool m_unknown_up{false}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/pulseaudio.hpp b/include/modules/pulseaudio.hpp index 083e11a0..838fb927 100644 --- a/include/modules/pulseaudio.hpp +++ b/include/modules/pulseaudio.hpp @@ -1,7 +1,7 @@ #pragma once -#include "settings.hpp" #include "modules/meta/event_module.hpp" +#include "settings.hpp" POLYBAR_NS @@ -22,6 +22,8 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/pulseaudio"; + protected: bool input(string&& cmd); @@ -51,6 +53,6 @@ namespace modules { atomic<int> m_volume{0}; atomic<double> m_decibels{0}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/script.hpp b/include/modules/script.hpp index 7d46d4e3..2a62d3a0 100644 --- a/include/modules/script.hpp +++ b/include/modules/script.hpp @@ -18,6 +18,8 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "custom/script"; + protected: chrono::duration<double> process(const mutex_wrapper<function<chrono::duration<double>()>>& handler) const; bool check_condition(); @@ -44,6 +46,6 @@ namespace modules { bool m_stopping{false}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/systray.hpp b/include/modules/systray.hpp index a1ff57ed..0678befa 100644 --- a/include/modules/systray.hpp +++ b/include/modules/systray.hpp @@ -19,6 +19,8 @@ namespace modules { void update(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/systray"; + protected: bool input(string&& cmd); @@ -33,7 +35,7 @@ namespace modules { bool m_hidden{false}; }; -} +} // namespace modules POLYBAR_NS_END #endif diff --git a/include/modules/temperature.hpp b/include/modules/temperature.hpp index aa0c0a08..8bc0098a 100644 --- a/include/modules/temperature.hpp +++ b/include/modules/temperature.hpp @@ -2,8 +2,8 @@ #include <istream> -#include "settings.hpp" #include "modules/meta/timer_module.hpp" +#include "settings.hpp" POLYBAR_NS @@ -18,6 +18,8 @@ namespace modules { string get_format() const; bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/temperature"; + private: static constexpr auto TAG_LABEL = "<label>"; static constexpr auto TAG_LABEL_WARN = "<label-warn>"; @@ -39,6 +41,6 @@ namespace modules { // Whether or not to show units with the %temperature-X% tokens bool m_units{true}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/text.hpp b/include/modules/text.hpp index 6a6ab901..305185e1 100644 --- a/include/modules/text.hpp +++ b/include/modules/text.hpp @@ -12,7 +12,9 @@ namespace modules { void update() {} string get_format() const; string get_output(); + + static constexpr auto TYPE = "custom/text"; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/unsupported.hpp b/include/modules/unsupported.hpp index 5fc75ca1..6b3ee61c 100644 --- a/include/modules/unsupported.hpp +++ b/include/modules/unsupported.hpp @@ -1,7 +1,4 @@ #pragma once -#if ENABLE_I3 && ENABLE_MPD && ENABLE_NETWORK && ENABLE_ALSA && ENABLE_PULSEAUDIO && ENABLE_CURL && ENABLE_XKEYBOARD -#error "Support has been enabled for all optional modules" -#endif #include "modules/meta/base.hpp" #include "modules/meta/base.inl" @@ -17,6 +14,9 @@ namespace modules { MODULE_NAME(const bar_settings, string) { \ throw application_error("No built-in support for '" + string{MODULE_TYPE} + "'"); \ } \ + string type() const { \ + return ""; \ + } \ string name_raw() const { \ return ""; \ } \ @@ -61,6 +61,6 @@ namespace modules { #if not ENABLE_XKEYBOARD DEFINE_UNSUPPORTED_MODULE(xkeyboard_module, "internal/xkeyboard"); #endif -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/xbacklight.hpp b/include/modules/xbacklight.hpp index 9f393a01..469f6591 100644 --- a/include/modules/xbacklight.hpp +++ b/include/modules/xbacklight.hpp @@ -1,9 +1,9 @@ #pragma once #include "components/config.hpp" -#include "settings.hpp" #include "modules/meta/event_handler.hpp" #include "modules/meta/static_module.hpp" +#include "settings.hpp" #include "x11/extensions/randr.hpp" POLYBAR_NS @@ -21,11 +21,8 @@ namespace modules { * This module is a lot faster, it's more responsive and it will * be dormant until new values are reported. Inotify watches * are a bit random when it comes to proc-/sysfs. - * - * TODO: Implement backlight configuring using scroll events */ - class xbacklight_module : public static_module<xbacklight_module>, - public event_handler<evt::randr_notify> { + class xbacklight_module : public static_module<xbacklight_module>, public event_handler<evt::randr_notify> { public: explicit xbacklight_module(const bar_settings& bar, string name_); @@ -33,6 +30,8 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/xbacklight"; + protected: void handle(const evt::randr_notify& evt); bool input(string&& cmd); @@ -56,6 +55,6 @@ namespace modules { bool m_scroll{true}; std::atomic<int> m_percentage{0}; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/xkeyboard.hpp b/include/modules/xkeyboard.hpp index e5c6d1d9..e636681b 100644 --- a/include/modules/xkeyboard.hpp +++ b/include/modules/xkeyboard.hpp @@ -26,6 +26,8 @@ namespace modules { void update(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/xkeyboard"; + protected: bool query_keyboard(); bool blacklisted(const string& indicator_name); @@ -42,7 +44,7 @@ namespace modules { static constexpr const char* FORMAT_DEFAULT{"<label-layout> <label-indicator>"}; static constexpr const char* DEFAULT_LAYOUT_ICON{"layout-icon-default"}; static constexpr const char* DEFAULT_INDICATOR_ICON{"indicator-icon-default"}; - + static constexpr const char* EVENT_SWITCH{"xkeyboard/switch"}; connection& m_connection; @@ -63,6 +65,6 @@ namespace modules { iconset_t m_indicator_icons_on; iconset_t m_indicator_icons_off; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/xwindow.hpp b/include/modules/xwindow.hpp index 4378ed5b..506504ed 100644 --- a/include/modules/xwindow.hpp +++ b/include/modules/xwindow.hpp @@ -30,16 +30,14 @@ namespace modules { */ class xwindow_module : public static_module<xwindow_module>, public event_handler<evt::property_notify> { public: - enum class state { - NONE, - ACTIVE, - EMPTY - }; + enum class state { NONE, ACTIVE, EMPTY }; explicit xwindow_module(const bar_settings&, string); void update(bool force = false); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/xwindow"; + protected: void handle(const evt::property_notify& evt); @@ -51,6 +49,6 @@ namespace modules { map<state, label_t> m_statelabels; label_t m_label; }; -} +} // namespace modules POLYBAR_NS_END diff --git a/include/modules/xworkspaces.hpp b/include/modules/xworkspaces.hpp index 72a6aeb1..a425a1d7 100644 --- a/include/modules/xworkspaces.hpp +++ b/include/modules/xworkspaces.hpp @@ -50,8 +50,7 @@ namespace modules { /** * Module used to display EWMH desktops */ - class xworkspaces_module : public static_module<xworkspaces_module>, - public event_handler<evt::property_notify> { + class xworkspaces_module : public static_module<xworkspaces_module>, public event_handler<evt::property_notify> { public: explicit xworkspaces_module(const bar_settings& bar, string name_); @@ -59,6 +58,8 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; + static constexpr auto TYPE = "internal/xworkspaces"; + protected: void handle(const evt::property_notify& evt); diff --git a/src/components/controller.cpp b/src/components/controller.cpp index 795ec825..f752a04a 100644 --- a/src/components/controller.cpp +++ b/src/components/controller.cpp @@ -422,7 +422,7 @@ void controller::process_inputdata() { // Forwards the action to all input handlers that match the name for (auto&& handler : m_inputhandlers) { if (handler->input_handler_name() == handler_name) { - if(!handler->input(string{action})) { + if (!handler->input(string{action})) { m_log.warn("The '%s' module does not support the '%s' action.", handler_name, action); } @@ -432,9 +432,8 @@ void controller::process_inputdata() { if (num_delivered == 0) { m_log.err("There exists no input handler with name '%s' (input: %s)", handler_name, cmd); - } - else { - m_log.info("Delivered input to %d input handler%s", num_delivered, num_delivered > 1? "s": ""); + } else { + m_log.info("Delivered input to %d input handler%s", num_delivered, num_delivered > 1 ? "s" : ""); } return; @@ -600,7 +599,7 @@ size_t controller::setup_modules(alignment align) { try { auto type = m_conf.get("module/" + module_name, "type"); - if (type == "custom/ipc" && !m_ipc) { + if (type == ipc_module::TYPE && !m_ipc) { throw application_error("Inter-process messaging needs to be enabled"); } diff --git a/src/modules/date.cpp b/src/modules/date.cpp index dc381791..8d16ffd3 100644 --- a/src/modules/date.cpp +++ b/src/modules/date.cpp @@ -1,6 +1,6 @@ #include "modules/date.hpp" -#include "drawtypes/label.hpp" +#include "drawtypes/label.hpp" #include "modules/meta/base.inl" POLYBAR_NS @@ -93,6 +93,6 @@ namespace modules { wakeup(); return true; } -} +} // namespace modules POLYBAR_NS_END