Added support to label text alignment. (#412)
* Added support to label text alignment. Since labels in gtk can't be aligned via css (I still don't know why) and can be only aligned using code, this patch adds support for this functionality by adding the properties :xalign and :yalign to the label expression. The exact behavior is described by the docs. * Updated changelog with :xalign and :yalign for labels
This commit is contained in:
parent
6211267e06
commit
34d929f097
2 changed files with 6 additions and 1 deletions
|
@ -21,6 +21,7 @@ All notable changes to eww will be listed here, starting at changes since versio
|
||||||
- Add support for `:hover` css selectors for eventbox (By: druskus20)
|
- Add support for `:hover` css selectors for eventbox (By: druskus20)
|
||||||
- Add `eww get` subcommand (By: druskus20)
|
- Add `eww get` subcommand (By: druskus20)
|
||||||
- Add circular progress widget (By: druskus20)
|
- Add circular progress widget (By: druskus20)
|
||||||
|
- Add `:xalign` and `:yalign` to labels (By: alecsferra)
|
||||||
- Add graph widget (By: druskus20)
|
- Add graph widget (By: druskus20)
|
||||||
- Add `>=` and `<=` operators to simplexpr (By: viandoxdev)
|
- Add `>=` and `<=` operators to simplexpr (By: viandoxdev)
|
||||||
- Add `desktop` window type (By: Alvaro Lopez)
|
- Add `desktop` window type (By: Alvaro Lopez)
|
||||||
|
|
|
@ -736,7 +736,11 @@ fn build_gtk_label(bargs: &mut BuilderArgs) -> Result<gtk::Label> {
|
||||||
// @prop wrap - Wrap the text. This mainly makes sense if you set the width of this widget.
|
// @prop wrap - Wrap the text. This mainly makes sense if you set the width of this widget.
|
||||||
prop(wrap: as_bool) { gtk_widget.set_line_wrap(wrap) },
|
prop(wrap: as_bool) { gtk_widget.set_line_wrap(wrap) },
|
||||||
// @prop angle - the angle of rotation for the label (between 0 - 360)
|
// @prop angle - the angle of rotation for the label (between 0 - 360)
|
||||||
prop(angle: as_f64 = 0) { gtk_widget.set_angle(angle) }
|
prop(angle: as_f64 = 0) { gtk_widget.set_angle(angle) },
|
||||||
|
// @prop xalign - the alignment of the label text on the x axis (between 0 - 1, 0 -> left, 0.5 -> center, 1 -> right)
|
||||||
|
prop(xalign: as_f64 = 0.5) { gtk_widget.set_xalign(xalign as f32) },
|
||||||
|
// @prop yalign - the alignment of the label text on the y axis (between 0 - 1, 0 -> bottom, 0.5 -> center, 1 -> top)
|
||||||
|
prop(yalign: as_f64 = 0.5) { gtk_widget.set_yalign(yalign as f32) }
|
||||||
});
|
});
|
||||||
Ok(gtk_widget)
|
Ok(gtk_widget)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue