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:
parent
5136637752
commit
708118d266
6 changed files with 52 additions and 9 deletions
|
@ -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);
|
||||
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue