mirror of https://github.com/polybar/polybar.git
rename config to config_ini
This commit is contained in:
parent
2cd0809a46
commit
9ff6d0cb10
|
@ -18,7 +18,7 @@
|
|||
POLYBAR_NS
|
||||
|
||||
// fwd {{{
|
||||
class config;
|
||||
class config_ini;
|
||||
class connection;
|
||||
class logger;
|
||||
class renderer;
|
||||
|
@ -37,9 +37,9 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||
public signal_receiver<SIGN_PRIORITY_BAR, signals::ui::dim_window> {
|
||||
public:
|
||||
using make_type = unique_ptr<bar>;
|
||||
static make_type make(eventloop::loop&, const config&, bool only_initialize_values = false);
|
||||
static make_type make(eventloop::loop&, const config_ini&, bool only_initialize_values = false);
|
||||
|
||||
explicit bar(connection&, signal_emitter&, const config&, const logger&, eventloop::loop&, unique_ptr<screen>&&,
|
||||
explicit bar(connection&, signal_emitter&, const config_ini&, const logger&, eventloop::loop&, unique_ptr<screen>&&,
|
||||
unique_ptr<tags::dispatch>&&, unique_ptr<tags::action_context>&&, bool only_initialize_values);
|
||||
~bar();
|
||||
|
||||
|
@ -90,7 +90,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||
private:
|
||||
connection& m_connection;
|
||||
signal_emitter& m_sig;
|
||||
const config& m_conf;
|
||||
const config_ini& m_conf;
|
||||
const logger& m_log;
|
||||
eventloop::loop& m_loop;
|
||||
unique_ptr<screen> m_screen;
|
||||
|
|
|
@ -22,9 +22,9 @@ using valuemap_t = std::unordered_map<string, string>;
|
|||
using sectionmap_t = std::map<string, valuemap_t>;
|
||||
using file_list = vector<string>;
|
||||
|
||||
class config {
|
||||
class config_ini {
|
||||
public:
|
||||
explicit config(const logger& logger, string&& path, string&& bar)
|
||||
explicit config_ini(const logger& logger, string&& path, string&& bar)
|
||||
: m_log(logger), m_file(move(path)), m_barname(move(bar)){};
|
||||
|
||||
const string& filepath() const;
|
|
@ -3,7 +3,7 @@
|
|||
#include <set>
|
||||
|
||||
#include "common.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/logger.hpp"
|
||||
#include "errors.hpp"
|
||||
|
||||
|
@ -105,7 +105,7 @@ class config_parser {
|
|||
* @throws syntax_error If there was any kind of syntax error
|
||||
* @throws parser_error If aynthing else went wrong
|
||||
*/
|
||||
config parse(string barname);
|
||||
config_ini parse(string barname);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,7 @@ using std::queue;
|
|||
|
||||
enum class alignment;
|
||||
class bar;
|
||||
class config;
|
||||
class config_ini;
|
||||
class connection;
|
||||
class inotify_watch;
|
||||
class logger;
|
||||
|
@ -39,9 +39,9 @@ class controller : public signal_receiver<SIGN_PRIORITY_CONTROLLER, signals::eve
|
|||
signals::ipc::hook, signals::ui::button_press, signals::ui::update_background> {
|
||||
public:
|
||||
using make_type = unique_ptr<controller>;
|
||||
static make_type make(bool has_ipc, eventloop::loop&, const config&);
|
||||
static make_type make(bool has_ipc, eventloop::loop&, const config_ini&);
|
||||
|
||||
explicit controller(connection&, signal_emitter&, const logger&, const config&, bool has_ipc, eventloop::loop&);
|
||||
explicit controller(connection&, signal_emitter&, const logger&, const config_ini&, bool has_ipc, eventloop::loop&);
|
||||
~controller();
|
||||
|
||||
bool run(bool writeback, string snapshot_dst, bool confwatch);
|
||||
|
@ -98,7 +98,7 @@ class controller : public signal_receiver<SIGN_PRIORITY_CONTROLLER, signals::eve
|
|||
connection& m_connection;
|
||||
signal_emitter& m_sig;
|
||||
const logger& m_log;
|
||||
const config& m_conf;
|
||||
const config_ini& m_conf;
|
||||
eventloop::loop& m_loop;
|
||||
unique_ptr<bar> m_bar;
|
||||
bool m_has_ipc;
|
||||
|
|
|
@ -18,7 +18,7 @@ POLYBAR_NS
|
|||
|
||||
// fwd {{{
|
||||
class connection;
|
||||
class config;
|
||||
class config_ini;
|
||||
class logger;
|
||||
class background_manager;
|
||||
class bg_slice;
|
||||
|
@ -46,9 +46,9 @@ class renderer : public renderer_interface,
|
|||
public signal_receiver<SIGN_PRIORITY_RENDERER, signals::ui::request_snapshot> {
|
||||
public:
|
||||
using make_type = unique_ptr<renderer>;
|
||||
static make_type make(const bar_settings& bar, tags::action_context& action_ctxt, const config&);
|
||||
static make_type make(const bar_settings& bar, tags::action_context& action_ctxt, const config_ini&);
|
||||
|
||||
explicit renderer(connection& conn, signal_emitter& sig, const config&, const logger& logger, const bar_settings& bar,
|
||||
explicit renderer(connection& conn, signal_emitter& sig, const config_ini&, const logger& logger, const bar_settings& bar,
|
||||
background_manager& background_manager, tags::action_context& action_ctxt);
|
||||
~renderer();
|
||||
|
||||
|
@ -99,7 +99,7 @@ class renderer : public renderer_interface,
|
|||
private:
|
||||
connection& m_connection;
|
||||
signal_emitter& m_sig;
|
||||
const config& m_conf;
|
||||
const config_ini& m_conf;
|
||||
const logger& m_log;
|
||||
const bar_settings& m_bar;
|
||||
std::shared_ptr<bg_slice> m_background;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
POLYBAR_NS
|
||||
|
||||
// fwd
|
||||
class config;
|
||||
class config_ini;
|
||||
class logger;
|
||||
class connection;
|
||||
class signal_emitter;
|
||||
|
@ -19,9 +19,9 @@ class signal_emitter;
|
|||
class screen : public xpp::event::sink<evt::map_notify, evt::randr_screen_change_notify> {
|
||||
public:
|
||||
using make_type = unique_ptr<screen>;
|
||||
static make_type make(const config&);
|
||||
static make_type make(const config_ini&);
|
||||
|
||||
explicit screen(connection& conn, signal_emitter& emitter, const logger& logger, const config& conf);
|
||||
explicit screen(connection& conn, signal_emitter& emitter, const logger& logger, const config_ini& conf);
|
||||
~screen();
|
||||
|
||||
protected:
|
||||
|
@ -32,7 +32,7 @@ class screen : public xpp::event::sink<evt::map_notify, evt::randr_screen_change
|
|||
connection& m_connection;
|
||||
signal_emitter& m_sig;
|
||||
const logger& m_log;
|
||||
const config& m_conf;
|
||||
const config_ini& m_conf;
|
||||
|
||||
xcb_window_t m_root;
|
||||
xcb_window_t m_proxy{XCB_NONE};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <chrono>
|
||||
|
||||
#include "common.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "drawtypes/label.hpp"
|
||||
#include "utils/mixins.hpp"
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace drawtypes {
|
|||
using animation_t = shared_ptr<animation>;
|
||||
|
||||
animation_t load_animation(
|
||||
const config& conf, const string& section, string name = "animation", bool required = true);
|
||||
const config_ini& conf, const string& section, string name = "animation", bool required = true);
|
||||
} // namespace drawtypes
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <cassert>
|
||||
|
||||
#include "common.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/types.hpp"
|
||||
#include "utils/mixins.hpp"
|
||||
|
||||
|
@ -80,8 +80,8 @@ namespace drawtypes {
|
|||
const vector<token> m_tokens{};
|
||||
};
|
||||
|
||||
label_t load_label(const config& conf, const string& section, string name, bool required = true, string def = ""s);
|
||||
label_t load_optional_label(const config& conf, string section, string name, string def = ""s);
|
||||
label_t load_label(const config_ini& conf, const string& section, string name, bool required = true, string def = ""s);
|
||||
label_t load_optional_label(const config_ini& conf, string section, string name, string def = ""s);
|
||||
} // namespace drawtypes
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "common.hpp"
|
||||
#include "components/builder.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/types.hpp"
|
||||
#include "utils/mixins.hpp"
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace drawtypes {
|
|||
|
||||
using progressbar_t = shared_ptr<progressbar>;
|
||||
|
||||
progressbar_t load_progressbar(const bar_settings& bar, const config& conf, const string& section, string name);
|
||||
progressbar_t load_progressbar(const bar_settings& bar, const config_ini& conf, const string& section, string name);
|
||||
} // namespace drawtypes
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "common.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "drawtypes/label.hpp"
|
||||
#include "utils/mixins.hpp"
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace drawtypes {
|
|||
|
||||
using ramp_t = shared_ptr<ramp>;
|
||||
|
||||
ramp_t load_ramp(const config& conf, const string& section, string name, bool required = true);
|
||||
ramp_t load_ramp(const config_ini& conf, const string& section, string name, bool required = true);
|
||||
} // namespace drawtypes
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace modules {
|
|||
|
||||
class alsa_module : public event_module<alsa_module> {
|
||||
public:
|
||||
explicit alsa_module(const bar_settings&, string, const config&);
|
||||
explicit alsa_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void teardown();
|
||||
bool has_event();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "modules/meta/inotify_module.hpp"
|
||||
#include "modules/meta/types.hpp"
|
||||
#include "settings.hpp"
|
||||
|
@ -21,7 +21,7 @@ namespace modules {
|
|||
string get_output();
|
||||
|
||||
public:
|
||||
explicit backlight_module(const bar_settings&, string, const config&);
|
||||
explicit backlight_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void idle();
|
||||
bool on_event(const inotify_event& event);
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace modules {
|
|||
using consumption_reader = mutex_wrapper<value_reader<string /* watts */>>;
|
||||
|
||||
public:
|
||||
explicit battery_module(const bar_settings&, string, const config&);
|
||||
explicit battery_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void start() override;
|
||||
void teardown();
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace modules {
|
|||
};
|
||||
|
||||
public:
|
||||
explicit bspwm_module(const bar_settings&, string, const config&);
|
||||
explicit bspwm_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void stop() override;
|
||||
bool has_event();
|
||||
|
|
|
@ -8,7 +8,7 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
class counter_module : public timer_module<counter_module> {
|
||||
public:
|
||||
explicit counter_module(const bar_settings&, string, const config&);
|
||||
explicit counter_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
bool update();
|
||||
bool build(builder* builder, const string& tag) const;
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace modules {
|
|||
|
||||
class cpu_module : public timer_module<cpu_module> {
|
||||
public:
|
||||
explicit cpu_module(const bar_settings&, string, const config&);
|
||||
explicit cpu_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
bool update();
|
||||
string get_format() const;
|
||||
|
|
|
@ -13,7 +13,7 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
class date_module : public timer_module<date_module> {
|
||||
public:
|
||||
explicit date_module(const bar_settings&, string, const config&);
|
||||
explicit date_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
bool update();
|
||||
bool build(builder* builder, const string& tag) const;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "modules/meta/timer_module.hpp"
|
||||
#include "modules/meta/types.hpp"
|
||||
#include "settings.hpp"
|
||||
|
@ -36,7 +36,7 @@ namespace modules {
|
|||
*/
|
||||
class fs_module : public timer_module<fs_module> {
|
||||
public:
|
||||
explicit fs_module(const bar_settings&, string, const config&);
|
||||
explicit fs_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
bool update();
|
||||
string get_format() const;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace modules {
|
|||
*/
|
||||
class github_module : public timer_module<github_module> {
|
||||
public:
|
||||
explicit github_module(const bar_settings&, string, const config&);
|
||||
explicit github_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
bool update();
|
||||
bool build(builder* builder, const string& tag) const;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <i3ipc++/ipc.hpp>
|
||||
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "modules/meta/event_module.hpp"
|
||||
#include "modules/meta/types.hpp"
|
||||
#include "utils/i3.hpp"
|
||||
|
@ -45,7 +45,7 @@ namespace modules {
|
|||
};
|
||||
|
||||
public:
|
||||
explicit i3_module(const bar_settings&, string, const config&);
|
||||
explicit i3_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void stop() override;
|
||||
bool has_event();
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace modules {
|
|||
};
|
||||
|
||||
public:
|
||||
explicit ipc_module(const bar_settings&, string, const config&);
|
||||
explicit ipc_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void start() override;
|
||||
void update();
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace modules {
|
|||
enum class memory_state { NORMAL = 0, WARN };
|
||||
class memory_module : public timer_module<memory_module> {
|
||||
public:
|
||||
explicit memory_module(const bar_settings&, string, const config&);
|
||||
explicit memory_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
bool update();
|
||||
string get_format() const;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace modules {
|
|||
};
|
||||
|
||||
public:
|
||||
explicit menu_module(const bar_settings&, string, const config&);
|
||||
explicit menu_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
bool build(builder* builder, const string& tag) const;
|
||||
void update() {}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <mutex>
|
||||
|
||||
#include "common.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/types.hpp"
|
||||
#include "errors.hpp"
|
||||
#include "utils/concurrency.hpp"
|
||||
|
@ -40,7 +40,7 @@ namespace drawtypes {
|
|||
} // namespace drawtypes
|
||||
|
||||
class builder;
|
||||
class config;
|
||||
class config_ini;
|
||||
class logger;
|
||||
class signal_emitter;
|
||||
|
||||
|
@ -82,7 +82,7 @@ namespace modules {
|
|||
|
||||
class module_formatter {
|
||||
public:
|
||||
explicit module_formatter(const config& conf, string modname) : m_conf(conf), m_modname(modname) {}
|
||||
explicit module_formatter(const config_ini& conf, string modname) : m_conf(conf), m_modname(modname) {}
|
||||
|
||||
void add(string name, string fallback, vector<string>&& tags, vector<string>&& whitelist = {});
|
||||
void add_optional(string name, vector<string>&& tags, vector<string>&& whitelist = {});
|
||||
|
@ -94,7 +94,7 @@ namespace modules {
|
|||
protected:
|
||||
void add_value(string&& name, string&& value, vector<string>&& tags, vector<string>&& whitelist);
|
||||
|
||||
const config& m_conf;
|
||||
const config_ini& m_conf;
|
||||
string m_modname;
|
||||
map<string, shared_ptr<module_format>> m_formats;
|
||||
};
|
||||
|
@ -143,7 +143,7 @@ namespace modules {
|
|||
template <class Impl>
|
||||
class module : public module_interface {
|
||||
public:
|
||||
module(const bar_settings& bar, string name, const config&);
|
||||
module(const bar_settings& bar, string name, const config_ini&);
|
||||
~module() noexcept;
|
||||
|
||||
static constexpr auto EVENT_MODULE_TOGGLE = "module_toggle";
|
||||
|
@ -200,7 +200,7 @@ namespace modules {
|
|||
signal_emitter& m_sig;
|
||||
const bar_settings& m_bar;
|
||||
const logger& m_log;
|
||||
const config& m_conf;
|
||||
const config_ini& m_conf;
|
||||
|
||||
unique_ptr<action_router> m_router;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace modules {
|
|||
// module<Impl> public {{{
|
||||
|
||||
template <typename Impl>
|
||||
module<Impl>::module(const bar_settings& bar, string name, const config& conf)
|
||||
module<Impl>::module(const bar_settings& bar, string name, const config_ini& conf)
|
||||
: m_sig(signal_emitter::make())
|
||||
, m_bar(bar)
|
||||
, m_log(logger::make())
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace modules {
|
|||
* @param bar An instance of the @ref bar_settings
|
||||
* @param module_name The user-specified module name
|
||||
* @param log A @ref logger instance
|
||||
* @param config A @ref config instance
|
||||
* @param config_ini A @ref config_ini instance
|
||||
*/
|
||||
module_t make_module(string&& type, const bar_settings& bar, string module_name, const logger& log, const config& config);
|
||||
module_t make_module(string&& type, const bar_settings& bar, string module_name, const logger& log, const config_ini& config_ini);
|
||||
} // namespace modules
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
|
|
@ -14,7 +14,7 @@ using namespace mpd;
|
|||
namespace modules {
|
||||
class mpd_module : public event_module<mpd_module> {
|
||||
public:
|
||||
explicit mpd_module(const bar_settings&, string, const config&);
|
||||
explicit mpd_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void teardown();
|
||||
inline bool connected() const;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "adapters/net.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "modules/meta/timer_module.hpp"
|
||||
#include "modules/meta/types.hpp"
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace modules {
|
|||
|
||||
class network_module : public timer_module<network_module> {
|
||||
public:
|
||||
explicit network_module(const bar_settings&, string, const config&);
|
||||
explicit network_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void teardown();
|
||||
bool update();
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace modules {
|
|||
|
||||
class pulseaudio_module : public event_module<pulseaudio_module> {
|
||||
public:
|
||||
explicit pulseaudio_module(const bar_settings&, string, const config&);
|
||||
explicit pulseaudio_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void teardown();
|
||||
bool has_event();
|
||||
|
|
|
@ -11,7 +11,7 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
class script_module : public module<script_module> {
|
||||
public:
|
||||
explicit script_module(const bar_settings&, string, const config&);
|
||||
explicit script_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void start() override;
|
||||
void stop() override;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace modules {
|
|||
|
||||
class temperature_module : public timer_module<temperature_module> {
|
||||
public:
|
||||
explicit temperature_module(const bar_settings&, string, const config&);
|
||||
explicit temperature_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
bool update();
|
||||
string get_format() const;
|
||||
|
|
|
@ -8,7 +8,7 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
class text_module : public static_module<text_module> {
|
||||
public:
|
||||
explicit text_module(const bar_settings&, string, const config&);
|
||||
explicit text_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void update() {}
|
||||
string get_format() const;
|
||||
|
|
|
@ -10,7 +10,7 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
class tray_module : public static_module<tray_module> {
|
||||
public:
|
||||
explicit tray_module(const bar_settings& bar_settings, string name_, const config&);
|
||||
explicit tray_module(const bar_settings& bar_settings, string name_, const config_ini&);
|
||||
string get_format() const;
|
||||
|
||||
void start() override;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "modules/meta/event_handler.hpp"
|
||||
#include "modules/meta/static_module.hpp"
|
||||
#include "modules/meta/types.hpp"
|
||||
|
@ -25,7 +25,7 @@ namespace modules {
|
|||
*/
|
||||
class xbacklight_module : public static_module<xbacklight_module>, public event_handler<evt::randr_notify> {
|
||||
public:
|
||||
explicit xbacklight_module(const bar_settings& bar, string name_, const config&);
|
||||
explicit xbacklight_module(const bar_settings& bar, string name_, const config_ini&);
|
||||
|
||||
void update();
|
||||
string get_output();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "common.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/types.hpp"
|
||||
#include "drawtypes/layouticonset.hpp"
|
||||
#include "modules/meta/event_handler.hpp"
|
||||
|
@ -22,7 +22,7 @@ namespace modules {
|
|||
: public static_module<xkeyboard_module>,
|
||||
public event_handler<evt::xkb_new_keyboard_notify, evt::xkb_state_notify, evt::xkb_indicator_state_notify> {
|
||||
public:
|
||||
explicit xkeyboard_module(const bar_settings& bar, string name_, const config&);
|
||||
explicit xkeyboard_module(const bar_settings& bar, string name_, const config_ini&);
|
||||
|
||||
string get_output();
|
||||
void update();
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace modules {
|
|||
class xwindow_module : public static_module<xwindow_module>, public event_handler<evt::property_notify> {
|
||||
public:
|
||||
enum class state { NONE, ACTIVE, EMPTY };
|
||||
explicit xwindow_module(const bar_settings&, string, const config&);
|
||||
explicit xwindow_module(const bar_settings&, string, const config_ini&);
|
||||
|
||||
void update();
|
||||
bool build(builder* builder, const string& tag) const;
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace modules {
|
|||
*/
|
||||
class xworkspaces_module : public static_module<xworkspaces_module>, public event_handler<evt::property_notify> {
|
||||
public:
|
||||
explicit xworkspaces_module(const bar_settings& bar, string name_, const config&);
|
||||
explicit xworkspaces_module(const bar_settings& bar, string name_, const config_ini&);
|
||||
|
||||
void update();
|
||||
string get_output();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "cairo/context.hpp"
|
||||
#include "cairo/surface.hpp"
|
||||
#include "common.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/logger.hpp"
|
||||
#include "components/types.hpp"
|
||||
#include "events/signal_fwd.hpp"
|
||||
|
@ -135,7 +135,7 @@ class tray_manager
|
|||
|
||||
const tray_settings settings() const;
|
||||
|
||||
void setup(const config&, const string& tray_module_name);
|
||||
void setup(const config_ini&, const string& tray_module_name);
|
||||
void activate();
|
||||
void activate_delayed(chrono::duration<double, std::milli> delay = 1s);
|
||||
void deactivate(bool clear_selection = true);
|
||||
|
|
|
@ -91,7 +91,7 @@ class manager : public xpp::event::sink<evt::expose, evt::client_message, evt::c
|
|||
|
||||
unsigned get_width() const;
|
||||
|
||||
void setup(const config& conf, const string& module_section_name);
|
||||
void setup(const config_ini& conf, const string& module_section_name);
|
||||
void activate();
|
||||
void wait_for_selection(xcb_window_t other);
|
||||
void deactivate();
|
||||
|
|
|
@ -60,7 +60,7 @@ set(POLY_SOURCES
|
|||
${src_dir}/components/bar.cpp
|
||||
${src_dir}/components/builder.cpp
|
||||
${src_dir}/components/command_line.cpp
|
||||
${src_dir}/components/config.cpp
|
||||
${src_dir}/components/config_ini.cpp
|
||||
${src_dir}/components/config_parser.cpp
|
||||
${src_dir}/components/controller.cpp
|
||||
${src_dir}/components/logger.cpp
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/renderer.hpp"
|
||||
#include "components/screen.hpp"
|
||||
#include "components/types.hpp"
|
||||
|
@ -39,17 +39,17 @@ using namespace eventloop;
|
|||
/**
|
||||
* Create instance
|
||||
*/
|
||||
bar::make_type bar::make(loop& loop, const config& config, bool only_initialize_values) {
|
||||
bar::make_type bar::make(loop& loop, const config_ini& config_ini, bool only_initialize_values) {
|
||||
auto action_ctxt = make_unique<tags::action_context>();
|
||||
|
||||
// clang-format off
|
||||
return std::make_unique<bar>(
|
||||
connection::make(),
|
||||
signal_emitter::make(),
|
||||
config,
|
||||
config_ini,
|
||||
logger::make(),
|
||||
loop,
|
||||
screen::make(config),
|
||||
screen::make(config_ini),
|
||||
tags::dispatch::make(*action_ctxt),
|
||||
std::move(action_ctxt),
|
||||
only_initialize_values);
|
||||
|
@ -59,12 +59,12 @@ bar::make_type bar::make(loop& loop, const config& config, bool only_initialize_
|
|||
/**
|
||||
* Construct bar instance
|
||||
*/
|
||||
bar::bar(connection& conn, signal_emitter& emitter, const config& config, const logger& logger, loop& loop,
|
||||
bar::bar(connection& conn, signal_emitter& emitter, const config_ini& config_ini, const logger& logger, loop& loop,
|
||||
unique_ptr<screen>&& screen, unique_ptr<tags::dispatch>&& dispatch, unique_ptr<tags::action_context>&& action_ctxt,
|
||||
bool only_initialize_values)
|
||||
: m_connection(conn)
|
||||
, m_sig(emitter)
|
||||
, m_conf(config)
|
||||
, m_conf(config_ini)
|
||||
, m_log(logger)
|
||||
, m_loop(loop)
|
||||
, m_screen(forward<decltype(screen)>(screen))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
|
@ -19,18 +19,18 @@ namespace chrono = std::chrono;
|
|||
/**
|
||||
* Get path of loaded file
|
||||
*/
|
||||
const string& config::filepath() const {
|
||||
const string& config_ini::filepath() const {
|
||||
return m_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the section name of the bar in use
|
||||
*/
|
||||
string config::section() const {
|
||||
string config_ini::section() const {
|
||||
return BAR_PREFIX + m_barname;
|
||||
}
|
||||
|
||||
void config::use_xrm() {
|
||||
void config_ini::use_xrm() {
|
||||
#if WITH_XRM
|
||||
/*
|
||||
* Initialize the xresource manager if there are any xrdb refs
|
||||
|
@ -43,23 +43,23 @@ void config::use_xrm() {
|
|||
#endif
|
||||
}
|
||||
|
||||
void config::set_sections(sectionmap_t sections) {
|
||||
void config_ini::set_sections(sectionmap_t sections) {
|
||||
m_sections = move(sections);
|
||||
copy_inherited();
|
||||
}
|
||||
|
||||
void config::set_included(file_list included) {
|
||||
void config_ini::set_included(file_list included) {
|
||||
m_included = move(included);
|
||||
}
|
||||
|
||||
file_list config::get_included_files() const {
|
||||
file_list config_ini::get_included_files() const {
|
||||
return m_included;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a deprecation warning if the given parameter is set
|
||||
*/
|
||||
void config::warn_deprecated(const string& section, const string& key, string replacement) const {
|
||||
void config_ini::warn_deprecated(const string& section, const string& key, string replacement) const {
|
||||
if (has(section, key)) {
|
||||
if (replacement.empty()) {
|
||||
m_log.warn(
|
||||
|
@ -108,7 +108,7 @@ void config::set(const string& section, const string& key, string&& value) {
|
|||
* [sub/section]
|
||||
* inherit = section1 section2
|
||||
*/
|
||||
void config::copy_inherited() {
|
||||
void config_ini::copy_inherited() {
|
||||
for (auto&& section : m_sections) {
|
||||
std::vector<string> inherit_sections;
|
||||
|
||||
|
@ -318,91 +318,91 @@ string config::dereference_file(string var) const {
|
|||
|
||||
|
||||
template <>
|
||||
string config::convert(string&& value) const {
|
||||
string config_ini::convert(string&& value) const {
|
||||
return forward<string>(value);
|
||||
}
|
||||
|
||||
template <>
|
||||
const char* config::convert(string&& value) const {
|
||||
const char* config_ini::convert(string&& value) const {
|
||||
return value.c_str();
|
||||
}
|
||||
|
||||
template <>
|
||||
char config::convert(string&& value) const {
|
||||
char config_ini::convert(string&& value) const {
|
||||
return value.c_str()[0];
|
||||
}
|
||||
|
||||
template <>
|
||||
int config::convert(string&& value) const {
|
||||
int config_ini::convert(string&& value) const {
|
||||
return std::strtol(value.c_str(), nullptr, 10);
|
||||
}
|
||||
|
||||
template <>
|
||||
short config::convert(string&& value) const {
|
||||
short config_ini::convert(string&& value) const {
|
||||
return static_cast<short>(std::strtol(value.c_str(), nullptr, 10));
|
||||
}
|
||||
|
||||
template <>
|
||||
bool config::convert(string&& value) const {
|
||||
bool config_ini::convert(string&& value) const {
|
||||
string lower{string_util::lower(forward<string>(value))};
|
||||
|
||||
return (lower == "true" || lower == "yes" || lower == "on" || lower == "1");
|
||||
}
|
||||
|
||||
template <>
|
||||
float config::convert(string&& value) const {
|
||||
float config_ini::convert(string&& value) const {
|
||||
return std::strtof(value.c_str(), nullptr);
|
||||
}
|
||||
|
||||
template <>
|
||||
double config::convert(string&& value) const {
|
||||
double config_ini::convert(string&& value) const {
|
||||
return std::strtod(value.c_str(), nullptr);
|
||||
}
|
||||
|
||||
template <>
|
||||
long config::convert(string&& value) const {
|
||||
long config_ini::convert(string&& value) const {
|
||||
return std::strtol(value.c_str(), nullptr, 10);
|
||||
}
|
||||
|
||||
template <>
|
||||
long long config::convert(string&& value) const {
|
||||
long long config_ini::convert(string&& value) const {
|
||||
return std::strtoll(value.c_str(), nullptr, 10);
|
||||
}
|
||||
|
||||
template <>
|
||||
unsigned char config::convert(string&& value) const {
|
||||
unsigned char config_ini::convert(string&& value) const {
|
||||
return std::strtoul(value.c_str(), nullptr, 10);
|
||||
}
|
||||
|
||||
template <>
|
||||
unsigned short config::convert(string&& value) const {
|
||||
unsigned short config_ini::convert(string&& value) const {
|
||||
return std::strtoul(value.c_str(), nullptr, 10);
|
||||
}
|
||||
|
||||
template <>
|
||||
unsigned int config::convert(string&& value) const {
|
||||
unsigned int config_ini::convert(string&& value) const {
|
||||
return std::strtoul(value.c_str(), nullptr, 10);
|
||||
}
|
||||
|
||||
template <>
|
||||
unsigned long config::convert(string&& value) const {
|
||||
unsigned long config_ini::convert(string&& value) const {
|
||||
unsigned long v{std::strtoul(value.c_str(), nullptr, 10)};
|
||||
return v < ULONG_MAX ? v : 0UL;
|
||||
}
|
||||
|
||||
template <>
|
||||
unsigned long long config::convert(string&& value) const {
|
||||
unsigned long long config_ini::convert(string&& value) const {
|
||||
unsigned long long v{std::strtoull(value.c_str(), nullptr, 10)};
|
||||
return v < ULLONG_MAX ? v : 0ULL;
|
||||
}
|
||||
|
||||
template <>
|
||||
spacing_val config::convert(string&& value) const {
|
||||
spacing_val config_ini::convert(string&& value) const {
|
||||
return units_utils::parse_spacing(value);
|
||||
}
|
||||
|
||||
template <>
|
||||
extent_val config::convert(std::string&& value) const {
|
||||
extent_val config_ini::convert(std::string&& value) const {
|
||||
return units_utils::parse_extent(value);
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ extent_val config::convert(std::string&& value) const {
|
|||
* describing a pixel offset. The actual value is calculated by X% * max + Z
|
||||
*/
|
||||
template <>
|
||||
percentage_with_offset config::convert(string&& value) const {
|
||||
percentage_with_offset config_ini::convert(string&& value) const {
|
||||
size_t i = value.find(':');
|
||||
|
||||
if (i == std::string::npos) {
|
||||
|
@ -429,22 +429,22 @@ percentage_with_offset config::convert(string&& value) const {
|
|||
}
|
||||
|
||||
template <>
|
||||
chrono::seconds config::convert(string&& value) const {
|
||||
chrono::seconds config_ini::convert(string&& value) const {
|
||||
return chrono::seconds{convert<chrono::seconds::rep>(forward<string>(value))};
|
||||
}
|
||||
|
||||
template <>
|
||||
chrono::milliseconds config::convert(string&& value) const {
|
||||
chrono::milliseconds config_ini::convert(string&& value) const {
|
||||
return chrono::milliseconds{convert<chrono::milliseconds::rep>(forward<string>(value))};
|
||||
}
|
||||
|
||||
template <>
|
||||
chrono::duration<double> config::convert(string&& value) const {
|
||||
chrono::duration<double> config_ini::convert(string&& value) const {
|
||||
return chrono::duration<double>{convert<double>(forward<string>(value))};
|
||||
}
|
||||
|
||||
template <>
|
||||
rgba config::convert(string&& value) const {
|
||||
rgba config_ini::convert(string&& value) const {
|
||||
if (value.empty()) {
|
||||
return rgba{};
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ rgba config::convert(string&& value) const {
|
|||
}
|
||||
|
||||
template <>
|
||||
cairo_operator_t config::convert(string&& value) const {
|
||||
cairo_operator_t config_ini::convert(string&& value) const {
|
||||
return cairo::utils::str2operator(forward<string>(value), CAIRO_OPERATOR_OVER);
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ POLYBAR_NS
|
|||
config_parser::config_parser(const logger& logger, string&& file)
|
||||
: m_log(logger), m_config_file(file_util::expand(file)) {}
|
||||
|
||||
config config_parser::parse(string barname) {
|
||||
config_ini config_parser::parse(string barname) {
|
||||
m_log.notice("Parsing config file: %s", m_config_file);
|
||||
|
||||
parse_file(m_config_file, {});
|
||||
|
@ -45,7 +45,7 @@ config config_parser::parse(string barname) {
|
|||
* second element onwards for the included list
|
||||
*/
|
||||
file_list included(m_files.begin() + 1, m_files.end());
|
||||
config conf(m_log, move(m_config_file), move(barname));
|
||||
config_ini conf(m_log, move(m_config_file), move(barname));
|
||||
|
||||
conf.set_sections(move(sections));
|
||||
conf.set_included(move(included));
|
||||
|
@ -98,8 +98,8 @@ sectionmap_t config_parser::create_sectionmap() {
|
|||
vector<string> config_parser::get_bars(const sectionmap_t& sections) const {
|
||||
vector<string> bars;
|
||||
for (const auto& it : sections) {
|
||||
if (it.first.find(config::BAR_PREFIX) == 0) {
|
||||
bars.push_back(it.first.substr(strlen(config::BAR_PREFIX)));
|
||||
if (it.first.find(config_ini::BAR_PREFIX) == 0) {
|
||||
bars.push_back(it.first.substr(strlen(config_ini::BAR_PREFIX)));
|
||||
}
|
||||
}
|
||||
return bars;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "components/bar.hpp"
|
||||
#include "components/builder.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/eventloop.hpp"
|
||||
#include "components/logger.hpp"
|
||||
#include "components/types.hpp"
|
||||
|
@ -32,22 +32,22 @@ using namespace modules;
|
|||
/**
|
||||
* Build controller instance
|
||||
*/
|
||||
controller::make_type controller::make(bool has_ipc, loop& loop, const config& config) {
|
||||
controller::make_type controller::make(bool has_ipc, loop& loop, const config_ini& config_ini) {
|
||||
return std::make_unique<controller>(
|
||||
connection::make(), signal_emitter::make(), logger::make(), config, has_ipc, loop);
|
||||
connection::make(), signal_emitter::make(), logger::make(), config_ini, has_ipc, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct controller
|
||||
*/
|
||||
controller::controller(
|
||||
connection& conn, signal_emitter& emitter, const logger& logger, const config& config, bool has_ipc, loop& loop)
|
||||
connection& conn, signal_emitter& emitter, const logger& logger, const config_ini& config_ini, bool has_ipc, loop& loop)
|
||||
: m_connection(conn)
|
||||
, m_sig(emitter)
|
||||
, m_log(logger)
|
||||
, m_conf(config)
|
||||
, m_conf(config_ini)
|
||||
, m_loop(loop)
|
||||
, m_bar(bar::make(m_loop, config))
|
||||
, m_bar(bar::make(m_loop, config_ini))
|
||||
, m_has_ipc(has_ipc) {
|
||||
m_conf.warn_deprecated("settings", "throttle-input-for");
|
||||
m_conf.warn_deprecated("settings", "throttle-output");
|
||||
|
@ -188,7 +188,7 @@ void controller::create_config_watcher(const string& filename) {
|
|||
}
|
||||
|
||||
void controller::confwatch_handler(const char* filename) {
|
||||
m_log.notice("Watched config file changed %s", filename);
|
||||
m_log.notice("Watched config_ini file changed %s", filename);
|
||||
stop(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <cassert>
|
||||
|
||||
#include "cairo/context.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "events/signal.hpp"
|
||||
#include "events/signal_emitter.hpp"
|
||||
#include "events/signal_receiver.hpp"
|
||||
|
@ -21,7 +21,7 @@ static constexpr double BLOCK_GAP{20.0};
|
|||
/**
|
||||
* Create instance
|
||||
*/
|
||||
renderer::make_type renderer::make(const bar_settings& bar, tags::action_context& action_ctxt, const config& conf) {
|
||||
renderer::make_type renderer::make(const bar_settings& bar, tags::action_context& action_ctxt, const config_ini& conf) {
|
||||
// clang-format off
|
||||
return std::make_unique<renderer>(
|
||||
connection::make(),
|
||||
|
@ -37,7 +37,7 @@ renderer::make_type renderer::make(const bar_settings& bar, tags::action_context
|
|||
/**
|
||||
* Construct renderer instance
|
||||
*/
|
||||
renderer::renderer(connection& conn, signal_emitter& sig, const config& conf, const logger& logger,
|
||||
renderer::renderer(connection& conn, signal_emitter& sig, const config_ini& conf, const logger& logger,
|
||||
const bar_settings& bar, background_manager& background, tags::action_context& action_ctxt)
|
||||
: renderer_interface(action_ctxt)
|
||||
, m_connection(conn)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <csignal>
|
||||
#include <thread>
|
||||
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/logger.hpp"
|
||||
#include "components/types.hpp"
|
||||
#include "events/signal.hpp"
|
||||
|
@ -22,14 +22,14 @@ using namespace signals::eventqueue;
|
|||
/**
|
||||
* Create instance
|
||||
*/
|
||||
screen::make_type screen::make(const config& config) {
|
||||
return std::make_unique<screen>(connection::make(), signal_emitter::make(), logger::make(), config);
|
||||
screen::make_type screen::make(const config_ini& config_ini) {
|
||||
return std::make_unique<screen>(connection::make(), signal_emitter::make(), logger::make(), config_ini);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct screen instance
|
||||
*/
|
||||
screen::screen(connection& conn, signal_emitter& emitter, const logger& logger, const config& conf)
|
||||
screen::screen(connection& conn, signal_emitter& emitter, const logger& logger, const config_ini& conf)
|
||||
: m_connection(conn)
|
||||
, m_sig(emitter)
|
||||
, m_log(logger)
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace drawtypes {
|
|||
* Create an animation by loading values
|
||||
* from the configuration
|
||||
*/
|
||||
animation_t load_animation(const config& conf, const string& section, string name, bool required) {
|
||||
animation_t load_animation(const config_ini& conf, const string& section, string name, bool required) {
|
||||
vector<label_t> vec;
|
||||
vector<string> frames;
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace drawtypes {
|
|||
/**
|
||||
* Create a label by loading values from the configuration
|
||||
*/
|
||||
label_t load_label(const config& conf, const string& section, string name, bool required, string def) {
|
||||
label_t load_label(const config_ini& conf, const string& section, string name, bool required, string def) {
|
||||
vector<token> tokens;
|
||||
size_t start, end, pos;
|
||||
|
||||
|
@ -315,7 +315,7 @@ namespace drawtypes {
|
|||
/**
|
||||
* Create a label by loading optional values from the configuration
|
||||
*/
|
||||
label_t load_optional_label(const config& conf, string section, string name, string def) {
|
||||
label_t load_optional_label(const config_ini& conf, string section, string name, string def) {
|
||||
return load_label(conf, section, move(name), false, move(def));
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace drawtypes {
|
|||
* Create a progressbar by loading values
|
||||
* from the configuration
|
||||
*/
|
||||
progressbar_t load_progressbar(const bar_settings& bar, const config& conf, const string& section, string name) {
|
||||
progressbar_t load_progressbar(const bar_settings& bar, const config_ini& conf, const string& section, string name) {
|
||||
// Remove the start and end tag from the name in case a format tag is passed
|
||||
name = string_util::ltrim(string_util::rtrim(move(name), '>'), '<');
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace drawtypes {
|
|||
* Create a ramp by loading values
|
||||
* from the configuration
|
||||
*/
|
||||
ramp_t load_ramp(const config& conf, const string& section, string name, bool required) {
|
||||
ramp_t load_ramp(const config_ini& conf, const string& section, string name, bool required) {
|
||||
name = string_util::ltrim(string_util::rtrim(move(name), '>'), '<');
|
||||
|
||||
auto ramp_defaults = load_optional_label(conf, section, name);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "components/bar.hpp"
|
||||
#include "components/command_line.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/config_parser.hpp"
|
||||
#include "components/controller.hpp"
|
||||
#include "ipc/ipc.hpp"
|
||||
|
@ -128,7 +128,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
config_parser parser{logger, move(confpath)};
|
||||
config conf = parser.parse(move(barname));
|
||||
config_ini conf = parser.parse(move(barname));
|
||||
|
||||
//==================================================
|
||||
// Dump requested data
|
||||
|
|
|
@ -17,8 +17,8 @@ using namespace alsa;
|
|||
namespace modules {
|
||||
template class module<alsa_module>;
|
||||
|
||||
alsa_module::alsa_module(const bar_settings& bar, string name_, const config& config)
|
||||
: event_module<alsa_module>(bar, move(name_), config) {
|
||||
alsa_module::alsa_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: event_module<alsa_module>(bar, move(name_), config_ini) {
|
||||
if (m_handle_events) {
|
||||
m_router->register_action(EVENT_DEC, [this]() { action_dec(); });
|
||||
m_router->register_action(EVENT_INC, [this]() { action_inc(); });
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace modules {
|
|||
return std::strtof(file_util::contents(m_path).c_str(), nullptr);
|
||||
}
|
||||
|
||||
backlight_module::backlight_module(const bar_settings& bar, string name_, const config& config)
|
||||
: inotify_module<backlight_module>(bar, move(name_), config) {
|
||||
backlight_module::backlight_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: inotify_module<backlight_module>(bar, move(name_), config_ini) {
|
||||
m_router->register_action(EVENT_DEC, [this]() { action_dec(); });
|
||||
m_router->register_action(EVENT_INC, [this]() { action_inc(); });
|
||||
auto card = m_conf.get(name(), "card", ""s);
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace modules {
|
|||
/**
|
||||
* Bootstrap module by setting up required components
|
||||
*/
|
||||
battery_module::battery_module(const bar_settings& bar, string name_, const config& config)
|
||||
: inotify_module<battery_module>(bar, move(name_), config) {
|
||||
battery_module::battery_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: inotify_module<battery_module>(bar, move(name_), config_ini) {
|
||||
// Load configuration values
|
||||
m_fullat = std::min(m_conf.get(name(), "full-at", m_fullat), 100);
|
||||
m_lowat = std::max(m_conf.get(name(), "low-at", m_lowat), 0);
|
||||
|
|
|
@ -39,8 +39,8 @@ namespace {
|
|||
namespace modules {
|
||||
template class module<bspwm_module>;
|
||||
|
||||
bspwm_module::bspwm_module(const bar_settings& bar, string name_, const config& config)
|
||||
: event_module<bspwm_module>(bar, move(name_), config) {
|
||||
bspwm_module::bspwm_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: event_module<bspwm_module>(bar, move(name_), config_ini) {
|
||||
m_router->register_action_with_data(EVENT_FOCUS, [this](const std::string& data) { action_focus(data); });
|
||||
m_router->register_action(EVENT_NEXT, [this]() { action_next(); });
|
||||
m_router->register_action(EVENT_PREV, [this]() { action_prev(); });
|
||||
|
|
|
@ -7,8 +7,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<counter_module>;
|
||||
|
||||
counter_module::counter_module(const bar_settings& bar, string name_, const config& config)
|
||||
: timer_module<counter_module>(bar, move(name_), config) {
|
||||
counter_module::counter_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: timer_module<counter_module>(bar, move(name_), config_ini) {
|
||||
set_interval(1s);
|
||||
m_formatter->add(DEFAULT_FORMAT, TAG_COUNTER, {TAG_COUNTER});
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<cpu_module>;
|
||||
|
||||
cpu_module::cpu_module(const bar_settings& bar, string name_, const config& config)
|
||||
: timer_module<cpu_module>(bar, move(name_), config) {
|
||||
cpu_module::cpu_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: timer_module<cpu_module>(bar, move(name_), config_ini) {
|
||||
set_interval(1s);
|
||||
m_totalwarn = m_conf.get(name(), "warn-percentage", m_totalwarn);
|
||||
m_ramp_padding = m_conf.get(name(), "ramp-coreload-spacing", m_ramp_padding);
|
||||
|
|
|
@ -8,8 +8,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<date_module>;
|
||||
|
||||
date_module::date_module(const bar_settings& bar, string name_, const config& config)
|
||||
: timer_module<date_module>(bar, move(name_), config) {
|
||||
date_module::date_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: timer_module<date_module>(bar, move(name_), config_ini) {
|
||||
if (!m_bar.locale.empty()) {
|
||||
datetime_stream.imbue(std::locale(m_bar.locale.c_str()));
|
||||
}
|
||||
|
|
|
@ -23,11 +23,11 @@ namespace modules {
|
|||
template class module<fs_module>;
|
||||
|
||||
/**
|
||||
* Bootstrap the module by reading config values and
|
||||
* Bootstrap the module by reading config_ini values and
|
||||
* setting up required components
|
||||
*/
|
||||
fs_module::fs_module(const bar_settings& bar, string name_, const config& config)
|
||||
: timer_module<fs_module>(bar, move(name_), config) {
|
||||
fs_module::fs_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: timer_module<fs_module>(bar, move(name_), config_ini) {
|
||||
m_mountpoints = m_conf.get_list(name(), "mount", {});
|
||||
if (m_mountpoints.empty()) {
|
||||
m_log.info("%s: No mountpoints specified, using fallback \"/\"", name());
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace modules {
|
|||
/**
|
||||
* Construct module
|
||||
*/
|
||||
github_module::github_module(const bar_settings& bar, string name_, const config& config)
|
||||
: timer_module<github_module>(bar, move(name_), config) {
|
||||
github_module::github_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: timer_module<github_module>(bar, move(name_), config_ini) {
|
||||
m_accesstoken = m_conf.get(name(), "token");
|
||||
m_user = m_conf.get(name(), "user", ""s);
|
||||
m_api_url = m_conf.get(name(), "api-url", "https://api.github.com/"s);
|
||||
|
|
|
@ -14,7 +14,7 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<i3_module>;
|
||||
|
||||
i3_module::i3_module(const bar_settings& bar, string name_, const config& conf)
|
||||
i3_module::i3_module(const bar_settings& bar, string name_, const config_ini& conf)
|
||||
: event_module<i3_module>(bar, move(name_), conf) {
|
||||
m_router->register_action_with_data(EVENT_FOCUS, [this](const std::string& data) { action_focus(data); });
|
||||
m_router->register_action(EVENT_NEXT, [this]() { action_next(); });
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace modules {
|
|||
* Load user-defined ipc hooks and
|
||||
* create formatting tags
|
||||
*/
|
||||
ipc_module::ipc_module(const bar_settings& bar, string name_, const config& config)
|
||||
: module<ipc_module>(bar, move(name_), config) {
|
||||
ipc_module::ipc_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: module<ipc_module>(bar, move(name_), config_ini) {
|
||||
m_router->register_action_with_data(EVENT_SEND, [this](const std::string& data) { action_send(data); });
|
||||
m_router->register_action_with_data(EVENT_HOOK, [this](const std::string& data) { action_hook(data); });
|
||||
m_router->register_action(EVENT_NEXT, [this]() { action_next(); });
|
||||
|
@ -139,7 +139,7 @@ namespace modules {
|
|||
|
||||
/**
|
||||
* Map received message hook to the ones
|
||||
* configured from the user config and
|
||||
* configured from the user config_ini and
|
||||
* execute its command
|
||||
*
|
||||
* This code path is deprecated, all messages to ipc modules should go through actions.
|
||||
|
|
|
@ -15,8 +15,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<memory_module>;
|
||||
|
||||
memory_module::memory_module(const bar_settings& bar, string name_, const config& config)
|
||||
: timer_module<memory_module>(bar, move(name_), config) {
|
||||
memory_module::memory_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: timer_module<memory_module>(bar, move(name_), config_ini) {
|
||||
set_interval(1s);
|
||||
m_perc_memused_warn = m_conf.get(name(), "warn-percentage", 90);
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<menu_module>;
|
||||
|
||||
menu_module::menu_module(const bar_settings& bar, string name_, const config& config)
|
||||
: static_module<menu_module>(bar, move(name_), config) {
|
||||
menu_module::menu_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: static_module<menu_module>(bar, move(name_), config_ini) {
|
||||
m_expand_right = m_conf.get(name(), "expand-right", m_expand_right);
|
||||
|
||||
m_router->register_action_with_data(EVENT_OPEN, [this](const std::string& data) { action_open(data); });
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace modules {
|
|||
/**
|
||||
* Function pointer for creating a module.
|
||||
*/
|
||||
using factory_fun = module_t (*)(const bar_settings&, string&&, const config&);
|
||||
using factory_fun = module_t (*)(const bar_settings&, string&&, const config_ini&);
|
||||
using factory_map = map<string, factory_fun>;
|
||||
|
||||
/**
|
||||
|
@ -19,8 +19,8 @@ namespace modules {
|
|||
*/
|
||||
template <typename M>
|
||||
static constexpr factory_fun get_factory() {
|
||||
return [](const bar_settings& bar, string&& module_name, const config& config) -> module_t {
|
||||
return make_shared<M>(bar, move(module_name), config);
|
||||
return [](const bar_settings& bar, string&& module_name, const config_ini& config_ini) -> module_t {
|
||||
return make_shared<M>(bar, move(module_name), config_ini);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ namespace modules {
|
|||
map_entry<ipc_module>(),
|
||||
};
|
||||
|
||||
module_t make_module(string&& type, const bar_settings& bar, string module_name, const logger& log, const config& config) {
|
||||
module_t make_module(string&& type, const bar_settings& bar, string module_name, const logger& log, const config_ini& config_ini) {
|
||||
string actual_type = type;
|
||||
|
||||
if (type == "internal/volume") {
|
||||
|
@ -114,7 +114,7 @@ namespace modules {
|
|||
|
||||
auto it = factories.find(actual_type);
|
||||
if (it != factories.end()) {
|
||||
return it->second(bar, std::move(module_name), config);
|
||||
return it->second(bar, std::move(module_name), config_ini);
|
||||
} else {
|
||||
throw application_error("Unknown module: " + type);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<mpd_module>;
|
||||
|
||||
mpd_module::mpd_module(const bar_settings& bar, string name_, const config& config)
|
||||
: event_module<mpd_module>(bar, move(name_), config) {
|
||||
mpd_module::mpd_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: event_module<mpd_module>(bar, move(name_), config_ini) {
|
||||
m_router->register_action(EVENT_PLAY, [this]() { action_play(); });
|
||||
m_router->register_action(EVENT_PAUSE, [this]() { action_pause(); });
|
||||
m_router->register_action(EVENT_STOP, [this]() { action_stop(); });
|
||||
|
|
|
@ -10,8 +10,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<network_module>;
|
||||
|
||||
network_module::network_module(const bar_settings& bar, string name_, const config& config)
|
||||
: timer_module<network_module>(bar, move(name_), config) {
|
||||
network_module::network_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: timer_module<network_module>(bar, move(name_), config_ini) {
|
||||
// Load configuration values
|
||||
m_interface = m_conf.get(name(), "interface", m_interface);
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<pulseaudio_module>;
|
||||
|
||||
pulseaudio_module::pulseaudio_module(const bar_settings& bar, string name_, const config& config)
|
||||
: event_module<pulseaudio_module>(bar, move(name_), config) {
|
||||
pulseaudio_module::pulseaudio_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: event_module<pulseaudio_module>(bar, move(name_), config_ini) {
|
||||
if (m_handle_events) {
|
||||
m_router->register_action(EVENT_DEC, [this]() { action_dec(); });
|
||||
m_router->register_action(EVENT_INC, [this]() { action_inc(); });
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
POLYBAR_NS
|
||||
|
||||
namespace modules {
|
||||
script_module::script_module(const bar_settings& bar, string name_, const config& config)
|
||||
: module<script_module>(bar, move(name_), config)
|
||||
script_module::script_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: module<script_module>(bar, move(name_), config_ini)
|
||||
, m_tail(m_conf.get(name(), "tail", false))
|
||||
, m_interval_success(m_conf.get<script_runner::interval>(name(), "interval", m_tail ? 0s : 5s))
|
||||
, m_interval_fail(m_conf.get<script_runner::interval>(name(), "interval-fail", m_interval_success))
|
||||
|
|
|
@ -13,8 +13,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<temperature_module>;
|
||||
|
||||
temperature_module::temperature_module(const bar_settings& bar, string name_, const config& config)
|
||||
: timer_module<temperature_module>(bar, move(name_), config) {
|
||||
temperature_module::temperature_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: timer_module<temperature_module>(bar, move(name_), config_ini) {
|
||||
m_zone = m_conf.get(name(), "thermal-zone", 0);
|
||||
m_zone_type = m_conf.get(name(), "zone-type", ""s);
|
||||
m_path = m_conf.get(name(), "hwmon-path", ""s);
|
||||
|
@ -81,7 +81,7 @@ namespace modules {
|
|||
string temp_f_string = to_string(temp_f);
|
||||
string temp_k_string = to_string(temp_k);
|
||||
|
||||
// Add units if `units = true` in config
|
||||
// Add units if `units = true` in config_ini
|
||||
if(m_units) {
|
||||
temp_c_string += "°C";
|
||||
temp_f_string += "°F";
|
||||
|
|
|
@ -8,8 +8,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<text_module>;
|
||||
|
||||
text_module::text_module(const bar_settings& bar, string name_, const config& config)
|
||||
: static_module<text_module>(bar, move(name_), config) {
|
||||
text_module::text_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: static_module<text_module>(bar, move(name_), config_ini) {
|
||||
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL});
|
||||
m_formatter->add_optional("content", {});
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ POLYBAR_NS
|
|||
namespace modules {
|
||||
template class module<tray_module>;
|
||||
|
||||
tray_module::tray_module(const bar_settings& bar_settings, string name_, const config& config)
|
||||
: static_module<tray_module>(bar_settings, move(name_), config)
|
||||
tray_module::tray_module(const bar_settings& bar_settings, string name_, const config_ini& config_ini)
|
||||
: static_module<tray_module>(bar_settings, move(name_), config_ini)
|
||||
, m_tray(connection::make(), signal_emitter::make(), m_log, bar_settings, [&] { this->broadcast(); }) {
|
||||
m_formatter->add(DEFAULT_FORMAT, TAG_TRAY, {TAG_TRAY});
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace modules {
|
|||
/**
|
||||
* Construct module
|
||||
*/
|
||||
xbacklight_module::xbacklight_module(const bar_settings& bar, string name_, const config& config)
|
||||
: static_module<xbacklight_module>(bar, move(name_), config), m_connection(connection::make()) {
|
||||
xbacklight_module::xbacklight_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: static_module<xbacklight_module>(bar, move(name_), config_ini), m_connection(connection::make()) {
|
||||
m_router->register_action(EVENT_INC, [this]() { action_inc(); });
|
||||
m_router->register_action(EVENT_DEC, [this]() { action_dec(); });
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace modules {
|
|||
}
|
||||
|
||||
/**
|
||||
* Output content as defined in the config
|
||||
* Output content as defined in the config_ini
|
||||
*/
|
||||
bool xbacklight_module::build(builder* builder, const string& tag) const {
|
||||
if (tag == TAG_BAR) {
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace modules {
|
|||
/**
|
||||
* Construct module
|
||||
*/
|
||||
xkeyboard_module::xkeyboard_module(const bar_settings& bar, string name_, const config& config)
|
||||
: static_module<xkeyboard_module>(bar, move(name_), config), m_connection(connection::make()) {
|
||||
xkeyboard_module::xkeyboard_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: static_module<xkeyboard_module>(bar, move(name_), config_ini), m_connection(connection::make()) {
|
||||
m_router->register_action(EVENT_SWITCH, [this]() { action_switch(); });
|
||||
|
||||
// Setup extension
|
||||
|
@ -40,7 +40,7 @@ namespace modules {
|
|||
// Create keyboard object
|
||||
query_keyboard();
|
||||
|
||||
// Load config values
|
||||
// Load config_ini values
|
||||
m_blacklist = m_conf.get_list(name(), "blacklist", {});
|
||||
|
||||
// load layout icons
|
||||
|
|
|
@ -69,8 +69,8 @@ namespace modules {
|
|||
/**
|
||||
* Construct module
|
||||
*/
|
||||
xwindow_module::xwindow_module(const bar_settings& bar, string name_, const config& config)
|
||||
: static_module<xwindow_module>(bar, move(name_), config), m_connection(connection::make()) {
|
||||
xwindow_module::xwindow_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: static_module<xwindow_module>(bar, move(name_), config_ini), m_connection(connection::make()) {
|
||||
// Initialize ewmh atoms
|
||||
ewmh_util::initialize();
|
||||
|
||||
|
@ -137,7 +137,7 @@ namespace modules {
|
|||
}
|
||||
|
||||
/**
|
||||
* Output content as defined in the config
|
||||
* Output content as defined in the config_ini
|
||||
*/
|
||||
bool xwindow_module::build(builder* builder, const string& tag) const {
|
||||
if (tag == TAG_LABEL && m_label) {
|
||||
|
|
|
@ -27,15 +27,15 @@ namespace modules {
|
|||
/**
|
||||
* Construct module
|
||||
*/
|
||||
xworkspaces_module::xworkspaces_module(const bar_settings& bar, string name_, const config& config)
|
||||
: static_module<xworkspaces_module>(bar, move(name_), config)
|
||||
xworkspaces_module::xworkspaces_module(const bar_settings& bar, string name_, const config_ini& config_ini)
|
||||
: static_module<xworkspaces_module>(bar, move(name_), config_ini)
|
||||
, m_connection(connection::make())
|
||||
, m_ewmh(ewmh_util::initialize()) {
|
||||
m_router->register_action_with_data(EVENT_FOCUS, [this](const std::string& data) { action_focus(data); });
|
||||
m_router->register_action(EVENT_NEXT, [this]() { action_next(); });
|
||||
m_router->register_action(EVENT_PREV, [this]() { action_prev(); });
|
||||
|
||||
// Load config values
|
||||
// Load config_ini values
|
||||
m_pinworkspaces = m_conf.get(name(), "pin-workspaces", m_pinworkspaces);
|
||||
m_click = m_conf.get(name(), "enable-click", m_click);
|
||||
m_scroll = m_conf.get(name(), "enable-scroll", m_scroll);
|
||||
|
@ -355,7 +355,7 @@ namespace modules {
|
|||
}
|
||||
|
||||
/**
|
||||
* Output content as defined in the config
|
||||
* Output content as defined in the config_ini
|
||||
*/
|
||||
bool xworkspaces_module::build(builder* builder, const string& tag) const {
|
||||
if (tag == TAG_LABEL_MONITOR) {
|
||||
|
|
|
@ -286,7 +286,7 @@ namespace file_util {
|
|||
}
|
||||
|
||||
/*
|
||||
* Search for polybar config and returns the path if found
|
||||
* Search for polybar config_ini and returns the path if found
|
||||
*/
|
||||
string get_config_path() {
|
||||
const static string suffix = "/polybar/config";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "cairo/context.hpp"
|
||||
#include "cairo/surface.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "components/logger.hpp"
|
||||
#include "events/signal.hpp"
|
||||
#include "utils/factory.hpp"
|
||||
|
|
|
@ -54,7 +54,7 @@ tray_manager::~tray_manager() {
|
|||
deactivate();
|
||||
}
|
||||
|
||||
void tray_manager::setup(const config& conf, const string& tray_module_name) {
|
||||
void tray_manager::setup(const config_ini& conf, const string& tray_module_name) {
|
||||
auto bs = conf.section();
|
||||
string position = conf.get(bs, "tray-position", "none"s);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "cairo/context.hpp"
|
||||
#include "cairo/surface.hpp"
|
||||
#include "components/config.hpp"
|
||||
#include "components/config_ini.hpp"
|
||||
#include "errors.hpp"
|
||||
#include "events/signal.hpp"
|
||||
#include "utils/color.hpp"
|
||||
|
@ -49,7 +49,7 @@ manager::~manager() {
|
|||
deactivate();
|
||||
}
|
||||
|
||||
void manager::setup(const config& conf, const string& section_name) {
|
||||
void manager::setup(const config_ini& conf, const string& section_name) {
|
||||
unsigned bar_height = m_bar_opts.inner_area().height;
|
||||
|
||||
// Spacing between icons
|
||||
|
|
Loading…
Reference in New Issue