From 5c7dfa41b5e0357eb4568a2ebce778a96210d6f8 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 25 Mar 2025 10:15:54 +0800 Subject: [PATCH] feat: add option focus_cross_monitor --- config.conf | 1 + maomao.c | 4 ++-- parse_config.h | 5 +++++ preset_config.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config.conf b/config.conf index 4910f69d..dc01b2a6 100644 --- a/config.conf +++ b/config.conf @@ -19,6 +19,7 @@ animation_curve_close=0.08,0.92,0,1 scroller_structs=20 scroller_default_proportion=0.8 scoller_focus_center=0 +focus_cross_monitor=0 scroller_proportion_preset=0.5,0.8,1.0 # Master-Stack Layout Setting (tile,spiral,dwindle) diff --git a/maomao.c b/maomao.c index 5a10d19c..b3f2d65e 100644 --- a/maomao.c +++ b/maomao.c @@ -1697,7 +1697,7 @@ Client *direction_select(const Arg *arg) { // 第一次遍历,计算客户端数量 wl_list_for_each(c, &clients, link) { - if (c && (c->tags & c->mon->tagset[c->mon->seltags])) { + if (c && (focus_cross_monitor || c->mon == selmon) && (c->tags & c->mon->tagset[c->mon->seltags])) { last++; } } @@ -1716,7 +1716,7 @@ Client *direction_select(const Arg *arg) { // 第二次遍历,填充 tempClients last = -1; wl_list_for_each(c, &clients, link) { - if (c && (c->tags & c->mon->tagset[c->mon->seltags])) { + if (c && (focus_cross_monitor || c->mon == selmon) && (c->tags & c->mon->tagset[c->mon->seltags])) { last++; tempClients[last] = c; } diff --git a/parse_config.h b/parse_config.h index 5706053e..7c79ca16 100644 --- a/parse_config.h +++ b/parse_config.h @@ -93,6 +93,7 @@ typedef struct { int scroller_structs; float scroller_default_proportion; int scoller_focus_center; + int focus_cross_monitor; float *scroller_proportion_preset; int scroller_proportion_preset_count; @@ -552,6 +553,8 @@ void parse_config_line(Config *config, const char *line) { config->scroller_default_proportion = atof(value); } else if (strcmp(key, "scoller_focus_center") == 0) { config->scoller_focus_center = atoi(value); + } else if (strcmp(key, "focus_cross_monitor") == 0) { + config->focus_cross_monitor = atoi(value); } else if (strcmp(key, "scroller_proportion_preset") == 0) { // 1. 统计 value 中有多少个逗号,确定需要解析的浮点数个数 int count = 0; // 初始化为 0 @@ -1130,6 +1133,7 @@ void override_config(void) { scroller_structs = config.scroller_structs; scroller_default_proportion = config.scroller_default_proportion; scoller_focus_center = config.scoller_focus_center; + focus_cross_monitor = config.focus_cross_monitor; new_is_master = config.new_is_master; default_mfact = config.default_mfact; @@ -1208,6 +1212,7 @@ void set_value_default() { config.scroller_structs = 20; config.scroller_default_proportion = 0.9; config.scoller_focus_center = 0; + config.focus_cross_monitor = 0; config.bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's diff --git a/preset_config.h b/preset_config.h index 848593fd..535655cd 100644 --- a/preset_config.h +++ b/preset_config.h @@ -46,6 +46,7 @@ unsigned int gappov = 10; /* vert outer gap between windows and screen edge */ int scroller_structs = 20; float scroller_default_proportion = 0.9; int scoller_focus_center = 0; +int focus_cross_monitor = 0; int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's