Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
added animation exclude rule sets - update 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
allusive-dev committed Sep 28, 2023
1 parent f61149a commit e24b8ed
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable,
bool *fading_enable, bool *hasneg, win_option_mask_t *winopt_mask) {
// clang-format off
*opt = (struct options){
.backend = BKEND_XRENDER,
.backend = BKEND_GLX,
.glx_no_stencil = false,
.mark_wmwin_focused = false,
.mark_ovredir_focused = false,
Expand All @@ -571,7 +571,7 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable,
.shadow_red = 0.0,
.shadow_green = 0.0,
.shadow_blue = 0.0,
.shadow_radius = 18,
.shadow_radius = 12,
.shadow_offset_x = -15,
.shadow_offset_y = -15,
.shadow_opacity = .75,
Expand All @@ -580,24 +580,24 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable,
.xinerama_shadow_crop = false,
.shadow_clip_list = NULL,

.corner_radius = 0,
.corner_radius = 12,

.fade_in_step = 0.028,
.fade_in_step = 0.03,
.fade_out_step = 0.03,
.fade_delta = 10,
.no_fading_openclose = false,
.no_fading_destroyed_argb = false,
.fade_blacklist = NULL,

.animations = false,
.animation_for_open_window = OPEN_WINDOW_ANIMATION_NONE,
.animation_for_transient_window = OPEN_WINDOW_ANIMATION_NONE,
.animation_for_unmap_window = OPEN_WINDOW_ANIMATION_AUTO,
.animation_for_workspace_switch_in = OPEN_WINDOW_ANIMATION_AUTO,
.animation_for_workspace_switch_out = OPEN_WINDOW_ANIMATION_AUTO,
.animation_stiffness = 200.0,
.animation_window_mass = 1.0,
.animation_dampening = 25,
.animations = true,
.animation_for_open_window = OPEN_WINDOW_ANIMATION_ZOOM,
.animation_for_transient_window = OPEN_WINDOW_ANIMATION_ZOOM,
.animation_for_unmap_window = OPEN_WINDOW_ANIMATION_ZOOM,
.animation_for_workspace_switch_in = OPEN_WINDOW_ANIMATION_ZOOM,
.animation_for_workspace_switch_out = OPEN_WINDOW_ANIMATION_ZOOM,
.animation_stiffness = 100.0,
.animation_window_mass = 0.5,
.animation_dampening = 10,
.animation_delta = 10,
.animation_force_steps = false,
.animation_clamping = true,
Expand Down Expand Up @@ -631,7 +631,10 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable,

.track_leader = false,

.rounded_corners_blacklist = NULL
.rounded_corners_blacklist = NULL,

.animation_open_blacklist = NULL,
.animation_unmap_blacklist = NULL
};
// clang-format on

Expand Down
4 changes: 4 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ typedef struct options {
/// Rounded corners blacklist. A linked list of conditions.
c2_lptr_t *rounded_corners_blacklist;

c2_lptr_t *animation_open_blacklist;

c2_lptr_t *animation_unmap_blacklist;

// === Focus related ===
/// Whether to try to detect WM windows and mark them as focused.
bool mark_wmwin_focused;
Expand Down
4 changes: 4 additions & 0 deletions src/config_libconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,10 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
lcfg_lookup_bool(&cfg, "animation-clamping", &opt->animation_clamping);
// --focus-exclude
parse_cfg_condlst(&cfg, &opt->focus_blacklist, "focus-exclude");
// animation exclude
parse_cfg_condlst(&cfg, &opt->animation_open_blacklist, "animation-open-exclude");
// animation exclude
parse_cfg_condlst(&cfg, &opt->animation_unmap_blacklist, "animation-unmap-exclude");
// --invert-color-include
parse_cfg_condlst(&cfg, &opt->invert_color_list, "invert-color-include");
// --blur-background-exclude
Expand Down
8 changes: 8 additions & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ static const struct option longopts[] = {
{"animation-clamping", no_argument, NULL, 808},
{"animation-for-open-window", required_argument, NULL, 809},
{"animation-for-transient-window", required_argument, NULL, 810},
{"animation-open-exclude", required_argument, NULL, 830},
{"animation-unmap-exclude", required_argument, NULL, 831},
// Must terminate with a NULL entry
{NULL, 0, NULL, 0},
};
Expand Down Expand Up @@ -985,6 +987,12 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
}
break;
}
case 830:
condlst_add(&opt->animation_open_blacklist, optarg);
break;
case 831:
condlst_add(&opt->animation_unmap_blacklist, optarg);
break;
case 810: {
// --animation-for-transient-window
enum open_window_animation animation = parse_open_window_animation(optarg);
Expand Down
4 changes: 4 additions & 0 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -2144,6 +2144,8 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
c2_list_postprocess(ps, ps->o.invert_color_list) &&
c2_list_postprocess(ps, ps->o.opacity_rules) &&
c2_list_postprocess(ps, ps->o.rounded_corners_blacklist) &&
c2_list_postprocess(ps, ps->o.animation_open_blacklist) &&
c2_list_postprocess(ps, ps->o.animation_unmap_blacklist) &&
c2_list_postprocess(ps, ps->o.focus_blacklist))) {
log_error("Post-processing of conditionals failed, some of your rules "
"might not work");
Expand Down Expand Up @@ -2524,6 +2526,8 @@ static void session_destroy(session_t *ps) {
free_wincondlst(&ps->o.paint_blacklist);
free_wincondlst(&ps->o.unredir_if_possible_blacklist);
free_wincondlst(&ps->o.rounded_corners_blacklist);
free_wincondlst(&ps->o.animation_open_blacklist);
free_wincondlst(&ps->o.animation_unmap_blacklist);

// Free tracked atom list
{
Expand Down
8 changes: 8 additions & 0 deletions src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ static void init_animation(session_t *ps, struct managed_win *w) {
animation = ps->o.animation_for_workspace_switch_in;
}

if (c2_match(ps, w, ps->o.animation_open_blacklist, NULL)) {
animation = OPEN_WINDOW_ANIMATION_NONE;
}

switch (animation) {
case OPEN_WINDOW_ANIMATION_AUTO:
case OPEN_WINDOW_ANIMATION_NONE: { // No animation
Expand Down Expand Up @@ -572,6 +576,10 @@ static void init_animation_unmap(session_t *ps, struct managed_win *w) {
animation = ps->o.wintype_option[w->window_type].animation_unmap;
}

if (c2_match(ps, w, ps->o.animation_unmap_blacklist, NULL)) {
animation = OPEN_WINDOW_ANIMATION_NONE;
}

if (ps->root_desktop_switch_direction != 0) {
if (ps->o.animation_for_workspace_switch_out == OPEN_WINDOW_ANIMATION_AUTO)
animation = OPEN_WINDOW_ANIMATION_SLIDE_OUT;
Expand Down

0 comments on commit e24b8ed

Please sign in to comment.