diff options
| author | allusive-dev <[email protected]> | 2023-11-09 11:14:39 +1100 |
|---|---|---|
| committer | allusive-dev <[email protected]> | 2023-11-09 11:14:39 +1100 |
| commit | a51f4229715d3edc4c4b609764cc9328d9940232 (patch) | |
| tree | 7e63e3e2c23fcf75d52287d9e9da14ec2af9d980 | |
| parent | Update README.md (diff) | |
| download | compfy-a51f4229715d3edc4c4b609764cc9328d9940232.tar.xz compfy-a51f4229715d3edc4c4b609764cc9328d9940232.zip | |
added blur whitelist toggle according to request in #17. Deprecated focus-exclude in favor of active-exclude and inactive-exclude. Focus wintype option now works as expected1.4.0
| -rw-r--r-- | meson.build | 4 | ||||
| -rw-r--r-- | picom.sample.conf | 15 | ||||
| -rw-r--r-- | src/config.c | 1 | ||||
| -rw-r--r-- | src/config.h | 2 | ||||
| -rw-r--r-- | src/config_libconfig.c | 8 | ||||
| -rw-r--r-- | src/options.c | 14 | ||||
| -rw-r--r-- | src/win.c | 35 |
7 files changed, 47 insertions, 32 deletions
diff --git a/meson.build b/meson.build index 22db958..75adc7e 100644 --- a/meson.build +++ b/meson.build @@ -1,10 +1,10 @@ -project('picom', 'c', version: '1.3.2', +project('picom', 'c', version: '1.4.0', default_options: ['c_std=c11', 'warning_level=1']) cc = meson.get_compiler('c') # use project version by default -version = 'v1.3.2' +version = 'v1.4.0' # use git describe if that's available # git = find_program('git', required: false) diff --git a/picom.sample.conf b/picom.sample.conf index 0fb8bb2..51bbf39 100644 --- a/picom.sample.conf +++ b/picom.sample.conf @@ -34,7 +34,7 @@ animation-for-open-window = "zoom"; # Set the closing window animation. # Options: ("none","zoom","fly-in","slide-up","slide-down","slide-left","slide-right") -animation-for-unmap-window = "slide-down"; +animation-for-unmap-window = "zoom"; # Exclude certain windows from having a open animation. @@ -149,6 +149,7 @@ active-opacity = 1.0 # A list of windows that should have their inactive-opacity set to whatever the active-opacity is. # Unless the window is also in active-opacity-exclude then it will be set to 1.0 or if it is set in "opacity-rule", # it will use the opacity set there as the inactive-opacity +# Also excludes effects caused by inactive-dim # # inactive-exclude = [ # "class_g = 'dwm'" @@ -157,16 +158,11 @@ active-opacity = 1.0 # A list of windows that should never have their opacity changed by active-opacity when focused. # -# active-opacity-exclude = [ +# active-exclude = [ # "class_g = 'dwm'" # ]; -# Specify a list of conditions of windows that should never be considered focused. -# focus-exclude = [ -# "class_g = 'Cairo-clock'" -#]; - # Specify a list of opacity rules, in the format `PERCENT:PATTERN`, # like `50:name *= "Firefox"`. @@ -211,9 +207,12 @@ blur-strength = 5; # blur-background = true; +# Toggle whether you want to use a blacklist or whitelist. + +blur-whitelist = true; # Whitelist for windows to have background blurring -blur-rule = [ +blur-include = [ "class_g = 'Alacritty'", "class_g = 'kitty'" ]; diff --git a/src/config.c b/src/config.c index 2eefda1..e3ea9c6 100644 --- a/src/config.c +++ b/src/config.c @@ -860,6 +860,7 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable, .corner_rules = NULL, .blur_rules = NULL, + .blur_whitelist = true, .support_for_wm = WM_SUPPORT_NONE, diff --git a/src/config.h b/src/config.h index 1436495..4169bae 100644 --- a/src/config.h +++ b/src/config.h @@ -232,6 +232,8 @@ typedef struct options { // Wm Support enum wm_support support_for_wm; + bool blur_whitelist; + // === Opacity === /// Default opacity for inactive windows. /// 32-bit integer with the format of _NET_WM_WINDOW_OPACITY. diff --git a/src/config_libconfig.c b/src/config_libconfig.c index 1b81a50..ac4eb96 100644 --- a/src/config_libconfig.c +++ b/src/config_libconfig.c @@ -578,22 +578,23 @@ 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"); + // --invert-color-include parse_cfg_condlst(&cfg, &opt->invert_color_list, "invert-color-include"); // --blur-background-exclude - parse_cfg_condlst(&cfg, &opt->blur_background_blacklist, "blur-background-exclude"); + parse_cfg_condlst(&cfg, &opt->blur_background_blacklist, "blur-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"); // active opacity exclude - parse_cfg_condlst(&cfg, &opt->active_opacity_blacklist, "active-opacity-exclude"); + parse_cfg_condlst(&cfg, &opt->active_opacity_blacklist, "active-exclude"); // inactive opacity exclude parse_cfg_condlst(&cfg, &opt->inactive_opacity_blacklist, "inactive-exclude"); // corners-rule parse_cfg_condlst_corner(opt, &cfg, "corners-rule"); // blur-rule - parse_cfg_condlst(&cfg, &opt->blur_rules, "blur-rule"); + parse_cfg_condlst(&cfg, &opt->blur_rules, "blur-include"); // wm-support if (config_lookup_string(&cfg, "wm-support", &sval)) { enum wm_support wm = parse_wm_support(sval); @@ -603,6 +604,7 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad } opt->support_for_wm = wm; } + lcfg_lookup_bool(&cfg, "blur-whitelist", &opt->blur_whitelist); // --opacity-rule parse_cfg_condlst_opct(opt, &cfg, "opacity-rule"); // --unredir-if-possible-exclude diff --git a/src/options.c b/src/options.c index c98a77e..c5f183c 100644 --- a/src/options.c +++ b/src/options.c @@ -108,7 +108,7 @@ static const struct picom_option picom_options[] = { {"benchmark" , required_argument, 293, NULL , "Benchmark mode. Repeatedly paint until reaching the specified cycles."}, {"benchmark-wid" , required_argument, 294, NULL , "Specify window ID to repaint in benchmark mode. If omitted or is 0, the whole" " screen is repainted."}, - {"blur-background-exclude" , required_argument, 296, "COND" , "Exclude conditions for background blur."}, + {"blur-exclude" , required_argument, 296, "COND" , "Exclude conditions for background blur."}, {"active-opacity" , required_argument, 297, NULL , "Default opacity for active windows. (0.0 - 1.0)"}, {"glx-no-rebind-pixmap" , no_argument , 298, NULL , NULL}, {"glx-swap-method" , required_argument, 299, NULL , NULL}, @@ -176,20 +176,21 @@ static const struct picom_option picom_options[] = { {"no-ewmh-fullscreen" , no_argument , 803, NULL , "Do not use EWMH to detect fullscreen windows. Reverts to checking if a " "window is fullscreen based only on its size and coordinates."}, {"animations", no_argument, 804, NULL, "Toggles Animations"}, - {"animation-stiffness", required_argument, 805, NULL, "stiffness"}, - {"animation-dampening", required_argument, 806, NULL, "dampening"}, - {"animation-window-mass", required_argument, 807, NULL, "window mass"}, - {"animation-clamping", no_argument, 808, NULL, "clamping"}, + {"animation-stiffness", required_argument, 805, NULL, "animation stiffness"}, + {"animation-dampening", required_argument, 806, NULL, "animation dampening"}, + {"animation-window-mass", required_argument, 807, NULL, "animation window mass"}, + {"animation-clamping", no_argument, 808, NULL, "toggle animation clamping"}, {"animation-for-open-window", required_argument, 809, NULL, "open window animation"}, // {"animation-for-transient-window", required_argument, 810, NULL, "transient window animation"}, {"animation-for-unmap-window", required_argument, 811, NULL, "unmap window animation"}, {"corners-rule", required_argument, 812, NULL, "rounded corner rules"}, - {"blur-rule", required_argument, 813, NULL, "blur rules"}, + {"blur-include", required_argument, 813, NULL, "blur rules"}, {"animation-open-exclude", required_argument, 814, NULL, "animation open exclude list"}, {"animation-unmap-exclude", required_argument, 815, NULL, "animation unmap exclude list"}, {"wm-support", required_argument, 816, NULL, "Set specific window manager support"}, {"active-opacity-exclude", required_argument, 817, NULL, "Exclude windows from being affected by active opacity"}, {"inactive-exclude", required_argument, 818, NULL, "Exclude windows from being affected by inactive opacity"}, + {"blur-whitelist", no_argument, 819, NULL, "Toggles Blur Whitelisting"}, }; // clang-format on @@ -815,6 +816,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, case 818: condlst_add(&opt->inactive_opacity_blacklist, optarg); break; + P_CASEBOOL(819, blur_whitelist); default: usage(argv[0], 1); break; #undef P_CASEBOOL } @@ -143,12 +143,14 @@ static void win_update_focused(session_t *ps, struct managed_win *w) { // Use wintype_focus, and treat WM windows and override-redirected // windows specially - if (ps->o.wintype_option[w->window_type].focus || - (ps->o.mark_wmwin_focused && w->wmwin) || - (ps->o.mark_ovredir_focused && w->base.id == w->client_win && !w->wmwin) || - (w->a.map_state == XCB_MAP_STATE_VIEWABLE && - c2_match(ps, w, ps->o.focus_blacklist, NULL))) { + if (ps->o.wintype_option[w->window_type].focus) { w->focused = true; + } else if (!ps->o.wintype_option[w->window_type].focus) { + w->focused = false; + } + + if (ps, w, ps->o.focus_blacklist, NULL) { + log_warn("Focus exclude is deprecated. Please use either 'inactive-exclude' or 'active-exclude'"); } // If window grouping detection is enabled, mark the window active if @@ -1508,14 +1510,21 @@ static void win_determine_blur_background(session_t *ps, struct managed_win *w) if (!ps->o.wintype_option[w->window_type].blur_background) { log_debug("Blur background disabled by wintypes"); blur_background_new = false; - } else if (c2_match(ps, w, ps->o.blur_background_blacklist, NULL)) { - log_debug("Blur background disabled by " - "blur-background-exclude"); - blur_background_new = false; - } else if (c2_match(ps, w, ps->o.blur_rules, NULL)) { - blur_background_new = true; - } else { - blur_background_new = false; + } + if (!ps->o.blur_whitelist) { + if (c2_match(ps, w, ps->o.blur_background_blacklist, NULL)) { + log_debug("Blur background disabled by " + "blur-exclude"); + blur_background_new = false; + } else { + blur_background_new = true; + } + } else if (ps->o.blur_whitelist) { + if (c2_match(ps, w, ps->o.blur_rules, NULL)) { + blur_background_new = true; + } else { + blur_background_new = false; + } } } |