xbacklight: Use monitor-strict from bar settings

monitor-strict in the xbacklight module was never documented anywhere so
it's fine to remove it.
This commit is contained in:
patrick96 2018-12-03 01:34:40 +01:00 committed by Patrick Ziegler
parent e793082008
commit 4a506d429d
3 changed files with 5 additions and 5 deletions

View File

@ -123,6 +123,7 @@ struct bar_settings {
xcb_window_t window{XCB_NONE};
monitor_t monitor{};
bool monitor_strict{false};
bool monitor_exact{true};
edge origin{edge::TOP};
struct size size {

View File

@ -72,15 +72,15 @@ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const
// Get available RandR outputs
auto monitor_name = m_conf.get(bs, "monitor", ""s);
auto monitor_name_fallback = m_conf.get(bs, "monitor-fallback", ""s);
auto monitor_strictmode = m_conf.get(bs, "monitor-strict", false);
m_opts.monitor_strict = m_conf.get(bs, "monitor-strict", m_opts.monitor_strict);
m_opts.monitor_exact = m_conf.get(bs, "monitor-exact", m_opts.monitor_exact);
auto monitors = randr_util::get_monitors(m_connection, m_connection.screen()->root, monitor_strictmode);
auto monitors = randr_util::get_monitors(m_connection, m_connection.screen()->root, m_opts.monitor_strict);
if (monitors.empty()) {
throw application_error("No monitors found");
}
if (monitor_name.empty() && !monitor_strictmode) {
if (monitor_name.empty() && !m_opts.monitor_strict) {
auto connected_monitors = randr_util::get_monitors(m_connection, m_connection.screen()->root, true);
if (!connected_monitors.empty()) {
monitor_name = connected_monitors[0]->name;

View File

@ -19,9 +19,8 @@ namespace modules {
xbacklight_module::xbacklight_module(const bar_settings& bar, string name_)
: static_module<xbacklight_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);
auto monitors = randr_util::get_monitors(m_connection, m_connection.root(), strict);
auto monitors = randr_util::get_monitors(m_connection, m_connection.root(), bar.monitor_strict);
m_output = randr_util::match_monitor(monitors, output, bar.monitor_exact);