opt: fadein fadeout init setting and tag animaiton

This commit is contained in:
DreamMaoMao 2025-02-06 13:43:27 +08:00
parent fb1a3e4dbc
commit f3707fd894
2 changed files with 6 additions and 2 deletions

View file

@ -10,7 +10,7 @@ static const bool animations = true; // Enable animations
static const char *animation_type = "slide"; //slide or zoom
static const char animation_fade_in = 0; // Enable animation fade in
static const float zoom_initial_ratio = 0.5; // Initial window ratio for animations
static const float fadeout_begin_opacity = 1; // Begin opacity for animations fadeout
static const float fadeout_begin_opacity = 0.9; // Begin opacity for animations fadeout
static const float fadein_begin_opacity = 0; // Begin opacity for animations fasdein
static const uint32_t animation_duration_move = 300; // Animation move speed
static const uint32_t animation_duration_open = 300; // Animation open speed

6
main.c
View file

@ -130,6 +130,7 @@ struct dwl_animation {
bool tagouted;
bool tagouting;
bool begin_fade_in;
bool from_rule;
uint32_t total_frames;
uint32_t passed_frames;
uint32_t duration;
@ -1094,6 +1095,7 @@ applyrules(Client *c)
}
if(!(c->tags & ( 1 << (selmon->pertag->curtag - 1) ))){
c->animation.from_rule = true;
view(&(Arg){.ui = c->tags},true);
}
}
@ -1117,7 +1119,7 @@ arrange(Monitor *m,bool want_animation)
if (VISIBLEON(c, m)) {
wlr_scene_node_set_enabled(&c->scene->node, true);
client_set_suspended(c, false);
if (want_animation && m->pertag->prevtag !=0 && m->pertag->curtag !=0) {
if (!c->animation.from_rule && want_animation && m->pertag->prevtag !=0 && m->pertag->curtag !=0) {
c->animation.tagining = true;
if (m->pertag->curtag > m->pertag->prevtag) {
c->animainit_geom.x = c->geom.x + m->m.width;
@ -1125,6 +1127,8 @@ arrange(Monitor *m,bool want_animation)
c->animainit_geom.x = c->geom.x - m->m.width;
}
}
c->animation.from_rule = false;
if((c->isfloating || c->isfullscreen || c->isfakefullscreen) && (c->animation.tagouting || c->animation.tagouted)) {
c->animation.tagouting = false;
c->animation.tagouted = false;