.\" Title: bspwm
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\" Date: 08/13/2019
+.\" Date: 03/16/2020
.\" Manual: Bspwm Manual
-.\" Source: Bspwm 0.9.9
+.\" Source: Bspwm 0.9.9-6-g41b2de0
.\" Language: English
.\"
-.TH "BSPWM" "1" "08/13/2019" "Bspwm 0\&.9\&.9" "Bspwm Manual"
+.TH "BSPWM" "1" "03/16/2020" "Bspwm 0\&.9\&.9\-6\-g41b2de0" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.RS 4
.\}
.nf
-NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|any|last|newest|
+NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|any|first_ancestor|last|newest|
older|newer|focused|pointed|biggest|smallest|
<node_id>)[\&.[!]focused][\&.[!]active][\&.[!]automatic][\&.[!]local]
[\&.[!]leaf][\&.[!]window][\&.[!]STATE][\&.[!]FLAG][\&.[!]LAYER]
Selects the first node that matches the given selectors\&.
.RE
.PP
+first_ancestor
+.RS 4
+Selects the first ancestor of the reference node that matches the given selectors\&.
+.RE
+.PP
last
.RS 4
Selects the previously focused node relative to the reference node\&.
Select a node.
----
-NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|any|last|newest|
+NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|any|first_ancestor|last|newest|
older|newer|focused|pointed|biggest|smallest|
<node_id>)[.[!]focused][.[!]active][.[!]automatic][.[!]local]
[.[!]leaf][.[!]window][.[!]STATE][.[!]FLAG][.[!]LAYER]
any::
Selects the first node that matches the given selectors.
+first_ancestor::
+ Selects the first ancestor of the reference node that matches the given selectors.
+
last::
Selects the previously focused node relative to the reference node.
history_find_node(hdi, ref, dst, &sel);
} else if (streq("any", desc)) {
find_any_node(ref, dst, &sel);
+ } else if (streq("first_ancestor", desc)) {
+ find_first_ancestor(ref, dst, &sel);
} else if (streq("last", desc)) {
history_find_node(HISTORY_OLDER, ref, dst, &sel);
} else if (streq("newest", desc)) {
}
}
+void find_first_ancestor(coordinates_t *ref, coordinates_t *dst, node_select_t *sel)
+{
+ coordinates_t loc = {ref->monitor, ref->desktop, ref->node};
+ while ((loc.node = loc.node->parent) != NULL) {
+ if (node_matches(&loc, ref, sel)) {
+ *dst = loc;
+ return;
+ }
+ }
+}
+
/* Based on https://github.com/ntrrgc/right-window */
void find_nearest_neighbor(coordinates_t *ref, coordinates_t *dst, direction_t dir, node_select_t *sel)
{
node_t *find_by_id_in(node_t *r, uint32_t id);
void find_any_node(coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
bool find_any_node_in(monitor_t *m, desktop_t *d, node_t *n, coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
+void find_first_ancestor(coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
void find_nearest_neighbor(coordinates_t *ref, coordinates_t *dst, direction_t dir, node_select_t *sel);
unsigned int node_area(desktop_t *d, node_t *n);
int tiled_count(node_t *n, bool include_receptacles);