diff --git a/src/main.rs b/src/main.rs index 8b034a9..a66ac17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,8 @@ struct WButton { action: String, text: String, keybind: String, + #[serde(default = "default_justify")] + justify: String, #[serde(default = "default_width")] width: f32, #[serde(default = "default_height")] @@ -30,6 +32,10 @@ struct WButton { circular: bool, } +fn default_justify() -> String { + String::from("center") +} + fn default_width() -> f32 { 0.5 } @@ -230,6 +236,14 @@ fn app_main(config: &Arc, app: &Application) { bttn.text.to_owned() }; + let justify = match bttn.justify.as_str() { + "center" => gtk::Justification::Center, + "fill" => gtk::Justification::Fill, + "left" => gtk::Justification::Left, + "right" => gtk::Justification::Right, + _ => gtk::Justification::Center + }; + let button = gtk::Button::builder() .label(&label) .name(&bttn.label) @@ -241,6 +255,8 @@ fn app_main(config: &Arc, app: &Application) { if let Some(label) = label.downcast_ref::