]> git.lizzy.rs Git - bspwm.git/commitdiff
Add node modifier: active
authorBastien Dejean <nihilhill@gmail.com>
Thu, 22 Sep 2016 20:30:38 +0000 (22:30 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Thu, 22 Sep 2016 20:30:38 +0000 (22:30 +0200)
doc/bspwm.1
doc/bspwm.1.asciidoc
parse.c
query.c
types.h

index 7e66d337b4559b30467658172c26fa92fb2b4ad9..54c69b06fa02b66cd88f60f4167a2d5deed42f17 100644 (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\&.
index 3282069210a861185fb6883c731d05bb4703f495..0c538e19365f755f86789111f1976a035b1922a2 100644 (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.
 
diff --git a/parse.c b/parse.c
index 5c40672555ed7bcf905b6ac6ab57a73ae949e0de..2ee1a2d7deffeb643bcaa02448d040c9ebd3bb96 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -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)
diff --git a/query.c b/query.c
index 11e774a026b7fa37939d2284466a51ef03ca89af..025d5063c8948c348f15569931928770d137fb8a 100644 (file)
--- a/query.c
+++ b/query.c
@@ -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
diff --git a/types.h b/types.h
index 2ad5c2fe4de11c3840c20f3c179761756921ba3f..3df88694b070bbfa829965ceb90ddf0074496447 100644 (file)
--- a/types.h
+++ b/types.h
@@ -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;