1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 14:51:04 +02:00

feat: justify property for clock and custom label

This commit is contained in:
BowDown097 2025-01-01 12:07:42 -08:00
parent 5136637752
commit 708118d266
6 changed files with 52 additions and 9 deletions

View file

@ -4,7 +4,7 @@ use serde::Deserialize;
use super::{CustomWidget, CustomWidgetContext};
use crate::build;
use crate::config::ModuleOrientation;
use crate::config::{ModuleJustification, ModuleOrientation};
use crate::dynamic_value::dynamic_string;
use crate::gtk_helpers::IronbarLabelExt;
@ -36,6 +36,14 @@ pub struct LabelWidget {
/// **Default**: `horizontal`
#[serde(default)]
orientation: ModuleOrientation,
/// The justification (alignment) of the label text.
///
/// **Valid options**: `left`, `right`, `center`, `fill`
/// <br>
/// **Default**: `left`
#[serde(default)]
justify: ModuleJustification
}
impl CustomWidget for LabelWidget {
@ -45,6 +53,7 @@ impl CustomWidget for LabelWidget {
let label = build!(self, Self::Widget);
label.set_angle(self.orientation.to_angle());
label.set_justify(self.justify.into());
label.set_use_markup(true);
{