From 5b60999075426f18a29dbaebefafbb5ed53f905e Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 6 Nov 2025 19:01:18 +0800 Subject: [PATCH] feat: add windowrule option isnoshadow,isnoanimation --- src/animation/client.h | 7 ++++++- src/config/parse_config.h | 8 ++++++++ src/mango.c | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/animation/client.h b/src/animation/client.h index 09d1416..90b664b 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -251,7 +251,7 @@ void buffer_set_effect(Client *c, BufferData data) { void client_draw_shadow(Client *c) { - if (c->iskilling || !client_surface(c)->mapped) + if (c->iskilling || !client_surface(c)->mapped || c->isnoshadow) return; if (!shadows || (!c->isfloating && shadow_only_floating)) { @@ -888,6 +888,11 @@ void client_set_pending_state(Client *c) { c->animation.duration = 0; } + if (c->isnoanimation) { + c->animation.should_animate = false; + c->animation.duration = 0; + } + // 开始动画 client_commit(c); c->dirty = true; diff --git a/src/config/parse_config.h b/src/config/parse_config.h index a20a60a..c94e866 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -61,6 +61,8 @@ typedef struct { const char *layer_animation_type_open; const char *layer_animation_type_close; int isnoborder; + int isnoshadow; + int isnoanimation; int isopensilent; int istagsilent; int isnamedscratchpad; @@ -1697,6 +1699,8 @@ void parse_option(Config *config, char *key, char *value) { rule->isfloating = -1; rule->isfullscreen = -1; rule->isnoborder = -1; + rule->isnoshadow = -1; + rule->isnoanimation = -1; rule->isopensilent = -1; rule->istagsilent = -1; rule->isnamedscratchpad = -1; @@ -1778,6 +1782,10 @@ void parse_option(Config *config, char *key, char *value) { rule->height = atoi(val); } else if (strcmp(key, "isnoborder") == 0) { rule->isnoborder = atoi(val); + } else if (strcmp(key, "isnoshadow") == 0) { + rule->isnoshadow = atoi(val); + } else if (strcmp(key, "isnoanimation") == 0) { + rule->isnoanimation = atoi(val); } else if (strcmp(key, "isopensilent") == 0) { rule->isopensilent = atoi(val); } else if (strcmp(key, "istagsilent") == 0) { diff --git a/src/mango.c b/src/mango.c index e946d41..f26d6f0 100644 --- a/src/mango.c +++ b/src/mango.c @@ -330,6 +330,8 @@ struct Client { int is_scratchpad_show; int isglobal; int isnoborder; + int isnoshadow; + int isnoanimation; int isopensilent; int istagsilent; int iskilling; @@ -1134,6 +1136,8 @@ static void apply_rule_properties(Client *c, const ConfigWinRule *r) { APPLY_INT_PROP(c, r, isfloating); APPLY_INT_PROP(c, r, isfullscreen); APPLY_INT_PROP(c, r, isnoborder); + APPLY_INT_PROP(c, r, isnoshadow); + APPLY_INT_PROP(c, r, isnoanimation); APPLY_INT_PROP(c, r, isopensilent); APPLY_INT_PROP(c, r, istagsilent); APPLY_INT_PROP(c, r, isnamedscratchpad);