diff --git a/README.md b/README.md index fef19cba..b28b2b71 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ The monitor's config object takes any combination of `left`, `center`, and `righ | Name | Type | Default | Description | |------------|-------------------|---------|-----------------------------------------------------------------------------| | `position` | `top` or `bottom` | `[]` | The bar's position on screen. | +| `height` | `integer` | `42` | The bar's height in pixels. | | `left` | `Module[]` | `[]` | Array of left modules. | | `center` | `Module[]` | `[]` | Array of center modules. | | `right` | `Module[]` | `[]` | Array of right modules. | diff --git a/src/bar.rs b/src/bar.rs index f1377833..bca30e17 100644 --- a/src/bar.rs +++ b/src/bar.rs @@ -14,7 +14,7 @@ pub fn create_bar(app: &Application, monitor: &Monitor, monitor_name: &str, conf .orientation(Orientation::Horizontal) .spacing(0) .hexpand(false) - .height_request(42) + .height_request(config.height) .name("bar") .build(); diff --git a/src/config.rs b/src/config.rs index 598c1c9d..61ef0607 100644 --- a/src/config.rs +++ b/src/config.rs @@ -40,6 +40,8 @@ impl Default for BarPosition { pub struct Config { #[serde(default = "default_bar_position")] pub position: BarPosition, + #[serde(default = "default_bar_height")] + pub height: i32, pub left: Option>, pub center: Option>, @@ -52,6 +54,10 @@ const fn default_bar_position() -> BarPosition { BarPosition::Bottom } +const fn default_bar_height() -> i32 { + 42 +} + impl Config { pub fn load() -> Option { let config_dir = config_dir().expect("Failed to locate user config dir");