Skip to content

fix(css): move user-facing classes to styled surfaces#95

Merged
prankstr merged 6 commits intomainfrom
fix/widget-css-class
Apr 1, 2026
Merged

fix(css): move user-facing classes to styled surfaces#95
prankstr merged 6 commits intomainfrom
fix/widget-css-class

Conversation

@prankstr
Copy link
Copy Markdown
Owner

@prankstr prankstr commented Apr 1, 2026

Fixes CSS class regressions introduced after v0.12.1 where user-facing classes (.widget, .clock, .notification-toast, etc.) ended up on transparent wrappers/windows instead of the painted surfaces.

  • Rename .widget-surface back to .widget, outer click targetbecomes .widget-wrapper
  • Move widget-specific classes (.clock, .cpu, etc.) from wrapper to surface so user CSS like .clock { background: ... } works again
  • Add .popover as canonical popover class. Keep .vp-surface-popover and .widget-menu as deprecated aliases
  • Add .osd for OSD styling, window becomes .osd-wrapper
  • Apply the same wrapper/surface split to popovers and toasts

Fixes #90

…patibility

Move the user-facing .widget class from the outer container to the visual
surface element, and rename the container to .widget-wrapper. This preserves
the documented .widget CSS contract so user stylesheets targeting .widget
continue to hit the background element.

Key changes:
- .widget now lives on the visual surface (background + border-radius)
- .widget-wrapper is the outer rectangular hit target (Fitts's Law)
- Widget css_name added to both wrapper and surface for per-widget overrides
- Groups: .widget-group moved to surface; nested widget backgrounds forced
  transparent via scoped CSS provider at TRANSIENT_CSS_PRIORITY
- Merge group negative margin rule extended to .widget-merge-group
- Passive widget padding selector added
- Overlay overflow:hidden for standalone widget ripple clipping
ScaleBox didn't override request_mode(), defaulting to ConstantSize.
Its child (popover content with wrapping labels) needs HeightForWidth,
so GTK measured height assuming unlimited width then allocated too
little once text wrapped — producing a scrollbar on short lists.
Forward the child's request mode to fix.

The overlay scrollbar also overlapped dismiss buttons. Remove right
padding from the popover surface and apply it individually to the
header and notification list, so the scrollbar sits in the reclaimed
gutter without needing negative margins.
…ntainers

Notification toasts, OSD overlays, and popovers had CSS classes on
transparent gtk4::Window or wrapper elements instead of on the visual
surface. Users targeting these classes got double backgrounds and sharp
corners. Move .notification-toast, .osd, and .popover to the inner
styled containers, add -wrapper classes to transparent shells, and fix
a bare box CSS selector in apply_surface_styles_inner that leaked
styles to all descendant GtkBox widgets.

Going forward:
- .popover is the canonical class for all popover surfaces (layer-shell
  and native). .vp-surface-popover and .widget-menu are deprecated
  aliases kept for backward compat — remove after a few releases.
- .widget-menu must remain on native gtk4::Popover shells (needed by
  the popover.widget-menu CSS reset rules in css/base.rs). Only the
  user-facing role is deprecated; the structural role stays.
- .osd-window was removed entirely (undocumented, wrong element).
- Wiki needs updating to document .popover, .osd, .notification-toast
  and mark deprecated classes.
@prankstr prankstr merged commit 3a59b06 into main Apr 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

What happend to my CSS on main?

1 participant