Add node modifier: active

This commit is contained in:
Bastien Dejean 2016-09-22 22:30:38 +02:00
parent 70b477de2e
commit ccddf1231d
5 changed files with 23 additions and 5 deletions

View file

@ -2,12 +2,12 @@
.\" Title: bspwm
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 05/28/2016
.\" Date: 09/22/2016
.\" Manual: Bspwm Manual
.\" Source: Bspwm 0.9.1-80-g4583587
.\" Source: Bspwm 0.9.1-95-g70b477d
.\" Language: English
.\"
.TH "BSPWM" "1" "05/28/2016" "Bspwm 0\&.9\&.1\-80\-g4583587" "Bspwm Manual"
.TH "BSPWM" "1" "09/22/2016" "Bspwm 0\&.9\&.1\-95\-g70b477d" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@ -96,7 +96,7 @@ Select a node\&.
.RS 4
.\}
.nf
NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|older|newer|focused|pointed|biggest|<node_id>)[\&.[!]focused][\&.[!]automatic][\&.[!]local][\&.[!]leaf][\&.[!]window][\&.[!]STATE][\&.[!]FLAG][\&.[!]LAYER][\&.[!]same_class][\&.[!]descendant_of][\&.[!]ancestor_of]
NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|older|newer|focused|pointed|biggest|<node_id>)[\&.[!]focused][\&.[!]automatic][\&.[!]local][\&.[!]active][\&.[!]leaf][\&.[!]window][\&.[!]STATE][\&.[!]FLAG][\&.[!]LAYER][\&.[!]same_class][\&.[!]descendant_of][\&.[!]ancestor_of]
STATE := tiled|pseudo_tiled|floating|fullscreen
@ -230,6 +230,11 @@ Only consider nodes in automatic or manual insertion mode\&.
Only consider nodes in or not in the reference desktop\&.
.RE
.PP
[!]active
.RS 4
Only consider nodes in or not in the active desktop of their monitor\&.
.RE
.PP
[!]leaf
.RS 4
Only consider leaves or internal nodes\&.

View file

@ -70,7 +70,7 @@ Node
Select a node.
----
NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|older|newer|focused|pointed|biggest|<node_id>)[.[!]focused][.[!]automatic][.[!]local][.[!]leaf][.[!]window][.[!]STATE][.[!]FLAG][.[!]LAYER][.[!]same_class][.[!]descendant_of][.[!]ancestor_of]
NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|older|newer|focused|pointed|biggest|<node_id>)[.[!]focused][.[!]automatic][.[!]local][.[!]active][.[!]leaf][.[!]window][.[!]STATE][.[!]FLAG][.[!]LAYER][.[!]same_class][.[!]descendant_of][.[!]ancestor_of]
STATE := tiled|pseudo_tiled|floating|fullscreen
@ -148,6 +148,9 @@ Modifiers
[!]local::
Only consider nodes in or not in the reference desktop.
[!]active::
Only consider nodes in or not in the active desktop of their monitor.
[!]leaf::
Only consider leaves or internal nodes.

View file

@ -439,6 +439,7 @@ bool parse_node_modifiers(char *desc, node_select_t *sel)
GET_MOD(automatic)
GET_MOD(focused)
GET_MOD(local)
GET_MOD(active)
GET_MOD(leaf)
GET_MOD(window)
GET_MOD(pseudo_tiled)

View file

@ -339,6 +339,7 @@ node_select_t make_node_select(void)
.automatic = OPTION_NONE,
.focused = OPTION_NONE,
.local = OPTION_NONE,
.active = OPTION_NONE,
.leaf = OPTION_NONE,
.window = OPTION_NONE,
.tiled = OPTION_NONE,
@ -851,6 +852,13 @@ bool node_matches(coordinates_t *loc, coordinates_t *ref, node_select_t sel)
return false;
}
if (sel.active != OPTION_NONE &&
loc->desktop != loc->monitor->desk
? sel.active == OPTION_TRUE
: sel.active == OPTION_FALSE) {
return false;
}
if (sel.leaf != OPTION_NONE &&
!is_leaf(loc->node)
? sel.leaf == OPTION_TRUE

View file

@ -143,6 +143,7 @@ typedef struct {
option_bool_t automatic;
option_bool_t focused;
option_bool_t local;
option_bool_t active;
option_bool_t leaf;
option_bool_t window;
option_bool_t tiled;