From aac2f2f4bae52bcac4487e785f64b2cf09d53ccd Mon Sep 17 00:00:00 2001 From: Jonathan Armani Date: Tue, 7 Oct 2014 18:32:38 +0200 Subject: [PATCH] Add a new visible_noswap option that allow to not swap two visible workspace This is useful in multi monitor setup, if you have workspace 1 on left and workspace 2 on right monitor, trying to switch from 1 to 2 on left region now does nothing. This option can be enabled in combination with warp_pointer to send the mouse pointer on the non-swapped workspace. --- spectrwm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spectrwm.c b/spectrwm.c index c6b6069..4fbbe0b 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -334,6 +334,7 @@ int term_width = 0; int font_adjusted = 0; unsigned int mod_key = MODKEY; bool warp_pointer = false; +bool visible_noswap = false; /* dmenu search */ struct swm_region *search_r; @@ -3897,6 +3898,11 @@ switchws(struct swm_region *r, union arg *args) old_ws->r = NULL; unmap_old = true; } else { + if (visible_noswap) { + center_pointer(other_r); + return; + } + /* the other ws is visible in another region, exchange them */ other_r->ws_prior = new_ws; other_r->ws = old_ws; @@ -8043,6 +8049,7 @@ enum { SWM_S_URGENT_COLLAPSE, SWM_S_URGENT_ENABLED, SWM_S_VERBOSE_LAYOUT, + SWM_S_VISIBLE_NOSWAP, SWM_S_WARP_POINTER, SWM_S_WINDOW_CLASS_ENABLED, SWM_S_WINDOW_INSTANCE_ENABLED, @@ -8261,6 +8268,9 @@ setconfvalue(const char *selector, const char *value, int flags) layouts[i].l_string = plain_stacker; } break; + case SWM_S_VISIBLE_NOSWAP: + visible_noswap = (atoi(value) != 0); + break; case SWM_S_WARP_POINTER: warp_pointer = (atoi(value) != 0); break; @@ -8601,6 +8611,7 @@ struct config_option configopt[] = { { "urgent_collapse", setconfvalue, SWM_S_URGENT_COLLAPSE }, { "urgent_enabled", setconfvalue, SWM_S_URGENT_ENABLED }, { "verbose_layout", setconfvalue, SWM_S_VERBOSE_LAYOUT }, + { "visible_noswap", setconfvalue, SWM_S_VISIBLE_NOSWAP }, { "warp_pointer", setconfvalue, SWM_S_WARP_POINTER }, { "window_class_enabled", setconfvalue, SWM_S_WINDOW_CLASS_ENABLED }, { "window_instance_enabled", setconfvalue, SWM_S_WINDOW_INSTANCE_ENABLED }, -- 2.39.2