Layer Rules
Style panels, launchers, notifications, and wallpapers
sweets.layer_rule styles layer surfaces: panels, launchers, notifications,
and wallpapers. For normal windows, use
window rules.
sweets.layer_rule({ namespace = "waybar", opacity = 0.9, blur = true })
sweets.layer_rule({ namespace = "fuzzel", dim_around = "#00000099" })Rules update on reload.
Finding a namespace
sweets msg layersThis lists each surface's namespace and layer.
Matching
| Field | Matches |
|---|---|
namespace | The name the app gives its surface |
layer | "background", "bottom", "top", or "overlay" |
namespace also takes a pattern, like
window rules:
sweets.layer_rule({ namespace = { prefix = "waybar", ignore_case = true }, blur = true })Use exclude to skip surfaces:
-- Blur every top-layer surface except mako.
sweets.layer_rule({ layer = "top", exclude = { namespace = "mako" }, blur = true })Every matching rule applies, top to bottom. The later one wins.
Properties
| Field | Effect |
|---|---|
opacity | Opacity, 0.0–1.0 |
blur | true or false |
blur_mode | "optimized" or "scene" |
blur_ignore_alpha | Blur only visible pixels |
shadow | Cast a shadow |
corner_radius | Corner shape for blur and shadow |
dim_around | Darken the screen behind it, or false |
animation | false turns off its animations |
animation_direction | "auto", "left", "right", "up", or "down" |
animation_distance | "auto" or pixels |
block_out_from, block_out_style | Hide from screen captures |
popups | Style its menus: opacity, blur, blur_mode, corner_radius |
Blur
Blur also needs sweets.blur
turned on.
Launchers often use a full-screen transparent surface. blur_ignore_alpha
blurs only the visible part:
sweets.layer_rule({ namespace = "rofi", blur = true, blur_ignore_alpha = 0.35 })Higher values ignore more faint pixels, like soft shadows.
Shadows
Layer surfaces get no shadow unless a rule asks. It also needs
sweets.shadow turned on.
sweets.layer_rule({ namespace = "waybar", shadow = true, corner_radius = 12 })
-- Round only the bottom corners of a top bar.
sweets.layer_rule({
namespace = "waybar",
shadow = true,
corner_radius = { bottom_left = 12, bottom_right = 12 },
})corner_radius shapes the shadow and blur. It doesn't change the app's own
pixels.
Animations
Change layer animations for one surface:
sweets.layer_rule({ namespace = "swaync", animation = false })
sweets.layer_rule({ namespace = "sweetwall", animation_direction = "left" })
sweets.layer_rule({ namespace = "mako", animation_distance = 60 })Direction and distance only matter for slide animations.
Menu blur follows the surface as it slides and fades. Closing surfaces keep their position among other surfaces on the same layer.
Hiding notifications from captures
sweets.layer_rule({
namespace = "mako",
block_out_from = "screen_capture",
block_out_style = "hide",
})The notification and its popups stay visible on your screen. The capture
shows what is behind them. Use "black" for a black box.
Wallpapers
sweetbg uses the sweetbg namespace on the
background layer.
-- Dim the wallpaper
sweets.layer_rule({ namespace = "sweetbg", opacity = 0.8 })
-- Hide it from screen sharing and recording
sweets.layer_rule({ namespace = "sweetbg", block_out_from = "screencast" })