]> git.lizzy.rs Git - bspwm.git/commitdiff
Add new monitor selector : pointed.
authorJustinien Bouron <justinien.bouron@epfl.ch>
Thu, 24 Aug 2017 19:04:23 +0000 (21:04 +0200)
committerJustinien Bouron <justinien.bouron@epfl.ch>
Thu, 24 Aug 2017 19:04:23 +0000 (21:04 +0200)
doc/bspwm.1
doc/bspwm.1.asciidoc
src/query.c

index 650f07d24845e26e57e05182d892b3c79b6b9eba..cb9b0722be77415c258634eb3a34b97431860b29 100644 (file)
@@ -384,7 +384,7 @@ Select a monitor\&.
 .RS 4
 .\}
 .nf
-MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|older|newer|focused|primary|^<n>|<monitor_id>|<monitor_name>)[\&.[!]occupied][\&.[!]focused]
+MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|older|newer|focused|pointed|primary|^<n>|<monitor_id>|<monitor_name>)[\&.[!]occupied][\&.[!]focused]
 .fi
 .if n \{\
 .RE
@@ -428,6 +428,11 @@ focused
 Selects the currently focused monitor\&.
 .RE
 .PP
+pointed
+.RS 4
+Selects the monitor under the pointer\&.
+.RE
+.PP
 primary
 .RS 4
 Selects the primary monitor\&.
index e4b2de92d6b5ec099eac37d8deab07b8ae1dddae..10cb37e6fd955d979ad3b311a075ea117376ea46 100644 (file)
@@ -234,7 +234,7 @@ Monitor
 Select a monitor.
 
 ----
-MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|older|newer|focused|primary|^<n>|<monitor_id>|<monitor_name>)[.[!]occupied][.[!]focused]
+MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|older|newer|focused|pointed|primary|^<n>|<monitor_id>|<monitor_name>)[.[!]occupied][.[!]focused]
 ----
 
 Descriptors
@@ -258,6 +258,9 @@ newer::
 focused::
        Selects the currently focused monitor.
 
+pointed::
+       Selects the monitor under the pointer.
+
 primary::
        Selects the primary monitor.
 
index 7498812870d9a54f69cec429faa8436ea6e57c50..83c6cb5dc04951195bc5482e3cc0c53c5cb9d431 100644 (file)
@@ -33,6 +33,7 @@
 #include "window.h"
 #include "tree.h"
 #include "query.h"
+#include "geometry.h"
 
 void query_tree(FILE *rsp)
 {
@@ -731,6 +732,15 @@ int monitor_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
                if (monitor_matches(&loc, ref, sel)) {
                        dst->monitor = mon;
                }
+       } else if (streq("pointed", desc)) {
+               xcb_point_t pointer;
+               query_pointer(NULL, &pointer);
+               for (monitor_t *m = mon_head; m != NULL; m = m->next) {
+                       if (is_inside(pointer, m->rectangle)) {
+                               dst->monitor = m;
+                               break;
+                       }
+               }
        } else if (parse_index(desc, &idx) && monitor_from_index(idx, dst)) {
                free(desc_copy);
                if (monitor_matches(dst, ref, sel)) {