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 m_headphones{false}; atomic 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, public input_handler { + class backlight_module : public inotify_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 = ""; 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 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 -#include #include +#include +#include + +#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 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{""}; vector> 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{"