Add new rule consequence: split_dir

This commit is contained in:
Bastien Dejean 2014-02-02 14:10:44 +01:00
parent f5054b595f
commit ac0d0dcac2
5 changed files with 16 additions and 4 deletions

View file

@ -2,12 +2,12 @@
.\" Title: bspwm
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 01/21/2014
.\" Date: 02/02/2014
.\" Manual: Bspwm Manual
.\" Source: Bspwm 0.8.8
.\" Language: English
.\"
.TH "BSPWM" "1" "01/21/2014" "Bspwm 0\&.8\&.8" "Bspwm Manual"
.TH "BSPWM" "1" "02/02/2014" "Bspwm 0\&.8\&.8" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@ -886,7 +886,7 @@ rule \fIOPTIONS\fR
\fBOptions\fR
.RS 4
.PP
\fB\-a\fR, \fB\-\-add\fR <class_name>|<instance_name>|* [\fB\-o\fR|\fB\-\-one\-shot\fR] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|window=WINDOW_SEL] [(floating|fullscreen|pseudo_tiled|locked|sticky|private|center|lower|follow|manage|focus)=(true|false)]
\fB\-a\fR, \fB\-\-add\fR <class_name>|<instance_name>|* [\fB\-o\fR|\fB\-\-one\-shot\fR] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|window=WINDOW_SEL] [(floating|fullscreen|pseudo_tiled|locked|sticky|private|center|lower|follow|manage|focus)=(true|false)] [split_dir=DIR]
.RS 4
Create a new rule\&.
.RE

View file

@ -543,7 +543,7 @@ rule 'OPTIONS'
Options
^^^^^^^
*-a*, *--add* <class_name>|<instance_name>|* [*-o*|*--one-shot*] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|window=WINDOW_SEL] [(floating|fullscreen|pseudo_tiled|locked|sticky|private|center|lower|follow|manage|focus)=(true|false)]::
*-a*, *--add* <class_name>|<instance_name>|* [*-o*|*--one-shot*] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|window=WINDOW_SEL] [(floating|fullscreen|pseudo_tiled|locked|sticky|private|center|lower|follow|manage|focus)=(true|false)] [split_dir=DIR]::
Create a new rule.
*-r*, *--remove* ^<n>|head|tail|<class_name>|<instance_name>|*...::

2
rule.c
View file

@ -282,6 +282,8 @@ void parse_key_value(char *key, char *value, rule_consequence_t *csq)
snprintf(csq->desktop_desc, sizeof(csq->desktop_desc), "%s", value);
} else if (streq("window", key)) {
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 (parse_bool(value, &v)) {
if (streq("floating", key))
csq->floating = v;

View file

@ -264,6 +264,7 @@ typedef struct {
char monitor_desc[MAXLEN];
char desktop_desc[MAXLEN];
char node_desc[MAXLEN];
char split_dir[MAXLEN];
uint16_t min_width;
uint16_t max_width;
uint16_t min_height;

View file

@ -36,6 +36,7 @@
#include "settings.h"
#include "stack.h"
#include "tree.h"
#include "messages.h"
#include "window.h"
void schedule_window(xcb_window_t win)
@ -116,6 +117,14 @@ void manage_window(xcb_window_t win, rule_consequence_t *csq, int fd)
f = mon->desk->focus;
}
if (csq->split_dir[0] != '\0') {
direction_t dir;
if (parse_direction(csq->split_dir, &dir)) {
f->split_mode = MODE_MANUAL;
f->split_dir = dir;
}
}
client_t *c = make_client(win);
update_floating_rectangle(c);
c->min_width = csq->min_width;