diff --git a/docs/Styling guide.md b/docs/Styling guide.md index 233b357..1f3c1c6 100644 --- a/docs/Styling guide.md +++ b/docs/Styling guide.md @@ -10,15 +10,17 @@ which only includes a subset of the full web spec (plus a few non-standard prope The below table describes the selectors provided by the bar itself. Information on styling individual modules can be found on their pages in the sidebar. -| Selector | Description | -|----------------|--------------------------------------------| -| `.background` | Top-level window. | -| `#bar` | Bar root box. | -| `#bar #start` | Bar left or top modules container box. | -| `#bar #center` | Bar center modules container box. | -| `#bar #end` | Bar right or bottom modules container box. | -| `.container` | All of the above. | -| `.popup` | Any popup box. | +| Selector | Description | +|---------------------|--------------------------------------------| +| `.background` | Top-level window. | +| `#bar` | Bar root box. | +| `#bar #start` | Bar left or top modules container box. | +| `#bar #center` | Bar center modules container box. | +| `#bar #end` | Bar right or bottom modules container box. | +| `.container` | All of the above. | +| `.widget-container` | The `EventBox` wrapping any widget. | +| `.widget` | Any widget. | +| `.popup` | Any popup box. | Every widget can be selected using a `kebab-case` class name matching its name. You can also target popups by prefixing `popup-` to the name. For example, you can use `.clock` and `.popup-clock` respectively. diff --git a/src/modules/mod.rs b/src/modules/mod.rs index 79580a1..f84f4cd 100644 --- a/src/modules/mod.rs +++ b/src/modules/mod.rs @@ -206,7 +206,8 @@ where let instance_name = name.unwrap_or_else(|| module_name.to_string()); let module_parts = module.into_widget(context, info)?; - module_parts.widget.style_context().add_class(module_name); + module_parts.widget.add_class("widget"); + module_parts.widget.add_class(module_name); let has_popup = if let Some(popup_content) = module_parts.popup.clone() { popup_content @@ -376,6 +377,8 @@ pub fn wrap_widget>( revealer.set_reveal_child(true); let container = EventBox::new(); + container.add_class("widget-container"); + container.add_events(EventMask::SCROLL_MASK); container.add(&revealer);