mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-17 23:01: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
|
@ -3,7 +3,7 @@ use crate::script::{Script, ScriptInput};
|
|||
use glib::Propagation;
|
||||
use gtk::gdk::ScrollDirection;
|
||||
use gtk::prelude::*;
|
||||
use gtk::{EventBox, Orientation, Revealer, RevealerTransitionType};
|
||||
use gtk::{EventBox, Justification, Orientation, Revealer, RevealerTransitionType};
|
||||
use serde::Deserialize;
|
||||
use tracing::trace;
|
||||
|
||||
|
@ -198,6 +198,28 @@ impl From<ModuleOrientation> for Orientation {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Clone, Copy)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
|
||||
pub enum ModuleJustification {
|
||||
#[default]
|
||||
Left,
|
||||
Right,
|
||||
Center,
|
||||
Fill
|
||||
}
|
||||
|
||||
impl From<ModuleJustification> for Justification {
|
||||
fn from(o: ModuleJustification) -> Self {
|
||||
match o {
|
||||
ModuleJustification::Left => Self::Left,
|
||||
ModuleJustification::Right => Self::Right,
|
||||
ModuleJustification::Center => Self::Center,
|
||||
ModuleJustification::Fill => Self::Fill
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TransitionType {
|
||||
pub const fn to_revealer_transition_type(
|
||||
&self,
|
||||
|
|
|
@ -45,7 +45,7 @@ use std::collections::HashMap;
|
|||
#[cfg(feature = "schema")]
|
||||
use schemars::JsonSchema;
|
||||
|
||||
pub use self::common::{CommonConfig, ModuleOrientation, TransitionType};
|
||||
pub use self::common::{CommonConfig, ModuleJustification, ModuleOrientation, TransitionType};
|
||||
pub use self::truncate::{EllipsizeMode, TruncateMode};
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue