diff options
author | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-11-17 19:27:01 +0100 |
---|---|---|
committer | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-11-25 14:34:33 +0100 |
commit | a06cb7cd01acfbb5e31dd1aacbbde7887a0509b9 (patch) | |
tree | 1474dbed01d4c31318883a3a837e02ce30125bef /sway.5.txt | |
parent | Merge pull request #255 from christophgysin/ninja (diff) | |
download | sway-a06cb7cd01acfbb5e31dd1aacbbde7887a0509b9.tar.gz sway-a06cb7cd01acfbb5e31dd1aacbbde7887a0509b9.tar.zst sway-a06cb7cd01acfbb5e31dd1aacbbde7887a0509b9.zip |
criteria: Add. Learn for_window command.
A criteria is a string in the form of `[class="regex.*" title="str"]`.
It is stored in a struct with a list of *tokens* which is a
attribute/value pair (stored as a `crit_token` struct). Most tokens will
also have a precompiled regex stored that will be used during criteria
matching.
for_window command: When a new view is created its metadata is tested
against all stored criteria, and if a match is found the associated
command list is executed.
Unfortunately some metadata is not available in sway at the moment
(specifically `instance`, `window_role` and `urgent`). Any criteria
string that tries to match an unsupported attribute will fail.
(Note that while the criteria code can be used to parse any criteria
string it is currently only used by the `for_window` command.)
Diffstat (limited to 'sway.5.txt')
-rw-r--r-- | sway.5.txt | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -68,6 +68,10 @@ Commands | |||
68 | **fullscreen**:: | 68 | **fullscreen**:: |
69 | Toggles fullscreen status for the focused view. | 69 | Toggles fullscreen status for the focused view. |
70 | 70 | ||
71 | **for_window** <criteria> <command>:: | ||
72 | Whenever a window that matches _criteria_ appears, run list of commands. See | ||
73 | **Criteria** section below. | ||
74 | |||
71 | **gaps** edge_gaps <on|off|toggle>:: | 75 | **gaps** edge_gaps <on|off|toggle>:: |
72 | Whether or not to add gaps between views and workspace edges if amount of | 76 | Whether or not to add gaps between views and workspace edges if amount of |
73 | inner gap is not zero. When _no_, no gap is added where the view is aligned to | 77 | inner gap is not zero. When _no_, no gap is added where the view is aligned to |
@@ -175,3 +179,34 @@ Commands | |||
175 | **workspace** <name> output <output>:: | 179 | **workspace** <name> output <output>:: |
176 | Specifies that the workspace named _name_ should appear on the specified | 180 | Specifies that the workspace named _name_ should appear on the specified |
177 | _output_. | 181 | _output_. |
182 | |||
183 | Criteria | ||
184 | -------- | ||
185 | |||
186 | A criteria is a string in the form of e.g.: | ||
187 | |||
188 | [class="[Rr]egex.*" title="some title"] | ||
189 | |||
190 | The string contains one or more (space separated) attribute/value pairs and they | ||
191 | are used by some commands filter which views to execute actions on. All attributes | ||
192 | must match for the criteria string to match. | ||
193 | |||
194 | Currently supported attributes: | ||
195 | |||
196 | **class**:: | ||
197 | Compare value against the window class. Can be a regular expression. If value | ||
198 | is _focused_ then the window class must be the same as that of the currently | ||
199 | focused window. | ||
200 | |||
201 | **id**:: | ||
202 | Compare value against the app id. Can be a regular expression. | ||
203 | |||
204 | **title**:: | ||
205 | Compare against the window title. Can be a regular expression. If value is | ||
206 | _focused_ then the window title must be the same as that of the currently | ||
207 | focused window. | ||
208 | |||
209 | **workspace**:: | ||
210 | Compare against the workspace name for this view. Can be a regular expression. | ||
211 | If value is _focused_ then all the views on the currently focused workspace | ||
212 | matches. | ||