Skip to content

Commit

Permalink
Add scss support for style property (#1121)
Browse files Browse the repository at this point in the history
* Add scss support for the ':style' widget property

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

---------

Co-authored-by: ElKowar <[email protected]>
  • Loading branch information
ovalkonia and elkowar authored Aug 25, 2024
1 parent 510b824 commit dc4def5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions crates/eww/src/widgets/widget_definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;}`
Expand Down

0 comments on commit dc4def5

Please sign in to comment.