We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 95c5e90 commit 6707e92Copy full SHA for 6707e92
1 file changed
src/utils/ui-helpers.js
@@ -202,9 +202,17 @@ export function applyCssToWidget(
202
css,
203
priority = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
204
) {
205
- const cssProvider = new Gtk.CssProvider();
206
- cssProvider.load_from_string(css);
207
- widget.get_style_context().add_provider(cssProvider, priority);
+ const apply = () => {
+ const cssProvider = new Gtk.CssProvider();
+ cssProvider.load_from_string(css);
208
+ widget.get_style_context().add_provider(cssProvider, priority);
209
+ };
210
+
211
+ if (widget.get_realized()) {
212
+ apply();
213
+ } else {
214
+ widget.connect('realize', apply);
215
+ }
216
}
217
218
/**
0 commit comments