Skip to content

Commit c7b65a3

Browse files
author
chenyc
committed
animation: add animation exclude
1 parent a661560 commit c7b65a3

File tree

7 files changed

+38
-4
lines changed

7 files changed

+38
-4
lines changed

src/config.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,8 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable,
629629

630630
.track_leader = false,
631631

632-
.rounded_corners_blacklist = NULL
632+
.rounded_corners_blacklist = NULL,
633+
.animation_blacklist = NULL
633634
};
634635
// clang-format on
635636

src/config.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ typedef struct options {
213213
double animation_dampening;
214214
/// Whether to clamp animations
215215
bool animation_clamping;
216-
/// TODO: window animation blacklist
216+
/// Animation blacklist. A linked list of conditions.
217+
c2_lptr_t *animation_blacklist;
217218
/// TODO: open/close animations
218219

219220
// === Opacity ===

src/config_libconfig.c

+2
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,8 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
577577
}
578578
opt->animation_for_prev_tag = animation;
579579
}
580+
// --animations-exclude
581+
parse_cfg_condlst(&cfg, &opt->animation_blacklist, "animation-exclude");
580582

581583
// --animation-stiffness
582584
config_lookup_float(&cfg, "animation-stiffness-in-tag", &opt->animation_stiffness);

src/options.c

+8
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ static void usage(const char *argv0, int ret) {
9898
"--animation-clamping\n"
9999
" Whether to clamp animations (default: true)\n"
100100
"\n"
101+
"--animation-exclude condition\n"
102+
" Exclude conditions for animation.\n"
103+
"\n"
101104
"-i opacity\n"
102105
" Opacity of inactive windows. (0.1 - 1.0)\n"
103106
"\n"
@@ -929,6 +932,11 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
929932
}
930933
break;
931934
}
935+
case 812: {
936+
// --animation-exclude
937+
condlst_add(&opt->animation_blacklist, optarg);
938+
break;
939+
}
932940
default: usage(argv[0], 1); break;
933941
#undef P_CASEBOOL
934942
}

src/picom.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,8 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
20032003
c2_list_postprocess(ps, ps->o.invert_color_list) &&
20042004
c2_list_postprocess(ps, ps->o.opacity_rules) &&
20052005
c2_list_postprocess(ps, ps->o.rounded_corners_blacklist) &&
2006-
c2_list_postprocess(ps, ps->o.focus_blacklist))) {
2006+
c2_list_postprocess(ps, ps->o.focus_blacklist) &&
2007+
c2_list_postprocess(ps, ps->o.animation_blacklist))) {
20072008
log_error("Post-processing of conditionals failed, some of your rules "
20082009
"might not work");
20092010
}

src/win.c

+19-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ void win_process_update_flags(session_t *ps, struct managed_win *w) {
648648
w->g = w->pending_g;
649649

650650
// Update window geometry
651-
} else if (ps->o.animations) {
651+
} else if (win_should_animate(ps, w)) {
652652
if (w->pending_g.y < 0 && w->g.y > 0 && abs(w->pending_g.y - w->g.y) >= w->pending_g.height)
653653
w->dwm_mask = ANIM_PREV_TAG;
654654
else if (w->pending_g.y > 0 && w->g.y < 0 && abs(w->pending_g.y - w->g.y) >= w->pending_g.height)
@@ -1092,6 +1092,24 @@ bool win_should_fade(session_t *ps, const struct managed_win *w) {
10921092
return ps->o.wintype_option[w->window_type].fade;
10931093
}
10941094

1095+
/**
1096+
* Determine if a window should animate.
1097+
*/
1098+
bool win_should_animate(session_t *ps, const struct managed_win *w) {
1099+
if (!ps->o.animations) {
1100+
return false;
1101+
}
1102+
if (ps->o.wintype_option[w->window_type].animation == 0) {
1103+
log_debug("Animation disabled by window_type");
1104+
return false;
1105+
}
1106+
if (c2_match(ps, w, ps->o.animation_blacklist, NULL)) {
1107+
log_debug("Animation disabled by animation_exclude");
1108+
return false;
1109+
}
1110+
return true;
1111+
}
1112+
10951113
/**
10961114
* Reread _COMPTON_SHADOW property from a window.
10971115
*

src/win.h

+3
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,9 @@ bool win_check_flags_all(struct managed_win *w, uint64_t flags);
484484
/// Mark properties as stale for a window
485485
void win_set_properties_stale(struct managed_win *w, const xcb_atom_t *prop, int nprops);
486486

487+
/// Determine if a window should animate
488+
bool attr_pure win_should_animate(session_t *ps, const struct managed_win *w);
489+
487490
static inline attr_unused void win_set_property_stale(struct managed_win *w, xcb_atom_t prop) {
488491
return win_set_properties_stale(w, (xcb_atom_t[]){prop}, 1);
489492
}

0 commit comments

Comments
 (0)