mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 18:51:04 +02:00
feat: add configurable margins around bar
This commit is contained in:
parent
fbee6e8bd4
commit
d253c4bd7f
3 changed files with 43 additions and 11 deletions
|
@ -74,14 +74,39 @@ impl Default for BarPosition {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Copy, Clone, PartialEq, Eq)]
|
||||
pub struct MarginConfig {
|
||||
#[serde(default)]
|
||||
pub bottom: i32,
|
||||
#[serde(default)]
|
||||
pub left: i32,
|
||||
#[serde(default)]
|
||||
pub right: i32,
|
||||
#[serde(default)]
|
||||
pub top: i32,
|
||||
}
|
||||
|
||||
impl Default for MarginConfig {
|
||||
fn default() -> Self {
|
||||
MarginConfig {
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub struct Config {
|
||||
#[serde(default = "default_bar_position")]
|
||||
#[serde(default)]
|
||||
pub position: BarPosition,
|
||||
#[serde(default = "default_true")]
|
||||
pub anchor_to_edges: bool,
|
||||
#[serde(default = "default_bar_height")]
|
||||
pub height: i32,
|
||||
#[serde(default)]
|
||||
pub margin: MarginConfig,
|
||||
|
||||
/// GTK icon theme to use.
|
||||
pub icon_theme: Option<String>,
|
||||
|
@ -93,10 +118,6 @@ pub struct Config {
|
|||
pub monitors: Option<HashMap<String, MonitorConfig>>,
|
||||
}
|
||||
|
||||
const fn default_bar_position() -> BarPosition {
|
||||
BarPosition::Bottom
|
||||
}
|
||||
|
||||
const fn default_bar_height() -> i32 {
|
||||
42
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue