feat: add winrule option nofadeout

This commit is contained in:
DreamMaoMao 2025-06-07 08:47:45 +08:00
parent 71e336fecc
commit 0a9181ecb0
2 changed files with 11 additions and 2 deletions

View file

@ -37,6 +37,7 @@ typedef struct {
int width; int width;
int height; int height;
int nofadein; int nofadein;
int nofadeout;
int no_force_center; int no_force_center;
int isterm; int isterm;
int noswallow; int noswallow;
@ -1105,6 +1106,7 @@ void parse_config_line(Config *config, const char *line) {
rule->offsetx = 0; rule->offsetx = 0;
rule->offsety = 0; rule->offsety = 0;
rule->nofadein = 0; rule->nofadein = 0;
rule->nofadeout = 0;
rule->no_force_center = 0; rule->no_force_center = 0;
rule->scratchpad_width = 0; rule->scratchpad_width = 0;
rule->scratchpad_height = 0; rule->scratchpad_height = 0;
@ -1149,6 +1151,8 @@ void parse_config_line(Config *config, const char *line) {
rule->offsety = atoi(val); rule->offsety = atoi(val);
} else if (strcmp(key, "nofadein") == 0) { } else if (strcmp(key, "nofadein") == 0) {
rule->nofadein = atoi(val); rule->nofadein = atoi(val);
} else if (strcmp(key, "nofadeout") == 0) {
rule->nofadeout = atoi(val);
} else if (strcmp(key, "no_force_center") == 0) { } else if (strcmp(key, "no_force_center") == 0) {
rule->no_force_center = atoi(val); rule->no_force_center = atoi(val);
} else if (strcmp(key, "scratchpad_width") == 0) { } else if (strcmp(key, "scratchpad_width") == 0) {

View file

@ -279,6 +279,7 @@ struct Client {
bool drag_to_tile; bool drag_to_tile;
bool fake_no_border; bool fake_no_border;
int nofadein; int nofadein;
int nofadeout;
int no_force_center; int no_force_center;
int isunglobal; int isunglobal;
}; };
@ -958,6 +959,7 @@ void fadeout_client_animation_next_tick(Client *c) {
double opacity = MAX(fadeout_begin_opacity - animation_passed, 0); double opacity = MAX(fadeout_begin_opacity - animation_passed, 0);
if(!c->nofadeout)
wlr_scene_node_for_each_buffer(&c->scene->node, scene_buffer_apply_opacity, wlr_scene_node_for_each_buffer(&c->scene->node, scene_buffer_apply_opacity,
&opacity); &opacity);
@ -1853,6 +1855,7 @@ applyrules(Client *c) {
c->isterm = r->isterm > 0 ? r->isterm : c->isterm; c->isterm = r->isterm > 0 ? r->isterm : c->isterm;
c->noswallow = r->noswallow > 0 ? r->noswallow : c->noswallow; c->noswallow = r->noswallow > 0 ? r->noswallow : c->noswallow;
c->nofadein = r->nofadein > 0 ? r->nofadein : c->nofadein; c->nofadein = r->nofadein > 0 ? r->nofadein : c->nofadein;
c->nofadeout = r->nofadeout > 0 ? r->nofadeout : c->nofadeout;
c->no_force_center = r->no_force_center > 0 ? r->no_force_center c->no_force_center = r->no_force_center > 0 ? r->no_force_center
: c->no_force_center; : c->no_force_center;
c->scratchpad_geom.width = r->scratchpad_width > 0 c->scratchpad_geom.width = r->scratchpad_width > 0
@ -4502,6 +4505,7 @@ mapnotify(struct wl_listener *listener, void *data) {
c->drag_to_tile = false; c->drag_to_tile = false;
c->fake_no_border = false; c->fake_no_border = false;
c->nofadein = 0; c->nofadein = 0;
c->nofadeout = 0;
c->no_force_center = 0; c->no_force_center = 0;
if (new_is_master && selmon && if (new_is_master && selmon &&
@ -6676,6 +6680,7 @@ void init_fadeout_client(Client *c) {
fadeout_cient->animation_type_close = c->animation_type_close; fadeout_cient->animation_type_close = c->animation_type_close;
fadeout_cient->animation.action = CLOSE; fadeout_cient->animation.action = CLOSE;
fadeout_cient->bw = c->bw; fadeout_cient->bw = c->bw;
fadeout_cient->nofadeout = c->nofadeout;
// 这里snap节点的坐标设置是使用的相对坐标所以不能加上原来坐标 // 这里snap节点的坐标设置是使用的相对坐标所以不能加上原来坐标
// 这跟普通node有区别 // 这跟普通node有区别