Skip to content

Commit

Permalink
feat: config option for bar height
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeStanger committed Aug 14, 2022
1 parent dc14cb0 commit 2e0f033
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
2 changes: 1 addition & 1 deletion src/bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 6 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<ModuleConfig>>,
pub center: Option<Vec<ModuleConfig>>,
Expand All @@ -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<Self> {
let config_dir = config_dir().expect("Failed to locate user config dir");
Expand Down

0 comments on commit 2e0f033

Please sign in to comment.