From 4a506d429d6d1b0dde9961e0bd760ea9cba8e6d1 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Mon, 3 Dec 2018 01:34:40 +0100
Subject: [PATCH] xbacklight: Use monitor-strict from bar settings
monitor-strict in the xbacklight module was never documented anywhere so
it's fine to remove it.
---
include/components/types.hpp | 1 +
src/components/bar.cpp | 6 +++---
src/modules/xbacklight.cpp | 3 +--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/components/types.hpp b/include/components/types.hpp
index b24e58d0..dba383af 100644
--- a/include/components/types.hpp
+++ b/include/components/types.hpp
@@ -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 {
diff --git a/src/components/bar.cpp b/src/components/bar.cpp
index 1bdb7640..f315dd57 100644
--- a/src/components/bar.cpp
+++ b/src/components/bar.cpp
@@ -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;
diff --git a/src/modules/xbacklight.cpp b/src/modules/xbacklight.cpp
index 0364dfc1..e9baf5d3 100644
--- a/src/modules/xbacklight.cpp
+++ b/src/modules/xbacklight.cpp
@@ -19,9 +19,8 @@ namespace modules {
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);
- 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);