From f0afd9b61b4fa4631bf52456c545b7165cad5ae9 Mon Sep 17 00:00:00 2001 From: chenyc Date: Mon, 7 Apr 2025 12:39:36 +0800 Subject: [PATCH] feat: support option focus_cross_tag --- maomao.c | 7 +++++++ parse_config.h | 5 +++++ preset_config.h | 1 + 3 files changed, 13 insertions(+) diff --git a/maomao.c b/maomao.c index e799667..794db29 100644 --- a/maomao.c +++ b/maomao.c @@ -1906,6 +1906,13 @@ void focusdir(const Arg *arg) { focusclient(c, 1); if (warpcursor) warp_cursor(c); + } else { + if (config.focus_cross_tag) { + if (arg->i == LEFT || arg->i == UP) + viewtoleft_have_client(NULL); + if (arg->i == RIGHT || arg->i == DOWN) + viewtoright_have_client(NULL); + } } } diff --git a/parse_config.h b/parse_config.h index e821acd..8f5b0a7 100644 --- a/parse_config.h +++ b/parse_config.h @@ -106,6 +106,7 @@ typedef struct { int scroller_focus_center; int scroller_prefer_center; int focus_cross_monitor; + int focus_cross_tag; unsigned int swipe_min_threshold; float *scroller_proportion_preset; int scroller_proportion_preset_count; @@ -561,6 +562,8 @@ void parse_config_line(Config *config, const char *line) { config->scroller_prefer_center = atoi(value); } else if (strcmp(key, "focus_cross_monitor") == 0) { config->focus_cross_monitor = atoi(value); + } else if (strcmp(key, "focus_cross_tag") == 0) { + config->focus_cross_tag = atoi(value); } else if (strcmp(key, "swipe_min_threshold") == 0) { config->swipe_min_threshold = atoi(value); } else if (strcmp(key, "scroller_proportion_preset") == 0) { @@ -1193,6 +1196,7 @@ void override_config(void) { scroller_default_proportion_single = config.scroller_default_proportion_single; scroller_focus_center = config.scroller_focus_center; focus_cross_monitor = config.focus_cross_monitor; + focus_cross_tag = config.focus_cross_tag; swipe_min_threshold = config.swipe_min_threshold; scroller_prefer_center = config.scroller_prefer_center; @@ -1277,6 +1281,7 @@ void set_value_default() { config.scroller_focus_center = scroller_focus_center; config.scroller_prefer_center = scroller_prefer_center; config.focus_cross_monitor = focus_cross_monitor; + config.focus_cross_tag = focus_cross_tag; config.swipe_min_threshold = swipe_min_threshold; config.bypass_surface_visibility = bypass_surface_visibility; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ diff --git a/preset_config.h b/preset_config.h index 5964e2c..d0d6f8a 100644 --- a/preset_config.h +++ b/preset_config.h @@ -49,6 +49,7 @@ float scroller_default_proportion_single = 1.0; int scroller_focus_center = 0; int scroller_prefer_center = 0; int focus_cross_monitor = 0; +int focus_cross_tag = 0; unsigned int swipe_min_threshold = 20;