feat: add noblur option to windowrule

This commit is contained in:
DreamMaoMao
2025-07-31 20:24:05 +08:00
parent 5a7d99668f
commit 5f26ad6f13
2 changed files with 18 additions and 10 deletions

View File

@@ -60,6 +60,7 @@ typedef struct {
int no_force_center; int no_force_center;
int isterm; int isterm;
int noswallow; int noswallow;
int noblur;
int scratchpad_width; int scratchpad_width;
int scratchpad_height; int scratchpad_height;
float focused_opacity; float focused_opacity;
@@ -1416,6 +1417,7 @@ void parse_config_line(Config *config, const char *line) {
rule->isoverlay = -1; rule->isoverlay = -1;
rule->isterm = -1; rule->isterm = -1;
rule->noswallow = -1; rule->noswallow = -1;
rule->noblur = -1;
rule->monitor = NULL; rule->monitor = NULL;
rule->offsetx = 0; rule->offsetx = 0;
rule->offsety = 0; rule->offsety = 0;
@@ -1499,6 +1501,8 @@ void parse_config_line(Config *config, const char *line) {
rule->isterm = atoi(val); rule->isterm = atoi(val);
} else if (strcmp(key, "noswallow") == 0) { } else if (strcmp(key, "noswallow") == 0) {
rule->noswallow = atoi(val); rule->noswallow = atoi(val);
} else if (strcmp(key, "noblur") == 0) {
rule->noblur = atoi(val);
} else if (strcmp(key, "scroller_proportion") == 0) { } else if (strcmp(key, "scroller_proportion") == 0) {
rule->scroller_proportion = atof(val); rule->scroller_proportion = atof(val);
} else if (strcmp(key, "isfullscreen") == 0) { } else if (strcmp(key, "isfullscreen") == 0) {

View File

@@ -310,6 +310,7 @@ struct Client {
float unfocused_opacity; float unfocused_opacity;
char oldmonname[128]; char oldmonname[128];
int scratchpad_width, scratchpad_height; int scratchpad_width, scratchpad_height;
int noblur;
}; };
typedef struct { typedef struct {
@@ -1044,6 +1045,7 @@ static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
APPLY_INT_PROP(c, r, isunglobal); APPLY_INT_PROP(c, r, isunglobal);
APPLY_INT_PROP(c, r, scratchpad_width); APPLY_INT_PROP(c, r, scratchpad_width);
APPLY_INT_PROP(c, r, scratchpad_height); APPLY_INT_PROP(c, r, scratchpad_height);
APPLY_INT_PROP(c, r, noblur);
APPLY_FLOAT_PROP(c, r, scroller_proportion); APPLY_FLOAT_PROP(c, r, scroller_proportion);
APPLY_FLOAT_PROP(c, r, focused_opacity); APPLY_FLOAT_PROP(c, r, focused_opacity);
@@ -3205,7 +3207,7 @@ static void iter_xdg_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
if (wlr_subsurface_try_from_wlr_surface(surface) != NULL) if (wlr_subsurface_try_from_wlr_surface(surface) != NULL)
return; return;
if (blur && c) { if (blur && c && !c->noblur) {
wlr_scene_buffer_set_backdrop_blur(buffer, true); wlr_scene_buffer_set_backdrop_blur(buffer, true);
wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, true); wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, true);
if (blur_optimized) { if (blur_optimized) {
@@ -3300,6 +3302,7 @@ mapnotify(struct wl_listener *listener, void *data) {
return; return;
} }
// border
c->border = wlr_scene_rect_create(c->scene, 0, 0, c->border = wlr_scene_rect_create(c->scene, 0, 0,
c->isurgent ? urgentcolor : bordercolor); c->isurgent ? urgentcolor : bordercolor);
wlr_scene_node_lower_to_bottom(&c->border->node); wlr_scene_node_lower_to_bottom(&c->border->node);
@@ -3308,15 +3311,6 @@ mapnotify(struct wl_listener *listener, void *data) {
border_radius_location_default); border_radius_location_default);
wlr_scene_node_set_enabled(&c->border->node, true); wlr_scene_node_set_enabled(&c->border->node, true);
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
shadows_blur, shadowscolor);
wlr_scene_node_lower_to_bottom(&c->shadow->node);
wlr_scene_node_set_enabled(&c->shadow->node, true);
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
iter_xdg_scene_buffers, c);
/* Initialize client geometry with room for border */ /* Initialize client geometry with room for border */
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT |
WLR_EDGE_RIGHT); WLR_EDGE_RIGHT);
@@ -3345,6 +3339,16 @@ mapnotify(struct wl_listener *listener, void *data) {
applyrules(c); applyrules(c);
} }
// effects
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
shadows_blur, shadowscolor);
wlr_scene_node_lower_to_bottom(&c->shadow->node);
wlr_scene_node_set_enabled(&c->shadow->node, true);
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
iter_xdg_scene_buffers, c);
// make sure the animation is open type // make sure the animation is open type
c->is_pending_open_animation = true; c->is_pending_open_animation = true;
resize(c, c->geom, 0); resize(c, c->geom, 0);