From 5c1ef92b2150f8f71686c40522f7d5829ec04a6e Mon Sep 17 00:00:00 2001 From: Emanuele Torre Date: Mon, 26 Jul 2021 18:10:08 +0200 Subject: [PATCH] Allow cycling the splitting type of a node --- doc/bspwm.1 | 10 +++++----- doc/bspwm.1.asciidoc | 4 ++-- src/messages.c | 7 +++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/bspwm.1 b/doc/bspwm.1 index 59b0faa..9863c2d 100644 --- a/doc/bspwm.1 +++ b/doc/bspwm.1 @@ -2,12 +2,12 @@ .\" Title: bspwm .\" Author: [see the "Author" section] .\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 06/01/2021 +.\" Date: 02/15/2022 .\" Manual: Bspwm Manual -.\" Source: Bspwm 0.9.10-31-ge21ab5b +.\" Source: Bspwm 0.9.10-34-g3403bb2 .\" Language: English .\" -.TH "BSPWM" "1" "06/01/2021" "Bspwm 0\&.9\&.10\-31\-ge21ab5b" "Bspwm Manual" +.TH "BSPWM" "1" "02/15/2022" "Bspwm 0\&.9\&.10\-34\-g3403bb2" "Bspwm Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -706,9 +706,9 @@ pixels horizontally and pixels vertically\&. .RE .PP -\fB\-y\fR, \fB\-\-type\fR \fIhorizontal|vertical\fR +\fB\-y\fR, \fB\-\-type\fR \fICYCLE_DIR\fR|horizontal|vertical .RS 4 -Set the splitting type of the selected node\&. +Set or cycle the splitting type of the selected node\&. .RE .PP \fB\-r\fR, \fB\-\-ratio\fR \fIRATIO\fR|(+|\-)(\fIPIXELS\fR|\fIFRACTION\fR) diff --git a/doc/bspwm.1.asciidoc b/doc/bspwm.1.asciidoc index 6e86413..e84150b 100644 --- a/doc/bspwm.1.asciidoc +++ b/doc/bspwm.1.asciidoc @@ -434,8 +434,8 @@ 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. +*-y*, *--type* 'CYCLE_DIR'|horizontal|vertical:: + Set or cycle the splitting type of the selected node. *-r*, *--ratio* 'RATIO'|(+|-)('PIXELS'|'FRACTION'):: Set the splitting ratio of the selected node (0 < 'RATIO' < 1). diff --git a/src/messages.c b/src/messages.c index bca55c9..c3a4201 100644 --- a/src/messages.c +++ b/src/messages.c @@ -468,14 +468,17 @@ void cmd_node(char **args, int num, FILE *rsp) fail(rsp, ""); break; } + cycle_dir_t cyc; split_type_t typ; - if (parse_split_type(*args, &typ)) { + if (parse_cycle_direction(*args, &cyc)) { + set_type(trg.node, (trg.node->split_type + 1) % 2); + } else if (parse_split_type(*args, &typ)) { set_type(trg.node, typ); - changed = true; } else { fail(rsp, ""); break; } + changed = true; } else if (streq("-r", *args) || streq("--ratio", *args)) { num--, args++; if (num < 1) { -- 2.44.0