]> git.lizzy.rs Git - bspwm.git/commitdiff
Add a special raw name selector
authorBastien Dejean <nihilhill@gmail.com>
Fri, 8 Sep 2017 19:23:53 +0000 (21:23 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Fri, 8 Sep 2017 19:23:53 +0000 (21:23 +0200)
Fixes #704.

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

index cb9b0722be77415c258634eb3a34b97431860b29..aca0334b398288aad0e058c9dfdfa631cb7e04ca 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: 08/22/2017
+.\"      Date: 09/08/2017
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.3-22-g7091d65
+.\"    Source: Bspwm 0.9.3-26-g412da35
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "08/22/2017" "Bspwm 0\&.9\&.3\-22\-g7091d65" "Bspwm Manual"
+.TH "BSPWM" "1" "09/08/2017" "Bspwm 0\&.9\&.3\-26\-g412da35" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -90,6 +90,8 @@ The relative targets are computed in relation to the given reference (the defaul
 An exclamation mark can be prepended to any modifier in order to reverse its meaning\&.
 .sp
 The following characters cannot be used in monitor or desktop names: \fB#\fR, \fB:\fR, \fB\&.\fR\&.
+.sp
+The special selector \fB%<name>\fR can be used to select a monitor or a desktop with an invalid name\&.
 .SS "Node"
 .sp
 Select a node\&.
@@ -98,7 +100,11 @@ 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][\&.[!]active][\&.[!]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
 
@@ -291,7 +297,9 @@ Select a desktop\&.
 .RS 4
 .\}
 .nf
-DESKTOP_SEL := [DESKTOP_SEL#](CYCLE_DIR|last|older|newer|[MONITOR_SEL:](focused|^<n>)|<desktop_id>|<desktop_name>)[\&.[!]occupied][\&.[!]focused][\&.[!]urgent][\&.[!]local]
+DESKTOP_SEL := [DESKTOP_SEL#](CYCLE_DIR|last|older|newer|
+                              [MONITOR_SEL:](focused|^<n>)|
+                              <desktop_id>|<desktop_name>)[\&.[!]occupied][\&.[!]focused][\&.[!]urgent][\&.[!]local]
 .fi
 .if n \{\
 .RE
@@ -384,7 +392,9 @@ Select a monitor\&.
 .RS 4
 .\}
 .nf
-MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|older|newer|focused|pointed|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
index 10cb37e6fd955d979ad3b311a075ea117376ea46..abd84c77d5bf8784b1992f99618c4d392d05e68b 100644 (file)
@@ -66,13 +66,19 @@ meaning.
 
 The following characters cannot be used in monitor or desktop names: *#*, *:*, *.*.
 
+The special selector *%<name>* can be used to select a monitor or a desktop with an invalid name.
+
 Node
 ~~~~
 
 Select a node.
 
 ----
-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]
+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
 
@@ -183,7 +189,9 @@ Desktop
 Select a desktop.
 
 ----
-DESKTOP_SEL := [DESKTOP_SEL#](CYCLE_DIR|last|older|newer|[MONITOR_SEL:](focused|^<n>)|<desktop_id>|<desktop_name>)[.[!]occupied][.[!]focused][.[!]urgent][.[!]local]
+DESKTOP_SEL := [DESKTOP_SEL#](CYCLE_DIR|last|older|newer|
+                              [MONITOR_SEL:](focused|^<n>)|
+                              <desktop_id>|<desktop_name>)[.[!]occupied][.[!]focused][.[!]urgent][.[!]local]
 ----
 
 Descriptors
@@ -234,7 +242,9 @@ Monitor
 Select a monitor.
 
 ----
-MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|older|newer|focused|pointed|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
index 83c6cb5dc04951195bc5482e3cc0c53c5cb9d431..30ee021fb3d43d1bb8c8068ac86a61360be2e79e 100644 (file)
@@ -571,6 +571,11 @@ int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
 
 int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
 {
+       if (*desc == '%') {
+               locate_desktop(desc + 1, dst);
+               goto end;
+       }
+
        coordinates_t ref_copy = *ref;
        ref = &ref_copy;
        char *desc_copy = copy_string(desc, strlen(desc));
@@ -670,6 +675,7 @@ int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
 
        free(desc_copy);
 
+end:
        if (dst->desktop == NULL) {
                return SELECTOR_INVALID;
        }
@@ -679,6 +685,11 @@ int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
 
 int monitor_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
 {
+       if (*desc == '%') {
+               locate_monitor(desc + 1, dst);
+               goto end;
+       }
+
        coordinates_t ref_copy = *ref;
        ref = &ref_copy;
        char *desc_copy = copy_string(desc, strlen(desc));
@@ -771,6 +782,7 @@ int monitor_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
 
        free(desc_copy);
 
+end:
        if (dst->monitor == NULL) {
                return SELECTOR_INVALID;
        }