diff --git a/compton.sample.conf b/compton.sample.conf index fe78a693..61b52ee8 100644 --- a/compton.sample.conf +++ b/compton.sample.conf @@ -27,6 +27,7 @@ fade-out-step = 0.03 # Other mark-wmwin-focused = true; +mark-ovredir-focused = true; # Window type settings wintypes: diff --git a/src/compton.c b/src/compton.c index 0d1f30e7..8294dd99 100644 --- a/src/compton.c +++ b/src/compton.c @@ -125,6 +125,7 @@ static options_t opts = { .frame_opacity = 0.0, .inactive_dim = 0.0, .mark_wmwin_focused = False, + .mark_ovredir_focused = False, .shadow_blacklist = NULL, .fade_blacklist = NULL, .fork_after_register = False, @@ -1584,8 +1585,10 @@ map_win(Display *dpy, Window id, if (opts.track_focus) { recheck_focus(dpy); // Consider a window without client window a WM window and mark it - // focused if mark_wmwin_focused is on - if (opts.mark_wmwin_focused && !w->client_win) + // focused if mark_wmwin_focused is on, or it's over-redirected and + // mark_ovredir_focused is on + if ((opts.mark_wmwin_focused && !w->client_win) + || (opts.mark_ovredir_focused && w->a.override_redirect)) w->focused = True; } @@ -2880,6 +2883,8 @@ usage(void) { " Try to detect WM windows and mark them as active.\n" "--shadow-exclude condition\n" " Exclude conditions for shadows.\n" + "--mark-ovredir-focused\n" + " Mark over-redirect windows as active.\n" "\n" "Format of a condition:\n" "\n" @@ -3127,6 +3132,9 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) { config_lookup_float(&cfg, "inactive-dim", &opts.inactive_dim); // --mark-wmwin-focused lcfg_lookup_bool(&cfg, "mark-wmwin-focused", &opts.mark_wmwin_focused); + // --mark-ovredir-focused + lcfg_lookup_bool(&cfg, "mark-ovredir-focused", + &opts.mark_ovredir_focused); // --shadow-exclude { config_setting_t *setting = @@ -3185,6 +3193,7 @@ get_cfg(int argc, char *const *argv) { { "inactive-dim", required_argument, NULL, 261 }, { "mark-wmwin-focused", no_argument, NULL, 262 }, { "shadow-exclude", required_argument, NULL, 263 }, + { "mark-ovredir-focused", no_argument, NULL, 264 }, // Must terminate with a NULL entry { NULL, 0, NULL, 0 }, }; @@ -3319,6 +3328,10 @@ get_cfg(int argc, char *const *argv) { // --shadow-exclude condlst_add(&opts.shadow_blacklist, optarg); break; + case 264: + // --mark-ovredir-focused + opts.mark_ovredir_focused = True; + break; default: usage(); break; diff --git a/src/compton.h b/src/compton.h index 77166a66..f785981e 100644 --- a/src/compton.h +++ b/src/compton.h @@ -246,6 +246,8 @@ typedef struct _options { char *display; /// Whether to try to detect WM windows and mark them as focused. Bool mark_wmwin_focused; + /// Whether to mark override-redirect windows as focused. + Bool mark_ovredir_focused; /// Whether to fork to background. Bool fork_after_register; Bool synchronize;