refactor(bar): Make monitor vector local

This commit is contained in:
Michael Carlberg 2016-06-14 12:12:58 +02:00
parent 3bc408e3cf
commit c959d2c7c6

View File

@ -35,8 +35,6 @@ std::shared_ptr<Bar> &get_bar()
return bar; return bar;
} }
std::vector<std::unique_ptr<xlib::Monitor>> monitors;
const Options& bar_opts() { const Options& bar_opts() {
return *bar->opts.get(); return *bar->opts.get();
} }
@ -56,8 +54,7 @@ Bar::Bar() : config_path(config::get_bar_path()), opts(std::make_unique<Options>
auto monitor_name = config::get<std::string>(this->config_path, "monitor", ""); auto monitor_name = config::get<std::string>(this->config_path, "monitor", "");
this->opts->monitor = std::make_unique<xlib::Monitor>(); this->opts->monitor = std::make_unique<xlib::Monitor>();
if (monitors.empty()) auto monitors = xlib::get_sorted_monitorlist();
monitors = xlib::get_sorted_monitorlist();
// In case we're not connected to X, we'll just ignore the monitor // In case we're not connected to X, we'll just ignore the monitor
if (!monitors.empty()) { if (!monitors.empty()) {