Add scss support for style property (#1121)

* Add scss support for the ':style' widget property

* Add changelog entry for the scss support for the ':style' property

---------

Co-authored-by: ElKowar <dev@elkowar.dev>
This commit is contained in:
ovalkonia 2024-08-25 17:14:35 +03:00 committed by GitHub
parent 510b824e75
commit dc4def5327
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -18,6 +18,7 @@ All notable changes to eww will be listed here, starting at changes since versio
- Add `:fill-svg` and `:preserve-aspect-ratio` properties to images (By: hypernova7, w-lfchen)
- Add `:truncate` property to labels, disabled by default (except in cases where truncation would be enabled in version `0.5.0` and before) (By: Rayzeq).
- Add support for `:hover` css selectors for tray items (By: zeapoz)
- Add scss support for the `:style` widget property (By: ovalkonia)
- Add `min` and `max` function calls to simplexpr (By: ovalkonia)
## [0.6.0] (21.04.2024)

View file

@ -209,10 +209,10 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
prop(visible: as_bool = true) {
if visible { gtk_widget.show(); } else { gtk_widget.hide(); }
},
// @prop style - inline css style applied to the widget
// @prop style - inline scss style applied to the widget
prop(style: as_string) {
gtk_widget.reset_style();
css_provider.load_from_data(format!("* {{ {} }}", style).as_bytes())?;
css_provider.load_from_data(grass::from_string(format!("* {{ {} }}", style), &grass::Options::default())?.as_bytes())?;
gtk_widget.style_context().add_provider(&css_provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION)
},
// @prop css - scss code applied to the widget, i.e.: `button {color: red;}`