MCPcopy Create free account
hub / github.com/material-shell/material-shell / set_style_class

Function set_style_class

src/utils/styling_utils.ts:3–17  ·  view source on GitHub ↗
(
    widget: St.Widget,
    style_class: string,
    enabled: boolean
)

Source from the content-addressed store, hash-verified

1import St from 'gi://St';
2/** Sets whether the widget has the given style class */
3export function set_style_class(
4 widget: St.Widget,
5 style_class: string,
6 enabled: boolean
7) {
8 if (enabled) {
9 if (!widget.has_style_class_name(style_class)) {
10 widget.add_style_class_name(style_class);
11 }
12 } else {
13 if (widget.has_style_class_name(style_class)) {
14 widget.remove_style_class_name(style_class);
15 }
16 }
17}

Callers 1

onMetaWindowsChangedMethod · 0.90

Calls 3

has_style_class_nameMethod · 0.80
add_style_class_nameMethod · 0.80

Tested by

no test coverage detected