]> git.lizzy.rs Git - bspwm.git/commitdiff
add new selector modifier: unfocused
authorJoseph Lansdowne <J49137@gmail.com>
Sat, 3 Jan 2015 11:44:56 +0000 (11:44 +0000)
committerJoseph Lansdowne <J49137@gmail.com>
Sun, 4 Jan 2015 19:53:18 +0000 (19:53 +0000)
doc/bspwm.1
doc/bspwm.1.txt
query.c
types.h

index 15f280c3e4fa45db15ecb6a4c07651c464caa337..95fab401142e945d5fdf164dd46fca0d84f28435 100644 (file)
@@ -167,7 +167,7 @@ Select a window\&.
 .\}
 .nf
 WINDOW_SEL := <window_id>
-            | (DIR|CYCLE_DIR|biggest|last|focused|older|newer)[\&.floating|\&.tiled][\&.like|\&.unlike][\&.manual|\&.automatic][\&.urgent][\&.local]
+            | (DIR|CYCLE_DIR|biggest|last|focused|older|newer)[\&.floating|\&.tiled][\&.like|\&.unlike][\&.manual|\&.automatic][\&.urgent][\&.local][\&.unfocused]
 .fi
 .if n \{\
 .RE
@@ -264,6 +264,11 @@ urgent
 .RS 4
 Only consider urgent windows\&.
 .RE
+.PP
+unfocused
+.RS 4
+Only consider windows other than the focused window\&.
+.RE
 .RE
 .SS "Desktop"
 .sp
index 62f4b277db4a747761f599b72d8011d53e3fe6c4..85e511735564a7e26fd774a0cfb5d8734dafe677 100644 (file)
@@ -134,7 +134,7 @@ Select a window.
 
 ----
 WINDOW_SEL := <window_id> 
-            | (DIR|CYCLE_DIR|biggest|last|focused|older|newer)[.floating|.tiled][.like|.unlike][.manual|.automatic][.urgent][.local]
+            | (DIR|CYCLE_DIR|biggest|last|focused|older|newer)[.floating|.tiled][.like|.unlike][.manual|.automatic][.urgent][.local][.unfocused]
 ----
 
 Primary Selectors
@@ -188,6 +188,9 @@ local::
 urgent::
        Only consider urgent windows.
 
+unfocused::
+       Only consider windows other than the focused window.
+
 Desktop
 ~~~~~~~
 
diff --git a/query.c b/query.c
index 6aba083f1693c04b6866b258fe0d58f95918799a..061b93f4835c9d460f7d1f5e99c710a50983f17d 100644 (file)
--- a/query.c
+++ b/query.c
@@ -141,7 +141,7 @@ void query_windows(coordinates_t loc, FILE *rsp)
 
 bool node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
 {
-       client_select_t sel = {CLIENT_TYPE_ALL, CLIENT_CLASS_ALL, CLIENT_MODE_ALL, false, false};
+       client_select_t sel = {CLIENT_TYPE_ALL, CLIENT_CLASS_ALL, CLIENT_MODE_ALL, false, false, false};
        char *tok;
        while ((tok = strrchr(desc, CAT_CHR)) != NULL) {
                tok[0] = '\0';
@@ -162,6 +162,8 @@ bool node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
                        sel.urgent = true;
                } else if (streq("local", tok)) {
                        sel.local = true;
+               } else if (streq("unfocused", tok)) {
+                       sel.unfocused = true;
                }
        }
 
@@ -404,6 +406,9 @@ bool node_matches(coordinates_t *loc, coordinates_t *ref, client_select_t sel)
        if (sel.urgent && !loc->node->client->urgent)
                return false;
 
+       if (sel.unfocused && loc->node == mon->desk->focus)
+               return false;
+
        return true;
 }
 
diff --git a/types.h b/types.h
index fb7494aa6aeab8fea8f7f7ab0e04b6dfb76eade3..9782ede332971287b510e766cb1cbe571e348929 100644 (file)
--- a/types.h
+++ b/types.h
@@ -68,6 +68,7 @@ typedef struct {
        client_mode_t mode;
        bool urgent;
        bool local;
+       bool unfocused;
 } client_select_t;
 
 typedef enum {