]> git.lizzy.rs Git - bspwm.git/commitdiff
Allow setting a node's splitting type
authorBastien Dejean <nihilhill@gmail.com>
Tue, 1 Jun 2021 11:41:44 +0000 (13:41 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Tue, 1 Jun 2021 11:41:44 +0000 (13:41 +0200)
Closes #1291.

contrib/zsh_completion
doc/bspwm.1
doc/bspwm.1.asciidoc
src/messages.c
src/tree.c
src/tree.h

index c3d0b47dd54b469693902d619bb72c47e2945afb..106997f1c982c28808f3b484aa867b4fc6a06648 100644 (file)
@@ -178,6 +178,7 @@ _bspc() {
                                '*'{-n,--to-node}'[Transplant the selected node to the given node]:node selector:_bspc_selector -- node'\
                                '*'{-o,--presel-ratio}'[Set the splitting ratio of the preselection area]:preselect ratio: ( )'\
                                '*'{-p,--presel-dir}'[Preselect the splitting area of the selected node or cancel the preselection]: :_bspc_prefix -- "~" preselect presel_dir'\
+                               '*'{-y,--type}'[Set the splitting type of the selected node]: :(horizontal vertical)'\
                                '*'{-r,--ratio}'[Set the splitting ratio of the selected node (0 < ratio < 1)]: :( )'\
                                '*'{-R,--rotate}'[Rotate the tree rooted at the selected node]:angle:(90 270 180)'\
                                '*'{-s,--swap}'[Swap the selected node with the given node]:node selector:_bspc_selector -- node'\
index 9b589518e1018692ef174739abd3b5e115acdacc..59b0faa59a7471be2a1cf1b65efed98d49b9a942 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 05/28/2021
+.\"      Date: 06/01/2021
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.10-26-gbadfd6c
+.\"    Source: Bspwm 0.9.10-31-ge21ab5b
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "05/28/2021" "Bspwm 0\&.9\&.10\-26\-gbadfd6c" "Bspwm Manual"
+.TH "BSPWM" "1" "06/01/2021" "Bspwm 0\&.9\&.10\-31\-ge21ab5b" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -706,6 +706,11 @@ pixels horizontally and
 pixels vertically\&.
 .RE
 .PP
+\fB\-y\fR, \fB\-\-type\fR \fIhorizontal|vertical\fR
+.RS 4
+Set the splitting type of the selected node\&.
+.RE
+.PP
 \fB\-r\fR, \fB\-\-ratio\fR \fIRATIO\fR|(+|\-)(\fIPIXELS\fR|\fIFRACTION\fR)
 .RS 4
 Set the splitting ratio of the selected node (0 <
index 1874f245f10ba7747fc80abd91acfb2749e1887c..6e86413a799aed040d5756df4063ae3268a125f9 100644 (file)
@@ -434,6 +434,9 @@ Commands
 *-z*, *--resize* top|left|bottom|right|top_left|top_right|bottom_right|bottom_left 'dx' 'dy'::
        Resize the selected window by moving the given handle by 'dx' pixels horizontally and 'dy' pixels vertically.
 
+*-y*, *--type* 'horizontal|vertical'::
+       Set the splitting type of the selected node.
+
 *-r*, *--ratio* 'RATIO'|(+|-)('PIXELS'|'FRACTION')::
        Set the splitting ratio of the selected node (0 < 'RATIO' < 1).
 
index 5b6e608ac7c2da96fe6da06f29eb173a6cdd4155..bca55c99fbf8b3842053019b06b6e41a010f06f4 100644 (file)
@@ -458,6 +458,24 @@ void cmd_node(char **args, int num, FILE *rsp)
                                fail(rsp, "node %s: Invalid resize handle argument: '%s'.\n", *(args - 1), *args);
                                break;
                        }
+               } else if (streq("-y", *args) || streq("--type", *args)) {
+                       num--, args++;
+                       if (num < 1) {
+                               fail(rsp, "node %s: Not enough arguments.\n", *(args - 1));
+                               break;
+                       }
+                       if (trg.node == NULL) {
+                               fail(rsp, "");
+                               break;
+                       }
+                       split_type_t typ;
+                       if (parse_split_type(*args, &typ)) {
+                               set_type(trg.node, typ);
+                               changed = true;
+                       } else {
+                               fail(rsp, "");
+                               break;
+                       }
                } else if (streq("-r", *args) || streq("--ratio", *args)) {
                        num--, args++;
                        if (num < 1) {
index e6faadd8dc3497f4200a6163c22e9408688a13d2..6f75dc366307578ad93cccff0e8efe361e5f615c 100644 (file)
@@ -190,6 +190,17 @@ presel_t *make_presel(void)
        return p;
 }
 
+void set_type(node_t *n, split_type_t typ)
+{
+       if (n == NULL) {
+               return;
+       }
+
+       n->split_type = typ;
+       update_constraints(n);
+       rebuild_constraints_towards_root(n);
+}
+
 void set_ratio(node_t *n, double rat)
 {
        if (n == NULL) {
index 1acc4bb8b09a1036f2b03ff5ef51572b4d8e8c4a..aa04cde206bc8795cfd0e8619903acc2921b7f1f 100644 (file)
@@ -31,6 +31,7 @@
 void arrange(monitor_t *m, desktop_t *d);
 void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, xcb_rectangle_t root_rect);
 presel_t *make_presel(void);
+void set_type(node_t *n, split_type_t typ);
 void set_ratio(node_t *n, double rat);
 void presel_dir(monitor_t *m, desktop_t *d, node_t *n, direction_t dir);
 void presel_ratio(monitor_t *m, desktop_t *d, node_t *n, double ratio);