summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorMaxVerevkin <maxxverrr@gmail.com>2023-08-03 11:02:33 +0300
committerMaxVerevkin <maxxverrr@gmail.com>2023-08-03 11:03:11 +0300
commit1af06617017785ff4115f0420fce08797647c6cf (patch)
tree007804b3f0098761cc431542390fa1d40959d742 /src/config.rs
parentf837f89f7d8f761aacbd7d70126bf5cbd765c1e9 (diff)
downloadi3bar-mango-1af06617017785ff4115f0420fce08797647c6cf.tar.gz
allow disabling bar on certain outputs
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs18
1 files changed, 18 insertions, 0 deletions
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<String, OutputOverrides>,
}
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<PathBuf> {
@@ -144,6 +156,12 @@ pub struct RiverConfig {
pub max_tag: u8,
}
+#[derive(Debug, Deserialize)]
+pub struct OutputOverrides {
+ #[serde(default)]
+ enable: Option<bool>,
+}
+
#[derive(Debug)]
pub struct Font(pub FontDescription);