]> git.lizzy.rs Git - bspwm.git/commitdiff
Add node modifiers: `horizontal`, `vertical`
authortobias <tobias@freedom.localdomain>
Mon, 9 Mar 2020 17:48:56 +0000 (18:48 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Mon, 16 Mar 2020 11:19:24 +0000 (12:19 +0100)
doc/bspwm.1
doc/bspwm.1.asciidoc
src/parse.c
src/query.c
src/types.h

index 7e0a5c4c434b2e9e4befbeea4ddedfebd3d8e859..e1ae476d9112f76f50c3ffe5d23965392f42102a 100644 (file)
@@ -4,10 +4,10 @@
 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
 .\"      Date: 03/16/2020
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.9-6-g41b2de0
+.\"    Source: Bspwm 0.9.9-7-gda1dc1d
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "03/16/2020" "Bspwm 0\&.9\&.9\-6\-g41b2de0" "Bspwm Manual"
+.TH "BSPWM" "1" "03/16/2020" "Bspwm 0\&.9\&.9\-7\-gda1dc1d" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -274,6 +274,16 @@ Only consider nodes in the reference desktop\&.
 Only consider leaf nodes\&.
 .RE
 .PP
+[!]horizontal
+.RS 4
+Only consider nodes whose split type is horizontal\&.
+.RE
+.PP
+[!]vertical
+.RS 4
+Only consider nodes whose split type is vertical\&.
+.RE
+.PP
 [!]window
 .RS 4
 Only consider nodes that hold a window\&.
index fac7616f37394fd50077e9de8b078eda9d73973f..da6f80d953877622c34311d75d19a0696e72e4a9 100644 (file)
@@ -174,6 +174,12 @@ Modifiers
 [!]leaf::
        Only consider leaf nodes.
 
+[!]horizontal::
+       Only consider nodes whose split type is horizontal.
+
+[!]vertical::
+       Only consider nodes whose split type is vertical.
+
 [!]window::
        Only consider nodes that hold a window.
 
index 8035d1081963004b37a673ff1aad07306bea540c..d623fa0067ceb277ceee93d270c56362601ebd53 100644 (file)
@@ -542,6 +542,8 @@ bool parse_node_modifiers(char *desc, node_select_t *sel)
                GET_MOD(below)
                GET_MOD(normal)
                GET_MOD(above)
+               GET_MOD(horizontal)
+               GET_MOD(vertical)
                } else {
                        return false;
                }
index 4959f8195f8dc3c8851eaaedbc2f39fa9c543c23..f1be4b2569377381bb13022326c98085d7a06ca0 100644 (file)
@@ -470,7 +470,9 @@ node_select_t make_node_select(void)
                .ancestor_of = OPTION_NONE,
                .below = OPTION_NONE,
                .normal = OPTION_NONE,
-               .above = OPTION_NONE
+               .above = OPTION_NONE,
+               .horizontal = OPTION_NONE,
+               .vertical = OPTION_NONE
        };
        return sel;
 }
@@ -1140,6 +1142,20 @@ bool node_matches(coordinates_t *loc, coordinates_t *ref, node_select_t *sel)
        WFLAG(urgent)
 #undef WFLAG
 
+       if (sel->horizontal != OPTION_NONE &&
+           loc->node->split_type != TYPE_HORIZONTAL
+           ? sel->horizontal == OPTION_TRUE
+           : sel->horizontal == OPTION_FALSE) {
+               return false;
+       }
+
+       if (sel->vertical != OPTION_NONE &&
+           loc->node->split_type != TYPE_VERTICAL
+           ? sel->vertical == OPTION_TRUE
+           : sel->vertical == OPTION_FALSE) {
+               return false;
+       }
+
        return true;
 }
 
index 2c15a2649063a80535f89f5ad1f9836deb9f2c85..9da6565d8c3de877d3d61ea29edbd67e421723b3 100644 (file)
@@ -183,6 +183,8 @@ typedef struct {
        option_bool_t below;
        option_bool_t normal;
        option_bool_t above;
+       option_bool_t horizontal;
+       option_bool_t vertical;
 } node_select_t;
 
 typedef struct {