mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-17 14:51:04 +02:00
feat: Add orientation support for custom label and button
This commit is contained in:
parent
702b0a63bf
commit
70b2c592b2
11 changed files with 145 additions and 39 deletions
|
@ -2,6 +2,7 @@ use gtk::prelude::*;
|
|||
use gtk::{Button, Label, Orientation};
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::config::ModuleOrientation;
|
||||
use crate::dynamic_value::dynamic_string;
|
||||
use crate::modules::PopupButton;
|
||||
use crate::{build, try_send};
|
||||
|
@ -15,6 +16,8 @@ pub struct ButtonWidget {
|
|||
label: Option<String>,
|
||||
on_click: Option<String>,
|
||||
widgets: Option<Vec<WidgetConfig>>,
|
||||
#[serde(default)]
|
||||
orientation: ModuleOrientation,
|
||||
}
|
||||
|
||||
impl CustomWidget for ButtonWidget {
|
||||
|
@ -35,6 +38,11 @@ impl CustomWidget for ButtonWidget {
|
|||
} else if let Some(text) = self.label {
|
||||
let label = Label::new(None);
|
||||
label.set_use_markup(true);
|
||||
|
||||
label.set_angle(
|
||||
self.orientation.to_angle(),
|
||||
);
|
||||
|
||||
button.add(&label);
|
||||
|
||||
dynamic_string(&text, move |string| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue