refactor: Cleanup
This commit is contained in:
parent
bff119834a
commit
83f7d2ce91
@ -8,7 +8,8 @@ POLYBAR_NS
|
|||||||
|
|
||||||
class xresource_manager {
|
class xresource_manager {
|
||||||
public:
|
public:
|
||||||
static const xresource_manager& make();
|
using make_type = const xresource_manager&;
|
||||||
|
static make_type make();
|
||||||
|
|
||||||
explicit xresource_manager();
|
explicit xresource_manager();
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ POLYBAR_NS
|
|||||||
* Create instance
|
* Create instance
|
||||||
*/
|
*/
|
||||||
config::make_type config::make(string path, string bar) {
|
config::make_type config::make(string path, string bar) {
|
||||||
return static_cast<const config&>(
|
return static_cast<config::make_type>(*factory_util::singleton<std::remove_reference_t<config::make_type>>(
|
||||||
*factory_util::singleton<const config>(logger::make(), xresource_manager::make(), move(path), move(bar)));
|
*factory_util::singleton<const config>(logger::make(), xresource_manager::make(), move(path), move(bar))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@ controller::make_type controller::make(string&& path_confwatch, bool enable_ipc,
|
|||||||
eventloop::make(),
|
eventloop::make(),
|
||||||
bar::make(),
|
bar::make(),
|
||||||
enable_ipc ? ipc::make() : ipc::make_type{},
|
enable_ipc ? ipc::make() : ipc::make_type{},
|
||||||
!path_confwatch.empty() ? inotify_util::make_watch(path_confwatch) : watch_t{},
|
!path_confwatch.empty() ? inotify_util::make_watch(forward<decltype(path_confwatch)>(path_confwatch)) : watch_t{},
|
||||||
writeback);
|
writeback);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,6 @@ POLYBAR_NS
|
|||||||
* Create instance
|
* Create instance
|
||||||
*/
|
*/
|
||||||
logger::make_type logger::make(loglevel level) {
|
logger::make_type logger::make(loglevel level) {
|
||||||
#ifndef DEBUG
|
|
||||||
if (level == loglevel::TRACE) {
|
|
||||||
throw application_error("not a debug build: trace disabled...");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return static_cast<const logger&>(*factory_util::singleton<const logger>(level));
|
return static_cast<const logger&>(*factory_util::singleton<const logger>(level));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +47,7 @@ logger::logger(loglevel level) : m_level(level) {
|
|||||||
void logger::verbosity(loglevel&& level) {
|
void logger::verbosity(loglevel&& level) {
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
if (level == loglevel::TRACE) {
|
if (level == loglevel::TRACE) {
|
||||||
throw application_error("Not a debug build; trace disabled...");
|
throw application_error("Trace logging is only enabled for debug builds...");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
m_level = forward<decltype(level)>(level);
|
m_level = forward<decltype(level)>(level);
|
||||||
|
10
src/main.cpp
10
src/main.cpp
@ -48,8 +48,9 @@ int main(int argc, char** argv) {
|
|||||||
throw exit_failure{};
|
throw exit_failure{};
|
||||||
}
|
}
|
||||||
|
|
||||||
connection{xcbconn}.preload_atoms();
|
connection conn{xcbconn};
|
||||||
connection{xcbconn}.query_extensions();
|
conn.preload_atoms();
|
||||||
|
conn.query_extensions();
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
// Block all signals by default
|
// Block all signals by default
|
||||||
@ -160,8 +161,9 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("Reload application...");
|
logger.warn("Re-launching application...");
|
||||||
process_util::exec(argv[0], argv);
|
logger.info("Re-launching application...");
|
||||||
|
process_util::exec(move(argv[0]), move(argv));
|
||||||
} catch (const system_error& err) {
|
} catch (const system_error& err) {
|
||||||
logger.err("execlp() failed (%s)", strerror(errno));
|
logger.err("execlp() failed (%s)", strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ POLYBAR_NS
|
|||||||
* Create instance
|
* Create instance
|
||||||
*/
|
*/
|
||||||
connection::make_type connection::make() {
|
connection::make_type connection::make() {
|
||||||
return static_cast<connection&>(
|
return static_cast<connection::make_type>(*factory_util::singleton<std::remove_reference_t<connection::make_type>>(
|
||||||
*factory_util::singleton<connection>(xutils::get_connection(), xutils::get_connection_fd()));
|
xutils::get_connection(), xutils::get_connection_fd()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,9 @@ POLYBAR_NS
|
|||||||
/**
|
/**
|
||||||
* Create instance
|
* Create instance
|
||||||
*/
|
*/
|
||||||
const xresource_manager& xresource_manager::make() {
|
xresource_manager::make_type xresource_manager::make() {
|
||||||
return static_cast<const xresource_manager&>(*factory_util::singleton<xresource_manager>());
|
return static_cast<xresource_manager::make_type>(
|
||||||
|
*factory_util::singleton<std::remove_reference_t<xresource_manager::make_type>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user