Skip to content

Commit

Permalink
Add option to tweak inactive window blur opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
dshoreman committed Apr 18, 2023
1 parent c586170 commit 45dc995
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/backend/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,8 @@ void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) {

// Blur window
if (w->blur_foreground) {
// FIXME Think more about combining blur w/ opacity
// FIXME Don't hardcode opacity
// - needs to be set when focus_mode set to true
double blur_opacity = 1;
ps->backend_data->ops->blur(
ps->backend_data, blur_opacity,
ps->backend_data, ps->o.inactive_blur_opacity,
ps->backend_blur_fgcontext, w->mask_image, window_coord,
&reg_paint_in_bound, &reg_visible);
}
Expand Down
1 change: 1 addition & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable,

.inactive_blur = false,
.inactive_blur_list = NULL,
.inactive_blur_opacity = 1.0,
.inactive_dim = 0.0,
.inactive_dim_fixed = false,
.inactive_opacity = 1.0,
Expand Down
4 changes: 3 additions & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,10 @@ typedef struct options {
char *window_shader_fg;
/// Rules to change custom fragment shader for painting windows.
c2_lptr_t *window_shader_fg_rules;
/// Whether to blur inactive windows
/// Whether to blur inactive window foregrounds
bool inactive_blur;
// Opacity of inactive foreground blurs
double inactive_blur_opacity;
/// List of windows that should be blurred out when inactive.
c2_lptr_t *inactive_blur_list;
/// How much to dim an inactive window. 0.0 - 1.0, 0 to disable.
Expand Down
1 change: 1 addition & 0 deletions src/config_libconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
// --inactive-blur
if (lcfg_lookup_bool(&cfg, "inactive-blur", &opt->inactive_blur)) {
parse_cfg_condlst(&cfg, &opt->inactive_blur_list, "inactive-blur-include");
config_lookup_float(&cfg, "inactive-blur-opacity", &opt->inactive_blur_opacity);
}
// --resize-damage
config_lookup_int(&cfg, "resize-damage", &opt->resize_damage);
Expand Down
5 changes: 5 additions & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static const struct picom_option picom_options[] = {
{"inactive-blur-include" , required_argument, 342, NULL , "Conditions for windows that should be fully blurred when inactive."
"When --inactive-blur is enabled without an --inactive-blur-include"
"condition, the foreground of ALL inactive windows will be blurred."},
{"inactive-blur-opacity" , required_argument, 343, NULL , "Set the opacity of inactive foreground blurs"},
{"mark-wmwin-focused" , no_argument , 262, NULL , "Try to detect WM windows and mark them as active."},
{"shadow-exclude" , required_argument, 263, NULL , "Exclude conditions for shadows."},
{"mark-ovredir-focused" , no_argument , 264, NULL , "Mark windows that have no WM frame as active."},
Expand Down Expand Up @@ -750,6 +751,10 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
// --inactive-blur-include
condlst_add(&opt->inactive_blur_list, optarg);
break;
case 343:
// --inactive-blur-opacity
opt->inactive_blur_opacity = normalize_d(atof(optarg));
break;
P_CASEBOOL(733, legacy_backends);
P_CASEBOOL(800, monitor_repaint);
case 801:
Expand Down

0 comments on commit 45dc995

Please sign in to comment.