]> git.lizzy.rs Git - bspwm.git/commitdiff
Add node descriptor: pointed
authorBastien Dejean <nihilhill@gmail.com>
Tue, 19 Apr 2016 18:49:22 +0000 (20:49 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Tue, 19 Apr 2016 18:49:22 +0000 (20:49 +0200)
Fixes #456.

doc/bspwm.1
doc/bspwm.1.asciidoc
query.c

index 9c84975e841f1719504390b161be92010479000b..2dfe5bf93197e973e83bf59a1993fe1bb1f2faa4 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 04/16/2016
+.\"      Date: 04/19/2016
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.1-32-g828c93f
+.\"    Source: Bspwm 0.9.1-39-ge70f826
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "04/16/2016" "Bspwm 0\&.9\&.1\-32\-g828c93f" "Bspwm Manual"
+.TH "BSPWM" "1" "04/19/2016" "Bspwm 0\&.9\&.1\-39\-ge70f826" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -94,7 +94,7 @@ Select a node\&.
 .RS 4
 .\}
 .nf
-NODE_SEL := (DIR|CYCLE_DIR|PATH|last|older|newer|focused|biggest|<node_id>)[\&.[!]focused][\&.[!]automatic][\&.[!]local][\&.[!]leaf][\&.[!]window][\&.[!]STATE][\&.[!]FLAG][\&.[!]LAYER][\&.[!]same_class]
+NODE_SEL := (DIR|CYCLE_DIR|PATH|last|older|newer|focused|pointed|biggest|<node_id>)[\&.[!]focused][\&.[!]automatic][\&.[!]local][\&.[!]leaf][\&.[!]window][\&.[!]STATE][\&.[!]FLAG][\&.[!]LAYER][\&.[!]same_class]
 
 STATE := tiled|pseudo_tiled|floating|fullscreen
 
@@ -153,6 +153,11 @@ focused
 Selects the currently focused node\&.
 .RE
 .PP
+pointed
+.RS 4
+Selects the window under the pointer\&.
+.RE
+.PP
 biggest
 .RS 4
 Selects the biggest window on the current desktop\&.
index adc65b42dc3c903862dfdfb5dc21d31a26676675..1913660c805e9e03d4e8220171dc77a576af6e6d 100644 (file)
@@ -66,7 +66,7 @@ Node
 Select a node.
 
 ----
-NODE_SEL := (DIR|CYCLE_DIR|PATH|last|older|newer|focused|biggest|<node_id>)[.[!]focused][.[!]automatic][.[!]local][.[!]leaf][.[!]window][.[!]STATE][.[!]FLAG][.[!]LAYER][.[!]same_class]
+NODE_SEL := (DIR|CYCLE_DIR|PATH|last|older|newer|focused|pointed|biggest|<node_id>)[.[!]focused][.[!]automatic][.[!]local][.[!]leaf][.[!]window][.[!]STATE][.[!]FLAG][.[!]LAYER][.[!]same_class]
 
 STATE := tiled|pseudo_tiled|floating|fullscreen
 
@@ -103,6 +103,9 @@ newer::
 focused::
        Selects the currently focused node.
 
+pointed::
+       Selects the window under the pointer.
+
 biggest::
        Selects the biggest window on the current desktop.
 
diff --git a/query.c b/query.c
index 112c856cf1da905f1a763efc7c69d255a5acc8fc..483f72cdccb7a9be440f4f32c7a8c5fd505f9191 100644 (file)
--- a/query.c
+++ b/query.c
@@ -410,6 +410,14 @@ int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
                history_find_node(HISTORY_OLDER, ref, dst, sel);
        } else if (streq("biggest", desc)) {
                dst->node = find_biggest(ref->monitor, ref->desktop, ref->node, sel);
+       } else if (streq("pointed", desc)) {
+               xcb_window_t win;
+               query_pointer(&win, NULL);
+               if (locate_window(win, dst) && node_matches(dst, ref, sel)) {
+                       return SELECTOR_OK;
+               } else {
+                       return SELECTOR_INVALID;
+               }
        } else if (streq("focused", desc)) {
                coordinates_t loc = {mon, mon->desk, mon->desk->focus};
                if (node_matches(&loc, ref, sel)) {