From f5169abde257a8085a6b0bcffd0d1fee793abadb Mon Sep 17 00:00:00 2001 From: dvermd <315743+dvermd@users.noreply.github.com> Date: Mon, 8 May 2023 19:36:12 +0200 Subject: [PATCH] Remove unsupported.hpp (#2956) * Remove unsupported.hpp * Rename names.hpp to types.hpp * Replace macro by function * Add missing cassert include in controller.cpp --- include/modules/alsa.hpp | 3 +- include/modules/backlight.hpp | 3 +- include/modules/battery.hpp | 3 +- include/modules/bspwm.hpp | 3 +- include/modules/counter.hpp | 3 +- include/modules/cpu.hpp | 3 +- include/modules/date.hpp | 3 +- include/modules/fs.hpp | 3 +- include/modules/github.hpp | 3 +- include/modules/i3.hpp | 3 +- include/modules/ipc.hpp | 3 +- include/modules/memory.hpp | 3 +- include/modules/menu.hpp | 3 +- include/modules/meta/all.hpp | 1 - include/modules/meta/types.hpp | 37 ++++++++++++++++++ include/modules/mpd.hpp | 3 +- include/modules/network.hpp | 3 +- include/modules/pulseaudio.hpp | 3 +- include/modules/script.hpp | 3 +- include/modules/temperature.hpp | 3 +- include/modules/text.hpp | 3 +- include/modules/tray.hpp | 3 +- include/modules/unsupported.hpp | 68 --------------------------------- include/modules/xbacklight.hpp | 3 +- include/modules/xkeyboard.hpp | 3 +- include/modules/xwindow.hpp | 3 +- include/modules/xworkspaces.hpp | 3 +- src/components/controller.cpp | 1 + src/modules/meta/factory.cpp | 42 +++++++++++++++++++- 29 files changed, 126 insertions(+), 95 deletions(-) create mode 100644 include/modules/meta/types.hpp delete mode 100644 include/modules/unsupported.hpp diff --git a/include/modules/alsa.hpp b/include/modules/alsa.hpp index 3a86da85..cb4e851f 100644 --- a/include/modules/alsa.hpp +++ b/include/modules/alsa.hpp @@ -1,6 +1,7 @@ #pragma once #include "modules/meta/event_module.hpp" +#include "modules/meta/types.hpp" #include "settings.hpp" POLYBAR_NS @@ -29,7 +30,7 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/alsa"; + static constexpr auto TYPE = ALSA_TYPE; static constexpr auto EVENT_INC = "inc"; static constexpr auto EVENT_DEC = "dec"; diff --git a/include/modules/backlight.hpp b/include/modules/backlight.hpp index f1db0fe7..02542505 100644 --- a/include/modules/backlight.hpp +++ b/include/modules/backlight.hpp @@ -2,6 +2,7 @@ #include "components/config.hpp" #include "modules/meta/inotify_module.hpp" +#include "modules/meta/types.hpp" #include "settings.hpp" POLYBAR_NS @@ -26,7 +27,7 @@ namespace modules { bool on_event(const inotify_event& event); bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/backlight"; + static constexpr auto TYPE = BACKLIGHT_TYPE; static constexpr const char* EVENT_INC = "inc"; static constexpr const char* EVENT_DEC = "dec"; diff --git a/include/modules/battery.hpp b/include/modules/battery.hpp index bd6ef788..0ee1fc31 100644 --- a/include/modules/battery.hpp +++ b/include/modules/battery.hpp @@ -2,6 +2,7 @@ #include "common.hpp" #include "modules/meta/inotify_module.hpp" +#include "modules/meta/types.hpp" POLYBAR_NS @@ -55,7 +56,7 @@ namespace modules { string get_format() const; bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/battery"; + static constexpr auto TYPE = BATTERY_TYPE; protected: state current_state(); diff --git a/include/modules/bspwm.hpp b/include/modules/bspwm.hpp index 9fb20ba6..f228b990 100644 --- a/include/modules/bspwm.hpp +++ b/include/modules/bspwm.hpp @@ -1,6 +1,7 @@ #pragma once #include "modules/meta/event_module.hpp" +#include "modules/meta/types.hpp" #include "utils/bspwm.hpp" POLYBAR_NS @@ -47,7 +48,7 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/bspwm"; + static constexpr auto TYPE = BSPWM_TYPE; static constexpr auto EVENT_FOCUS = "focus"; static constexpr auto EVENT_NEXT = "next"; diff --git a/include/modules/counter.hpp b/include/modules/counter.hpp index a92d98f6..a074282d 100644 --- a/include/modules/counter.hpp +++ b/include/modules/counter.hpp @@ -1,6 +1,7 @@ #pragma once #include "modules/meta/timer_module.hpp" +#include "modules/meta/types.hpp" POLYBAR_NS @@ -12,7 +13,7 @@ namespace modules { bool update(); bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/counter"; + static constexpr auto TYPE = COUNTER_TYPE; private: static constexpr auto TAG_COUNTER = ""; diff --git a/include/modules/cpu.hpp b/include/modules/cpu.hpp index fff25da0..8f11bacf 100644 --- a/include/modules/cpu.hpp +++ b/include/modules/cpu.hpp @@ -1,6 +1,7 @@ #pragma once #include "modules/meta/timer_module.hpp" +#include "modules/meta/types.hpp" #include "settings.hpp" POLYBAR_NS @@ -26,7 +27,7 @@ namespace modules { string get_format() const; bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/cpu"; + static constexpr auto TYPE = CPU_TYPE; protected: bool read_values(); diff --git a/include/modules/date.hpp b/include/modules/date.hpp index cd49d643..4d63a487 100644 --- a/include/modules/date.hpp +++ b/include/modules/date.hpp @@ -6,6 +6,7 @@ #include #include "modules/meta/timer_module.hpp" +#include "modules/meta/types.hpp" POLYBAR_NS @@ -17,7 +18,7 @@ namespace modules { bool update(); bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/date"; + static constexpr auto TYPE = DATE_TYPE; static constexpr auto EVENT_TOGGLE = "toggle"; diff --git a/include/modules/fs.hpp b/include/modules/fs.hpp index 5fb880d2..a97661e7 100644 --- a/include/modules/fs.hpp +++ b/include/modules/fs.hpp @@ -2,6 +2,7 @@ #include "components/config.hpp" #include "modules/meta/timer_module.hpp" +#include "modules/meta/types.hpp" #include "settings.hpp" POLYBAR_NS @@ -42,7 +43,7 @@ namespace modules { string get_output(); bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/fs"; + static constexpr auto TYPE = FS_TYPE; private: static constexpr auto FORMAT_MOUNTED = "format-mounted"; diff --git a/include/modules/github.hpp b/include/modules/github.hpp index e9a8d4c0..eeeeae7c 100644 --- a/include/modules/github.hpp +++ b/include/modules/github.hpp @@ -3,6 +3,7 @@ #include #include "modules/meta/timer_module.hpp" +#include "modules/meta/types.hpp" #include "settings.hpp" #include "utils/http.hpp" @@ -20,7 +21,7 @@ namespace modules { bool build(builder* builder, const string& tag) const; string get_format() const; - static constexpr auto TYPE = "internal/github"; + static constexpr auto TYPE = GITHUB_TYPE; private: void update_label(int); diff --git a/include/modules/i3.hpp b/include/modules/i3.hpp index 8cfb7170..480967ab 100644 --- a/include/modules/i3.hpp +++ b/include/modules/i3.hpp @@ -4,6 +4,7 @@ #include "components/config.hpp" #include "modules/meta/event_module.hpp" +#include "modules/meta/types.hpp" #include "utils/i3.hpp" #include "utils/io.hpp" @@ -51,7 +52,7 @@ namespace modules { bool update(); bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/i3"; + static constexpr auto TYPE = I3_TYPE; static constexpr auto EVENT_FOCUS = "focus"; static constexpr auto EVENT_NEXT = "next"; diff --git a/include/modules/ipc.hpp b/include/modules/ipc.hpp index ce2f63a4..69c373af 100644 --- a/include/modules/ipc.hpp +++ b/include/modules/ipc.hpp @@ -1,6 +1,7 @@ #pragma once #include "modules/meta/static_module.hpp" +#include "modules/meta/types.hpp" #include "utils/command.hpp" POLYBAR_NS @@ -33,7 +34,7 @@ namespace modules { bool build(builder* builder, const string& tag) const; void on_message(const string& message); - static constexpr auto TYPE = "custom/ipc"; + static constexpr auto TYPE = IPC_TYPE; static constexpr auto EVENT_SEND = "send"; static constexpr auto EVENT_HOOK = "hook"; diff --git a/include/modules/memory.hpp b/include/modules/memory.hpp index 90160b8e..6cca10d0 100644 --- a/include/modules/memory.hpp +++ b/include/modules/memory.hpp @@ -1,6 +1,7 @@ #pragma once #include "modules/meta/timer_module.hpp" +#include "modules/meta/types.hpp" #include "settings.hpp" POLYBAR_NS @@ -16,7 +17,7 @@ namespace modules { string get_format() const; bool build(builder* builder, const string& tag) const; - static constexpr auto TYPE = "internal/memory"; + static constexpr auto TYPE = MEMORY_TYPE; private: static constexpr const char* TAG_LABEL{"