From 1af06617017785ff4115f0420fce08797647c6cf Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Thu, 3 Aug 2023 11:02:33 +0300 Subject: allow disabling bar on certain outputs --- src/config.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 8465eee..5b657d0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -3,6 +3,7 @@ use crate::protocol::zwlr_layer_surface_v1; use anyhow::{Context, Result}; use pangocairo::pango::FontDescription; use serde::{de, Deserialize}; +use std::collections::HashMap; use std::fs::read_to_string; use std::ops::Deref; use std::path::PathBuf; @@ -44,6 +45,8 @@ pub struct Config { pub show_layout_name: bool, // wm-specific pub wm: WmConfig, + // overrides + pub output: HashMap, } impl Default for Config { @@ -84,6 +87,8 @@ impl Default for Config { wm: WmConfig { river: RiverConfig { max_tag: 9 }, }, + + output: HashMap::new(), } } } @@ -110,6 +115,13 @@ impl Config { } }) } + + pub fn output_enabled(&self, output: &str) -> bool { + self.output + .get(output) + .and_then(|o| o.enable) + .unwrap_or(true) + } } fn config_dir() -> Option { @@ -144,6 +156,12 @@ pub struct RiverConfig { pub max_tag: u8, } +#[derive(Debug, Deserialize)] +pub struct OutputOverrides { + #[serde(default)] + enable: Option, +} + #[derive(Debug)] pub struct Font(pub FontDescription); -- cgit v1.3.1