mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-04-19 19:34:24 +02:00
feat: config option for bar height
This commit is contained in:
parent
dc14cb003f
commit
2e0f033bed
3 changed files with 8 additions and 1 deletions
|
@ -73,6 +73,7 @@ The monitor's config object takes any combination of `left`, `center`, and `righ
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|------------|-------------------|---------|-----------------------------------------------------------------------------|
|
|------------|-------------------|---------|-----------------------------------------------------------------------------|
|
||||||
| `position` | `top` or `bottom` | `[]` | The bar's position on screen. |
|
| `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. |
|
| `left` | `Module[]` | `[]` | Array of left modules. |
|
||||||
| `center` | `Module[]` | `[]` | Array of center modules. |
|
| `center` | `Module[]` | `[]` | Array of center modules. |
|
||||||
| `right` | `Module[]` | `[]` | Array of right modules. |
|
| `right` | `Module[]` | `[]` | Array of right modules. |
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub fn create_bar(app: &Application, monitor: &Monitor, monitor_name: &str, conf
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
.spacing(0)
|
.spacing(0)
|
||||||
.hexpand(false)
|
.hexpand(false)
|
||||||
.height_request(42)
|
.height_request(config.height)
|
||||||
.name("bar")
|
.name("bar")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ impl Default for BarPosition {
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
#[serde(default = "default_bar_position")]
|
#[serde(default = "default_bar_position")]
|
||||||
pub position: BarPosition,
|
pub position: BarPosition,
|
||||||
|
#[serde(default = "default_bar_height")]
|
||||||
|
pub height: i32,
|
||||||
|
|
||||||
pub left: Option<Vec<ModuleConfig>>,
|
pub left: Option<Vec<ModuleConfig>>,
|
||||||
pub center: Option<Vec<ModuleConfig>>,
|
pub center: Option<Vec<ModuleConfig>>,
|
||||||
|
@ -52,6 +54,10 @@ const fn default_bar_position() -> BarPosition {
|
||||||
BarPosition::Bottom
|
BarPosition::Bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fn default_bar_height() -> i32 {
|
||||||
|
42
|
||||||
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn load() -> Option<Self> {
|
pub fn load() -> Option<Self> {
|
||||||
let config_dir = config_dir().expect("Failed to locate user config dir");
|
let config_dir = config_dir().expect("Failed to locate user config dir");
|
||||||
|
|
Loading…
Add table
Reference in a new issue