aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorallusive-dev <[email protected]>2023-11-03 16:38:39 +1100
committerallusive-dev <[email protected]>2023-11-03 16:38:39 +1100
commit3543f63d0794b5290863e9f33af8d49745ad9a72 (patch)
tree504c54a16b18594fbbc44c3aa3cae03d45695023
parentsample config revamp (diff)
downloadcompfy-1.2.6.tar.xz
compfy-1.2.6.zip
DWM: Fixing opacity options1.2.6
-rw-r--r--meson.build4
-rw-r--r--src/config.c2
-rw-r--r--src/config.h4
-rw-r--r--src/config_libconfig.c4
-rw-r--r--src/options.c8
-rw-r--r--src/picom.c4
-rw-r--r--src/win.c80
7 files changed, 91 insertions, 15 deletions
diff --git a/meson.build b/meson.build
index 716b100..a294708 100644
--- a/meson.build
+++ b/meson.build
@@ -1,10 +1,10 @@
-project('picom', 'c', version: '1.2.5',
+project('picom', 'c', version: '1.2.6',
default_options: ['c_std=c11', 'warning_level=1'])
cc = meson.get_compiler('c')
# use project version by default
-version = 'v1.2.5'
+version = 'v1.2.6'
# use git describe if that's available
git = find_program('git', required: false)
diff --git a/src/config.c b/src/config.c
index 754a7d3..27812ab 100644
--- a/src/config.c
+++ b/src/config.c
@@ -853,6 +853,8 @@ char *parse_config(options_t *opt, const char *config_file, bool *shadow_enable,
.animation_clamping = true,
.animation_open_blacklist = NULL,
.animation_unmap_blacklist = NULL,
+ .active_opacity_blacklist = NULL,
+ .inactive_opacity_blacklist = NULL,
.corner_rules = NULL,
.blur_rules = NULL,
diff --git a/src/config.h b/src/config.h
index d5b2107..6a8e42b 100644
--- a/src/config.h
+++ b/src/config.h
@@ -289,6 +289,10 @@ typedef struct options {
c2_lptr_t *animation_open_blacklist;
// Rules to exclude windows from having a unmap animation
c2_lptr_t *animation_unmap_blacklist;
+ // Rules to exclude windows from having being affected by active-opacity
+ c2_lptr_t *active_opacity_blacklist;
+ // Rules to exclude windows from having being affected by inactive-opacity
+ c2_lptr_t *inactive_opacity_blacklist;
/// Limit window brightness
double max_brightness;
// Radius of rounded window corners
diff --git a/src/config_libconfig.c b/src/config_libconfig.c
index 0a5902e..57a3bf7 100644
--- a/src/config_libconfig.c
+++ b/src/config_libconfig.c
@@ -586,6 +586,10 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
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");
+ // inactive opacity exclude
+ parse_cfg_condlst(&cfg, &opt->inactive_opacity_blacklist, "inactive-opacity-exclude");
// corners-rule
parse_cfg_condlst_corner(opt, &cfg, "corners-rule");
// blur-rule
diff --git a/src/options.c b/src/options.c
index 87f0fa3..6bdfa0e 100644
--- a/src/options.c
+++ b/src/options.c
@@ -188,6 +188,8 @@ static const struct picom_option picom_options[] = {
{"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-opacity-exclude", required_argument, 818, NULL, "Exclude windows from being affected by inactive opacity"},
};
// clang-format on
@@ -807,6 +809,12 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
}
break;
}
+ case 817:
+ condlst_add(&opt->active_opacity_blacklist, optarg);
+ break;
+ case 818:
+ condlst_add(&opt->inactive_opacity_blacklist, optarg);
+ break;
default: usage(argv[0], 1); break;
#undef P_CASEBOOL
}
diff --git a/src/picom.c b/src/picom.c
index 46f74cd..4c6f306 100644
--- a/src/picom.c
+++ b/src/picom.c
@@ -2148,6 +2148,8 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
c2_list_postprocess(ps, ps->o.blur_rules) &&
c2_list_postprocess(ps, ps->o.animation_open_blacklist) &&
c2_list_postprocess(ps, ps->o.animation_unmap_blacklist) &&
+ c2_list_postprocess(ps, ps->o.active_opacity_blacklist) &&
+ c2_list_postprocess(ps, ps->o.inactive_opacity_blacklist) &&
c2_list_postprocess(ps, ps->o.focus_blacklist))) {
log_error("Post-processing of conditionals failed, some of your rules "
"might not work");
@@ -2542,6 +2544,8 @@ static void session_destroy(session_t *ps) {
c2_list_free(&ps->o.blur_rules, NULL);
c2_list_free(&ps->o.animation_open_blacklist, NULL);
c2_list_free(&ps->o.animation_unmap_blacklist, NULL);
+ c2_list_free(&ps->o.active_opacity_blacklist, NULL);
+ c2_list_free(&ps->o.inactive_opacity_blacklist, NULL);
c2_list_free(&ps->o.window_shader_fg_rules, free);
// Free tracked atom list
diff --git a/src/win.c b/src/win.c
index 65d1b60..0741ed8 100644
--- a/src/win.c
+++ b/src/win.c
@@ -1129,31 +1129,85 @@ double win_calc_opacity_target(session_t *ps, const struct managed_win *w) {
// Try obeying opacity property and window type opacity firstly
if (w->has_opacity_prop) {
opacity = ((double)w->opacity_prop) / OPAQUE;
- } else if (w->opacity_is_set) {
+ } else if (w->opacity_is_set && !ps->o.inactive_opacity_override) {
opacity = w->opacity_set;
+ } else if (w->opacity_is_set && ps->o.inactive_opacity_override) {
+ if (ps->o.support_for_wm == WM_SUPPORT_DWM) {
+ if (win_is_focused_raw(ps, w)) {
+ opacity = w->opacity_set;
+ } else if (!win_is_focused_raw(ps, w)) {
+ if (ps->o.inactive_opacity == 1.0) {
+ opacity = w->opacity_set;
+ } else {
+ opacity = ps->o.inactive_opacity;
+ }
+ }
+ } else {
+ if (win_is_focused_raw(ps, w)) {
+ opacity = w->opacity_set;
+ } else if (!w->focused) {
+ if (ps->o.inactive_opacity == 1.0) {
+ opacity = w->opacity_set;
+ } else {
+ opacity = ps->o.inactive_opacity;
+ }
+ }
+ }
} else if (!safe_isnan(ps->o.wintype_option[w->window_type].opacity)) {
opacity = ps->o.wintype_option[w->window_type].opacity;
} else {
+
// Respect active_opacity only when the window is physically
// focused
- if (win_is_focused_raw(ps, w))
+ if (win_is_focused_raw(ps, w)) {
+ // if (c2_match(ps, w, ps->o.active_opacity_blacklist, NULL)) {
+ // opacity = 1.0;
+ // } else {
opacity = ps->o.active_opacity;
- else if (!w->focused)
+ // }
+ } else if (!w->focused) {
// Respect inactive_opacity in some cases
+ // if (c2_match(ps, w, ps->o.inactive_opacity_blacklist, NULL)) {
+ // if (c2_match(ps, w, ps->o.active_opacity_blacklist, NULL)) {
+ // opacity = 1.0;
+ // } else {
+ // opacity = ps->o.active_opacity;
+ // }
+ // } else {
opacity = ps->o.inactive_opacity;
- }
-
- // Respect inactive opacity, with support for DWM.
- if (ps->o.support_for_wm == WM_SUPPORT_DWM) {
- if (ps->o.inactive_opacity_override && !win_is_focused_raw(ps, w)) {
- opacity = ps->o.inactive_opacity;
- }
- } else {
- if (ps->o.inactive_opacity_override && !w->focused) {
- opacity = ps->o.inactive_opacity;
+ // }
}
}
+ // // Respect inactive opacity, with support for DWM.
+ // if (ps->o.support_for_wm == WM_SUPPORT_DWM) {
+ // if (ps->o.inactive_opacity_override && !win_is_focused_raw(ps, w)) {
+ // // if (c2_match(ps, w, ps->o.inactive_opacity_blacklist, NULL)) {
+ // // if (c2_match(ps, w, ps->o.active_opacity_blacklist, NULL)) {
+ // // opacity = 1.0;
+ // // } else {
+ // // opacity = ps->o.active_opacity;
+ // // }
+ // // } else {
+ // opacity = ps->o.inactive_opacity;
+ // // }
+ // } else if (!ps->o.inactive_opacity_override && !win_is_focused_raw(ps, w)) {
+ // // if (c2_match(ps, w, ps->o.inactive_opacity_blacklist, NULL)) {
+ // // if (c2_match(ps, w, ps->o.active_opacity_blacklist, NULL)) {
+ // // opacity = 1.0;
+ // // } else {
+ // // opacity = ps->o.active_opacity;
+ // // }
+ // // } else {
+ // opacity = ps->o.inactive_opacity;
+ // // }
+ // }
+ // } else {
+ // if (ps->o.inactive_opacity_override && !w->focused) {
+ // opacity = ps->o.inactive_opacity;
+ // }
+ // }
+
return opacity;
}