]> code.delx.au - spectrwm/commitdiff
Add a new visible_noswap option that allow to not swap two visible workspace
authorJonathan Armani <dbd@asystant.net>
Tue, 7 Oct 2014 16:32:38 +0000 (18:32 +0200)
committerReginald Kennedy <rk@rejii.com>
Fri, 27 Feb 2015 19:59:25 +0000 (03:59 +0800)
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

index c6b6069f9904480d4efbca3cf2f1d92e0b6b7615..4fbbe0ba4622951ff345bbeb562178ed0267ab02 100644 (file)
@@ -334,6 +334,7 @@ int                 term_width = 0;
 int                    font_adjusted = 0;
 unsigned int           mod_key = MODKEY;
 bool                   warp_pointer = false;
 int                    font_adjusted = 0;
 unsigned int           mod_key = MODKEY;
 bool                   warp_pointer = false;
+bool                   visible_noswap = false;
 
 /* dmenu search */
 struct swm_region      *search_r;
 
 /* 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 {
                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;
                /* 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_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,
        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;
                                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;
        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 },
        { "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 },
        { "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 },