.\" Title: bspwm
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 04/10/2016
+.\" Date: 04/14/2016
.\" Manual: Bspwm Manual
-.\" Source: Bspwm 0.9.1-16-gc6c52e2
+.\" Source: Bspwm 0.9.1-26-g789cb8a
.\" Language: English
.\"
-.TH "BSPWM" "1" "04/10/2016" "Bspwm 0\&.9\&.1\-16\-gc6c52e2" "Bspwm Manual"
+.TH "BSPWM" "1" "04/14/2016" "Bspwm 0\&.9\&.1\-26\-g789cb8a" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
\fBOptions\fR
.RS 4
.PP
-[\fB\-m\fR,\fB\-\-monitor\fR [\fIMONITOR_SEL\fR]] | [\fB\-d\fR,\fB\-\-desktop\fR [\fIDESKTOP_SEL\fR]] | [\fB\-n\fR, \fB\-\-node\fR [\fINODE_SEL\fR]]
+\fB\-m\fR,\fB\-\-monitor\fR [\fIMONITOR_SEL\fR], \fB\-d\fR,\fB\-\-desktop\fR [\fIDESKTOP_SEL\fR], \fB\-n\fR, \fB\-\-node\fR [\fINODE_SEL\fR]
.RS 4
Constrain matches to the selected monitor, desktop or node\&. The descriptor can be omitted for
\fI\-M\fR,
Options
^^^^^^^
-[*-m*,*--monitor* ['MONITOR_SEL']] | [*-d*,*--desktop* ['DESKTOP_SEL']] | [*-n*, *--node* ['NODE_SEL']]::
+*-m*,*--monitor* ['MONITOR_SEL']::
+*-d*,*--desktop* ['DESKTOP_SEL']::
+*-n*, *--node* ['NODE_SEL']::
Constrain matches to the selected monitor, desktop or node. The descriptor can be omitted for '-M', '-D' and '-N'.
Wm
desktop_select_t *desktop_sel = NULL;
node_select_t *node_sel = NULL;
domain_t dom = DOMAIN_TREE;
- int d = 0, t = 0;
+
+ if (num < 1) {
+ fail(rsp, "query: Not enough arguments.\n");
+ return;
+ }
while (num > 0) {
if (streq("-T", *args) || streq("--tree", *args)) {
- dom = DOMAIN_TREE, d++;
+ dom = DOMAIN_TREE;
} else if (streq("-M", *args) || streq("--monitors", *args)) {
- dom = DOMAIN_MONITOR, d++;
+ dom = DOMAIN_MONITOR;
} else if (streq("-D", *args) || streq("--desktops", *args)) {
- dom = DOMAIN_DESKTOP, d++;
+ dom = DOMAIN_DESKTOP;
} else if (streq("-N", *args) || streq("--nodes", *args)) {
- dom = DOMAIN_NODE, d++;
+ dom = DOMAIN_NODE;
} else if (streq("-m", *args) || streq("--monitor", *args)) {
if (num > 1 && *(args + 1)[0] != OPT_CHR) {
num--, args++;
} else {
trg.monitor = ref.monitor;
}
- t++;
} else if (streq("-d", *args) || streq("--desktop", *args)) {
if (num > 1 && *(args + 1)[0] != OPT_CHR) {
num--, args++;
trg.monitor = ref.monitor;
trg.desktop = ref.desktop;
}
- t++;
} else if (streq("-n", *args) || streq("--node", *args)) {
if (num > 1 && *(args + 1)[0] != OPT_CHR) {
num--, args++;
goto end;
}
}
- t++;
} else {
fail(rsp, "query: Unknown option: '%s'.\n", *args);
goto end;
num--, args++;
}
- if (d != 1 || t > 1) {
- fail(rsp, "query: Exactly one domain and at most one constraint must be specified.\n");
+ if (dom == DOMAIN_TREE && trg.monitor == NULL) {
+ fail(rsp, "query -T: No constraints given.\n");
goto end;
}
query_node(trg.node, rsp);
} else if (trg.desktop != NULL) {
query_desktop(trg.desktop, rsp);
- } else if (trg.monitor != NULL) {
+ } else {
query_monitor(trg.monitor, rsp);
- } else {
- fail(rsp, "");
- goto end;
}
fprintf(rsp, "\n");
}