diff --git a/doc/bspwm.1 b/doc/bspwm.1 index 60955c2..c4f9d08 100644 --- a/doc/bspwm.1 +++ b/doc/bspwm.1 @@ -2,12 +2,12 @@ .\" Title: bspwm .\" Author: [see the "Author" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/15/2015 +.\" Date: 02/21/2015 .\" Manual: Bspwm Manual .\" Source: Bspwm 0.8.9 .\" Language: English .\" -.TH "BSPWM" "1" "01/15/2015" "Bspwm 0\&.8\&.9" "Bspwm Manual" +.TH "BSPWM" "1" "02/21/2015" "Bspwm 0\&.8\&.9" "Bspwm Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -900,7 +900,7 @@ rule \fIOPTIONS\fR \fBOptions\fR .RS 4 .PP -\fB\-a\fR, \fB\-\-add\fR ||* [\fB\-o\fR|\fB\-\-one\-shot\fR] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|window=WINDOW_SEL] [(floating|fullscreen|pseudo_tiled|locked|sticky|private|center|follow|manage|focus|border)=(on|off)] [split_dir=DIR] +\fB\-a\fR, \fB\-\-add\fR ||* [\fB\-o\fR|\fB\-\-one\-shot\fR] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|window=WINDOW_SEL] [(floating|fullscreen|pseudo_tiled|locked|sticky|private|center|follow|manage|focus|border)=(on|off)] [split_dir=DIR] [split_ratio=RATIO] .RS 4 Create a new rule\&. .RE diff --git a/doc/bspwm.1.txt b/doc/bspwm.1.txt index bed3768..d2bfd1a 100644 --- a/doc/bspwm.1.txt +++ b/doc/bspwm.1.txt @@ -552,7 +552,7 @@ rule 'OPTIONS' Options ^^^^^^^ -*-a*, *--add* ||* [*-o*|*--one-shot*] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|window=WINDOW_SEL] [(floating|fullscreen|pseudo_tiled|locked|sticky|private|center|follow|manage|focus|border)=(on|off)] [split_dir=DIR]:: +*-a*, *--add* ||* [*-o*|*--one-shot*] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|window=WINDOW_SEL] [(floating|fullscreen|pseudo_tiled|locked|sticky|private|center|follow|manage|focus|border)=(on|off)] [split_dir=DIR] [split_ratio=RATIO]:: Create a new rule. *-r*, *--remove* ^|head|tail|||*...:: diff --git a/rule.c b/rule.c index 60bd0fc..862445e 100644 --- a/rule.c +++ b/rule.c @@ -280,6 +280,11 @@ void parse_key_value(char *key, char *value, rule_consequence_t *csq) snprintf(csq->node_desc, sizeof(csq->node_desc), "%s", value); } else if (streq("split_dir", key)) { snprintf(csq->split_dir, sizeof(csq->split_dir), "%s", value); + } else if (streq("split_ratio", key)) { + double rat; + if (sscanf(value, "%lf", &rat) == 1 && rat > 0 && rat < 1) { + csq->split_ratio = rat; + } } else if (parse_bool(value, &v)) { if (streq("floating", key)) csq->floating = v; diff --git a/types.h b/types.h index 3fca404..58449ea 100644 --- a/types.h +++ b/types.h @@ -273,6 +273,7 @@ typedef struct { char desktop_desc[MAXLEN]; char node_desc[MAXLEN]; char split_dir[SMALEN]; + double split_ratio; uint16_t min_width; uint16_t max_width; uint16_t min_height; diff --git a/window.c b/window.c index 253e80d..b7288ee 100644 --- a/window.c +++ b/window.c @@ -118,6 +118,10 @@ void manage_window(xcb_window_t win, rule_consequence_t *csq, int fd) } } + if (csq->split_ratio != 0) { + f->split_ratio = csq->split_ratio; + } + client_t *c = make_client(win, csq->border ? d->border_width : 0); update_floating_rectangle(c); if (c->floating_rectangle.x == 0 && c->floating_rectangle.y == 0)