diff --git a/include/components/taskqueue.hpp b/include/components/taskqueue.hpp index b59a8a0b..d693b637 100644 --- a/include/components/taskqueue.hpp +++ b/include/components/taskqueue.hpp @@ -52,7 +52,7 @@ class taskqueue : non_copyable_mixin { private: std::thread m_thread; - std::mutex m_lock; + std::mutex m_lock{}; std::condition_variable m_hold; std::atomic_bool m_active{true}; diff --git a/include/modules/backlight.hpp b/include/modules/backlight.hpp index 56887b6d..e998145b 100644 --- a/include/modules/backlight.hpp +++ b/include/modules/backlight.hpp @@ -17,9 +17,8 @@ namespace modules { class backlight_module : public inotify_module { public: - using inotify_module::inotify_module; + explicit backlight_module(const bar_settings&, string); - void setup(); void idle(); bool on_event(inotify_event* event); bool build(builder* builder, const string& tag) const; diff --git a/include/modules/battery.hpp b/include/modules/battery.hpp index fe465280..770d5894 100644 --- a/include/modules/battery.hpp +++ b/include/modules/battery.hpp @@ -25,9 +25,8 @@ namespace modules { class battery_module : public inotify_module { public: - using inotify_module::inotify_module; + explicit battery_module(const bar_settings&, string); - void setup(); void start(); void teardown(); void idle(); @@ -66,7 +65,7 @@ namespace modules { map m_valuepath; std::atomic m_percentage{0}; int m_fullat{100}; - chrono::duration m_interval; + chrono::duration m_interval{}; chrono::system_clock::time_point m_lastpoll; string m_timeformat; int m_unchanged{SKIP_N_UNCHANGED}; diff --git a/include/modules/bspwm.hpp b/include/modules/bspwm.hpp index 054b0039..cb8bb4b1 100644 --- a/include/modules/bspwm.hpp +++ b/include/modules/bspwm.hpp @@ -36,9 +36,9 @@ namespace modules { bool focused{false}; }; - using event_module::event_module; + public: + explicit bspwm_module(const bar_settings&, string); - void setup(); void stop(); bool has_event(); bool update(); diff --git a/include/modules/counter.hpp b/include/modules/counter.hpp index e00967ec..4c498e93 100644 --- a/include/modules/counter.hpp +++ b/include/modules/counter.hpp @@ -7,9 +7,8 @@ POLYBAR_NS namespace modules { class counter_module : public timer_module { public: - using timer_module::timer_module; + explicit counter_module(const bar_settings&, string); - void setup(); bool update(); bool build(builder* builder, const string& tag) const; diff --git a/include/modules/cpu.hpp b/include/modules/cpu.hpp index d2b157e0..22eda610 100644 --- a/include/modules/cpu.hpp +++ b/include/modules/cpu.hpp @@ -18,9 +18,8 @@ namespace modules { class cpu_module : public timer_module { public: - using timer_module::timer_module; + explicit cpu_module(const bar_settings&, string); - void setup(); bool update(); bool build(builder* builder, const string& tag) const; diff --git a/include/modules/date.hpp b/include/modules/date.hpp index aab752d0..7dff536b 100644 --- a/include/modules/date.hpp +++ b/include/modules/date.hpp @@ -7,9 +7,8 @@ POLYBAR_NS namespace modules { class date_module : public timer_module { public: - using timer_module::timer_module; + explicit date_module(const bar_settings&, string); - void setup(); bool update(); bool build(builder* builder, const string& tag) const; bool handle_event(string cmd); diff --git a/include/modules/fs.hpp b/include/modules/fs.hpp index 3a8630c0..2155ec01 100644 --- a/include/modules/fs.hpp +++ b/include/modules/fs.hpp @@ -37,9 +37,8 @@ namespace modules { */ class fs_module : public timer_module { public: - using timer_module::timer_module; + explicit fs_module(const bar_settings&, string); - void setup(); bool update(); string get_format() const; string get_output(); diff --git a/include/modules/github.hpp b/include/modules/github.hpp index 4c45c80a..945c68bf 100644 --- a/include/modules/github.hpp +++ b/include/modules/github.hpp @@ -14,7 +14,6 @@ namespace modules { public: explicit github_module(const bar_settings&, string); - void setup(); bool update(); bool build(builder* builder, const string& tag) const; diff --git a/include/modules/i3.hpp b/include/modules/i3.hpp index ac92f6c5..d49f86a5 100644 --- a/include/modules/i3.hpp +++ b/include/modules/i3.hpp @@ -32,9 +32,9 @@ namespace modules { label_t label; }; - using event_module::event_module; + public: + explicit i3_module(const bar_settings&, string); - void setup(); void stop(); bool has_event(); bool update(); diff --git a/include/modules/ipc.hpp b/include/modules/ipc.hpp index ebeb2c68..b5622a0b 100644 --- a/include/modules/ipc.hpp +++ b/include/modules/ipc.hpp @@ -8,15 +8,6 @@ POLYBAR_NS struct ipc_hook; // fwd namespace modules { - /** - * Hook structure that will be fired - * when receiving a message with specified id - */ - struct hook { - string payload; - string command; - }; - /** * Module that allow users to configure hooks on * received ipc messages. The hook will execute the defined @@ -25,9 +16,18 @@ namespace modules { */ class ipc_module : public static_module { public: - using static_module::static_module; + /** + * Hook structure that will be fired + * when receiving a message with specified id + */ + struct hook { + string payload; + string command; + }; + + public: + explicit ipc_module(const bar_settings&, string); - void setup(); string get_output(); bool build(builder* builder, const string& tag) const; void on_message(const ipc_hook& message); diff --git a/include/modules/memory.hpp b/include/modules/memory.hpp index 99a54b28..d01ca343 100644 --- a/include/modules/memory.hpp +++ b/include/modules/memory.hpp @@ -10,9 +10,8 @@ namespace modules { class memory_module : public timer_module { public: - using timer_module::timer_module; + explicit memory_module(const bar_settings&, string); - void setup(); bool update(); bool build(builder* builder, const string& tag) const; diff --git a/include/modules/menu.hpp b/include/modules/menu.hpp index 9229dabb..392dd6df 100644 --- a/include/modules/menu.hpp +++ b/include/modules/menu.hpp @@ -5,20 +5,20 @@ POLYBAR_NS namespace modules { - struct menu_tree_item { - string exec; - label_t label; - }; - - struct menu_tree { - vector> items; - }; - class menu_module : public static_module { public: - using static_module::static_module; + struct menu_tree_item { + string exec; + label_t label; + }; + + struct menu_tree { + vector> items; + }; + + public: + explicit menu_module(const bar_settings&, string); - void setup(); bool build(builder* builder, const string& tag) const; bool handle_event(string cmd); bool receive_events() const; diff --git a/include/modules/meta/base.hpp b/include/modules/meta/base.hpp index a2983f01..da85848e 100644 --- a/include/modules/meta/base.hpp +++ b/include/modules/meta/base.hpp @@ -104,7 +104,6 @@ namespace modules { virtual string name() const = 0; virtual bool running() const = 0; - virtual void setup() = 0; virtual void start() = 0; virtual void stop() = 0; virtual void halt(string error_message) = 0; @@ -131,7 +130,6 @@ namespace modules { string name() const; bool running() const; - void setup(); void stop(); void halt(string error_message); void teardown(); diff --git a/include/modules/meta/base.inl b/include/modules/meta/base.inl index bffc8eab..f10c28aa 100644 --- a/include/modules/meta/base.inl +++ b/include/modules/meta/base.inl @@ -50,18 +50,6 @@ namespace modules { return static_cast(m_enabled); } - template - void module::setup() { - m_log.trace("%s: Setup", m_name); - - try { - CAST_MOD(Impl)->setup(); - } catch (const std::exception& err) { - m_log.err("%s: Setup failed", m_name); - halt(err.what()); - } - } - template void module::stop() { if (!running()) { diff --git a/include/modules/mpd.hpp b/include/modules/mpd.hpp index dbc7dc73..fab1ad38 100644 --- a/include/modules/mpd.hpp +++ b/include/modules/mpd.hpp @@ -14,9 +14,8 @@ namespace chrono = std::chrono; namespace modules { class mpd_module : public event_module { public: - using event_module::event_module; + explicit mpd_module(const bar_settings&, string); - void setup(); void teardown(); inline bool connected() const; void idle(); diff --git a/include/modules/network.hpp b/include/modules/network.hpp index e090f2c8..00cbf20b 100644 --- a/include/modules/network.hpp +++ b/include/modules/network.hpp @@ -11,9 +11,8 @@ namespace modules { class network_module : public timer_module { public: - using timer_module::timer_module; + explicit network_module(const bar_settings&, string); - void setup(); void teardown(); bool update(); string get_format() const; diff --git a/include/modules/script.hpp b/include/modules/script.hpp index c0f7e846..88a1168d 100644 --- a/include/modules/script.hpp +++ b/include/modules/script.hpp @@ -16,9 +16,8 @@ namespace chrono = std::chrono; namespace modules { class script_module : public event_module { public: - using event_module::event_module; + explicit script_module(const bar_settings&, string); - void setup(); void stop(); void idle(); bool has_event(); diff --git a/include/modules/temperature.hpp b/include/modules/temperature.hpp index 8a22c450..7a9b1045 100644 --- a/include/modules/temperature.hpp +++ b/include/modules/temperature.hpp @@ -12,9 +12,8 @@ namespace modules { class temperature_module : public timer_module { public: - using timer_module::timer_module; + explicit temperature_module(const bar_settings&, string); - void setup(); bool update(); string get_format() const; bool build(builder* builder, const string& tag) const; diff --git a/include/modules/text.hpp b/include/modules/text.hpp index f94ae4b1..bb0ce695 100644 --- a/include/modules/text.hpp +++ b/include/modules/text.hpp @@ -7,9 +7,8 @@ POLYBAR_NS namespace modules { class text_module : public static_module { public: - using static_module::static_module; + explicit text_module(const bar_settings&, string); - void setup(); string get_format() const; string get_output(); }; diff --git a/include/modules/unsupported.hpp b/include/modules/unsupported.hpp index feede96f..bd32633a 100644 --- a/include/modules/unsupported.hpp +++ b/include/modules/unsupported.hpp @@ -33,7 +33,6 @@ namespace modules { bool running() const { \ return false; \ } \ - void setup() {} \ void start() {} \ void stop() {} \ void halt(string) {} \ diff --git a/include/modules/volume.hpp b/include/modules/volume.hpp index 382315ef..16ad04e2 100644 --- a/include/modules/volume.hpp +++ b/include/modules/volume.hpp @@ -20,9 +20,8 @@ namespace modules { class volume_module : public event_module { public: - using event_module::event_module; + explicit volume_module(const bar_settings&, string); - void setup(); void teardown(); bool has_event(); bool update(); diff --git a/include/modules/xbacklight.hpp b/include/modules/xbacklight.hpp index 6daeb41e..48a062eb 100644 --- a/include/modules/xbacklight.hpp +++ b/include/modules/xbacklight.hpp @@ -25,9 +25,8 @@ namespace modules { */ class xbacklight_module : public static_module, public xpp::event::sink { public: - explicit xbacklight_module(const bar_settings& bar, string name); + explicit xbacklight_module(const bar_settings& bar, string name_); - void setup(); void teardown(); void handle(const evt::randr_notify& evt); void update(); diff --git a/include/modules/xkeyboard.hpp b/include/modules/xkeyboard.hpp index 87d9ae2c..44faae55 100644 --- a/include/modules/xkeyboard.hpp +++ b/include/modules/xkeyboard.hpp @@ -19,9 +19,8 @@ namespace modules { class xkeyboard_module : public static_module, public xpp::event::sink { public: - explicit xkeyboard_module(const bar_settings& bar, string name); + explicit xkeyboard_module(const bar_settings& bar, string name_); - void setup(); void teardown(); void update(); bool build(builder* builder, const string& tag) const; diff --git a/include/modules/xwindow.hpp b/include/modules/xwindow.hpp index bccfb085..e4e88294 100644 --- a/include/modules/xwindow.hpp +++ b/include/modules/xwindow.hpp @@ -34,7 +34,6 @@ namespace modules { public: explicit xwindow_module(const bar_settings&, string); - void setup(); void teardown(); void handle(const evt::property_notify& evt); void update(); diff --git a/include/modules/xworkspaces.hpp b/include/modules/xworkspaces.hpp index 7d68212f..e6777530 100644 --- a/include/modules/xworkspaces.hpp +++ b/include/modules/xworkspaces.hpp @@ -49,9 +49,8 @@ namespace modules { */ class xworkspaces_module : public static_module, public xpp::event::sink { public: - explicit xworkspaces_module(const bar_settings& bar, string name); + explicit xworkspaces_module(const bar_settings& bar, string name_); - void setup(); void teardown(); void handle(const evt::property_notify& evt); void update(); diff --git a/include/utils/command.hpp b/include/utils/command.hpp index 17fe543a..823bbc5d 100644 --- a/include/utils/command.hpp +++ b/include/utils/command.hpp @@ -71,7 +71,7 @@ class command { pid_t m_forkpid{}; int m_forkstatus{}; - std::mutex m_pipelock; + std::mutex m_pipelock{}; }; namespace command_util { diff --git a/src/components/config.cpp b/src/components/config.cpp index 574a65b3..5e93f8c0 100644 --- a/src/components/config.cpp +++ b/src/components/config.cpp @@ -280,4 +280,9 @@ chrono::milliseconds config::convert(string&& value) const { return chrono::milliseconds{convert(forward(value))}; } +template <> +chrono::duration config::convert(string&& value) const { + return chrono::duration{convert(forward(value))}; +} + POLYBAR_NS_END diff --git a/src/components/controller.cpp b/src/components/controller.cpp index db133e53..3ab24c5e 100644 --- a/src/components/controller.cpp +++ b/src/components/controller.cpp @@ -103,7 +103,6 @@ controller::controller(connection& conn, signal_emitter& emitter, const logger& module->set_update_cb([&] { enqueue(make_update_evt(false)); }); module->set_stop_cb([&] { enqueue(make_check_evt()); }); - module->setup(); m_modules[align].emplace_back(move(module)); diff --git a/src/main.cpp b/src/main.cpp index f7004fde..57b7f1f5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -137,8 +137,9 @@ int main(int argc, char** argv) { } logger.info("Waiting for spawned processes to end"); - while (process_util::notify_childprocess()) + while (process_util::notify_childprocess()) { ; + } if (reload) { logger.info("Re-launching application..."); diff --git a/src/modules/backlight.cpp b/src/modules/backlight.cpp index e5309af2..935bb904 100644 --- a/src/modules/backlight.cpp +++ b/src/modules/backlight.cpp @@ -14,19 +14,8 @@ namespace modules { template class module; template class inotify_module; - void brightness_handle::filepath(const string& path) { - if (!file_util::exists(path)) { - throw module_error("The file '" + path + "' does not exist"); - } - m_path = path; - } - - float brightness_handle::read() const { - return std::strtof(file_util::get_contents(m_path).c_str(), nullptr); - } - - void backlight_module::setup() { - // Load configuration values + backlight_module::backlight_module(const bar_settings& bar, string name_) + : inotify_module(bar, move(name_)) { auto card = m_conf.get(name(), "card"); // Add formats and elements @@ -50,6 +39,17 @@ namespace modules { watch(string_util::replace(PATH_BACKLIGHT_VAL, "%card%", card)); } + void brightness_handle::filepath(const string& path) { + if (!file_util::exists(path)) { + throw module_error("The file '" + path + "' does not exist"); + } + m_path = path; + } + + float brightness_handle::read() const { + return std::strtof(file_util::get_contents(m_path).c_str(), nullptr); + } + void backlight_module::idle() { sleep(75ms); } diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index 8df4ff3a..6d916594 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -20,7 +20,8 @@ namespace modules { /** * Bootstrap module by setting up required components */ - void battery_module::setup() { + battery_module::battery_module(const bar_settings& bar, string name_) + : inotify_module(bar, move(name_)) { auto battery = m_conf.get(name(), "battery", "BAT0"); auto adapter = m_conf.get(name(), "adapter", "ADP1"); diff --git a/src/modules/bspwm.cpp b/src/modules/bspwm.cpp index 203a65cc..0b4f8dca 100644 --- a/src/modules/bspwm.cpp +++ b/src/modules/bspwm.cpp @@ -39,7 +39,7 @@ namespace modules { template class module; template class event_module; - void bspwm_module::setup() { + bspwm_module::bspwm_module(const bar_settings& bar, string name_) : event_module(bar, move(name_)) { auto socket_path = bspwm_util::get_socket_path(); if (!file_util::exists(socket_path)) { diff --git a/src/modules/counter.cpp b/src/modules/counter.cpp index 8812c78d..b37733a8 100644 --- a/src/modules/counter.cpp +++ b/src/modules/counter.cpp @@ -9,8 +9,9 @@ namespace modules { template class module; template class timer_module; - void counter_module::setup() { - m_interval = chrono::duration(m_conf.get(name(), "interval", 1)); + counter_module::counter_module(const bar_settings& bar, string name_) + : timer_module(bar, move(name_)) { + m_interval = m_conf.get(name(), "interval", m_interval); m_formatter->add(DEFAULT_FORMAT, TAG_COUNTER, {TAG_COUNTER}); } diff --git a/src/modules/cpu.cpp b/src/modules/cpu.cpp index fdb91442..2a6cd0fe 100644 --- a/src/modules/cpu.cpp +++ b/src/modules/cpu.cpp @@ -17,7 +17,7 @@ namespace modules { template class module; template class timer_module; - void cpu_module::setup() { + cpu_module::cpu_module(const bar_settings& bar, string name_) : timer_module(bar, move(name_)) { m_interval = chrono::duration(m_conf.get(name(), "interval", 1)); m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL, TAG_BAR_LOAD, TAG_RAMP_LOAD, TAG_RAMP_LOAD_PER_CORE}); diff --git a/src/modules/date.cpp b/src/modules/date.cpp index 2c80ccec..8ba12622 100644 --- a/src/modules/date.cpp +++ b/src/modules/date.cpp @@ -10,7 +10,7 @@ namespace modules { template class module; template class timer_module; - void date_module::setup() { + date_module::date_module(const bar_settings& bar, string name_) : timer_module(bar, move(name_)) { if (!m_bar.locale.empty()) { setlocale(LC_TIME, m_bar.locale.c_str()); } diff --git a/src/modules/fs.cpp b/src/modules/fs.cpp index b94a0eed..fdbc567b 100644 --- a/src/modules/fs.cpp +++ b/src/modules/fs.cpp @@ -23,7 +23,7 @@ namespace modules { * Bootstrap the module by reading config values and * setting up required components */ - void fs_module::setup() { + fs_module::fs_module(const bar_settings& bar, string name_) : timer_module(bar, move(name_)) { m_mountpoints = m_conf.get_list(name(), "mount"); m_fixed = m_conf.get(name(), "fixed-values", m_fixed); m_spacing = m_conf.get(name(), "spacing", m_spacing); diff --git a/src/modules/github.cpp b/src/modules/github.cpp index 0daaf51c..e462d772 100644 --- a/src/modules/github.cpp +++ b/src/modules/github.cpp @@ -13,13 +13,8 @@ namespace modules { /** * Construct module */ - github_module::github_module(const bar_settings& bar, string name) - : timer_module(bar, name), m_http(http_util::make_downloader()) {} - - /** - * Bootstrap module - */ - void github_module::setup() { + github_module::github_module(const bar_settings& bar, string name_) + : timer_module(bar, move(name_)), m_http(http_util::make_downloader()) { m_accesstoken = m_conf.get(name(), "token"); m_interval = m_conf.get(name(), "interval", 60s); m_empty_notifications = m_conf.get(name(), "empty-notifications", m_empty_notifications); diff --git a/src/modules/i3.cpp b/src/modules/i3.cpp index 08e69220..0b8c49b6 100644 --- a/src/modules/i3.cpp +++ b/src/modules/i3.cpp @@ -15,11 +15,7 @@ namespace modules { template class module; template class event_module; - i3_module::workspace::operator bool() { - return label && *label; - } - - void i3_module::setup() { + i3_module::i3_module(const bar_settings& bar, string name_) : event_module(bar, move(name_)) { auto socket_path = i3ipc::get_socketpath(); if (!file_util::exists(socket_path)) { @@ -83,6 +79,10 @@ namespace modules { } } + i3_module::workspace::operator bool() { + return label && *label; + } + void i3_module::stop() { try { if (m_ipc) { diff --git a/src/modules/ipc.cpp b/src/modules/ipc.cpp index 10797ddd..566fab2e 100644 --- a/src/modules/ipc.cpp +++ b/src/modules/ipc.cpp @@ -15,7 +15,7 @@ namespace modules { * Load user-defined ipc hooks and * create formatting tags */ - void ipc_module::setup() { + ipc_module::ipc_module(const bar_settings& bar, string name_) : static_module(bar, move(name_)) { size_t index = 0; for (auto&& command : m_conf.get_list(name(), "hook")) { diff --git a/src/modules/memory.cpp b/src/modules/memory.cpp index d0cefe9a..d8163b90 100644 --- a/src/modules/memory.cpp +++ b/src/modules/memory.cpp @@ -15,7 +15,7 @@ namespace modules { template class module; template class timer_module; - void memory_module::setup() { + memory_module::memory_module(const bar_settings& bar, string name_) : timer_module(bar, move(name_)) { m_interval = chrono::duration(m_conf.get(name(), "interval", 1)); m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL, TAG_BAR_USED, TAG_BAR_FREE}); diff --git a/src/modules/menu.cpp b/src/modules/menu.cpp index 91fa0fa2..1451961f 100644 --- a/src/modules/menu.cpp +++ b/src/modules/menu.cpp @@ -13,7 +13,7 @@ namespace modules { template class module; template class static_module; - void menu_module::setup() { + menu_module::menu_module(const bar_settings& bar, string name_) : static_module(bar, move(name_)) { string default_format{TAG_LABEL_TOGGLE + string{" "} + TAG_MENU}; m_formatter->add(DEFAULT_FORMAT, default_format, {TAG_LABEL_TOGGLE, TAG_MENU}); diff --git a/src/modules/mpd.cpp b/src/modules/mpd.cpp index ccb1f3be..ad83d282 100644 --- a/src/modules/mpd.cpp +++ b/src/modules/mpd.cpp @@ -16,7 +16,7 @@ namespace modules { template class module; template class event_module; - void mpd_module::setup() { + mpd_module::mpd_module(const bar_settings& bar, string name_) : event_module(bar, move(name_)) { m_host = m_conf.get(name(), "host", m_host); m_port = m_conf.get(name(), "port", m_port); m_pass = m_conf.get(name(), "password", m_pass); diff --git a/src/modules/network.cpp b/src/modules/network.cpp index 54c429c8..e9da1c8a 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -14,7 +14,8 @@ namespace modules { template class module; template class timer_module; - void network_module::setup() { + network_module::network_module(const bar_settings& bar, string name_) + : timer_module(bar, move(name_)) { // Load configuration values REQ_CONFIG_VALUE(name(), m_interface, "interface"); GET_CONFIG_VALUE(name(), m_ping_nth_update, "ping-interval"); diff --git a/src/modules/script.cpp b/src/modules/script.cpp index 9a28bc19..3f79454c 100644 --- a/src/modules/script.cpp +++ b/src/modules/script.cpp @@ -10,7 +10,7 @@ namespace modules { template class module; template class event_module; - void script_module::setup() { + script_module::script_module(const bar_settings& bar, string name_) : event_module(bar, move(name_)) { REQ_CONFIG_VALUE(name(), m_exec, "exec"); GET_CONFIG_VALUE(name(), m_tail, "tail"); GET_CONFIG_VALUE(name(), m_maxlen, "maxlen"); diff --git a/src/modules/temperature.cpp b/src/modules/temperature.cpp index 0453d3fc..b8745edc 100644 --- a/src/modules/temperature.cpp +++ b/src/modules/temperature.cpp @@ -14,7 +14,8 @@ namespace modules { template class module; template class timer_module; - void temperature_module::setup() { + temperature_module::temperature_module(const bar_settings& bar, string name_) + : timer_module(bar, move(name_)) { m_zone = m_conf.get(name(), "thermal-zone", 0); m_tempwarn = m_conf.get(name(), "warn-temperature", 80); m_interval = chrono::duration(m_conf.get(name(), "interval", 1)); diff --git a/src/modules/text.cpp b/src/modules/text.cpp index 42e0c8e4..bdd28432 100644 --- a/src/modules/text.cpp +++ b/src/modules/text.cpp @@ -9,7 +9,7 @@ namespace modules { template class module; template class static_module; - void text_module::setup() { + text_module::text_module(const bar_settings& bar, string name_) : static_module(bar, move(name_)) { m_formatter->add("content", "", {}); if (m_formatter->get("content")->value.empty()) { diff --git a/src/modules/volume.cpp b/src/modules/volume.cpp index 238634e6..fd341307 100644 --- a/src/modules/volume.cpp +++ b/src/modules/volume.cpp @@ -18,7 +18,7 @@ namespace modules { template class module; template class event_module; - void volume_module::setup() { + volume_module::volume_module(const bar_settings& bar, string name_) : event_module(bar, move(name_)) { // Load configuration values string master_mixer_name{"Master"}; string speaker_mixer_name; diff --git a/src/modules/xbacklight.cpp b/src/modules/xbacklight.cpp index f6f276dd..e74513d6 100644 --- a/src/modules/xbacklight.cpp +++ b/src/modules/xbacklight.cpp @@ -19,13 +19,8 @@ namespace modules { /** * Construct module */ - xbacklight_module::xbacklight_module(const bar_settings& bar, string name) - : static_module(bar, move(name)), m_connection(connection::make()) {} - - /** - * Bootstrap the module by grabbing all required components - */ - void xbacklight_module::setup() { + xbacklight_module::xbacklight_module(const bar_settings& bar, string name_) + : static_module(bar, move(name_)), m_connection(connection::make()) { auto output = m_conf.get(name(), "output", m_bar.monitor->name); auto strict = m_conf.get(name(), "monitor-strict", false); diff --git a/src/modules/xkeyboard.cpp b/src/modules/xkeyboard.cpp index 184fba9f..85fb975a 100644 --- a/src/modules/xkeyboard.cpp +++ b/src/modules/xkeyboard.cpp @@ -17,13 +17,8 @@ namespace modules { /** * Construct module */ - xkeyboard_module::xkeyboard_module(const bar_settings& bar, string name) - : static_module(bar, move(name)), m_connection(connection::make()) {} - - /** - * Bootstrap the module - */ - void xkeyboard_module::setup() { + xkeyboard_module::xkeyboard_module(const bar_settings& bar, string name_) + : static_module(bar, move(name_)), m_connection(connection::make()) { // Load config values m_blacklist = m_conf.get_list(name(), "blacklist", {}); diff --git a/src/modules/xwindow.cpp b/src/modules/xwindow.cpp index 8633a590..e51d1f9b 100644 --- a/src/modules/xwindow.cpp +++ b/src/modules/xwindow.cpp @@ -64,13 +64,8 @@ namespace modules { /** * Construct module */ - xwindow_module::xwindow_module(const bar_settings& bar, string name) - : static_module(bar, name), m_connection(connection::make()) {} - - /** - * Bootstrap the module - */ - void xwindow_module::setup() { + xwindow_module::xwindow_module(const bar_settings& bar, string name_) + : static_module(bar, move(name_)), m_connection(connection::make()) { // Initialize ewmh atoms if ((m_ewmh = ewmh_util::initialize()) == nullptr) { throw module_error("Failed to initialize ewmh atoms"); diff --git a/src/modules/xworkspaces.cpp b/src/modules/xworkspaces.cpp index 263acfb2..c5ae78e2 100644 --- a/src/modules/xworkspaces.cpp +++ b/src/modules/xworkspaces.cpp @@ -20,13 +20,8 @@ namespace modules { /** * Construct module */ - xworkspaces_module::xworkspaces_module(const bar_settings& bar, string name) - : static_module(bar, move(name)), m_connection(connection::make()) {} - - /** - * Bootstrap the module - */ - void xworkspaces_module::setup() { + xworkspaces_module::xworkspaces_module(const bar_settings& bar, string name_) + : static_module(bar, move(name_)), m_connection(connection::make()) { // Load config values m_pinworkspaces = m_conf.get(name(), "pin-workspaces", m_pinworkspaces); m_click = m_conf.get(name(), "enable-click", m_click);