dispatcher: add window tag desc (#660)

* dispatcher: add window tag desc

* Window-Rules: add examples for tag
This commit is contained in:
giskard 2024-05-29 05:38:33 +08:00 committed by GitHub
parent 9d28dea3e9
commit 2b1d78d0e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 52 additions and 4 deletions

View file

@ -50,6 +50,7 @@ layout pages (See the sidebar).
| movewindowpixel | moves a selected window | `resizeparams,window` |
| cyclenext | focuses the next window on a workspace | none (for next) or `prev` (for previous) additionally `tiled` for only tiled, `floating` for only floating. `prev tiled` is ok. |
| swapnext | swaps the focused window with the next window on a workspace | none (for next) or `prev` (for previous) |
| tagwindow | apply tag to current or the first window matching | `tag [window]`, e.g. `+code ^(foot)$`, `music` |
| focuswindow | focuses the first window matching | window |
| focusmonitor | focuses a monitor | monitor |
| splitratio | changes the split ratio | floatvalue |

View file

@ -72,6 +72,7 @@ class - class regex
title - title regex
initialclass - initialClass regex
initialTitle - initialTitle regex
tag - tag name
xwayland - 0/1
floating - 0/1
fullscreen - 0/1
@ -154,6 +155,7 @@ Dynamic rules are re-evaluated every time a property changes.
| xray \[on\] | sets blur xray mode for the window (0 for off, 1 for on, unset for default) |
| immediate | forces the window to allow to be torn. See [the Tearing page](../Tearing). |
| nearestneighbor | forces the window to use the nearest neigbor filtering. |
| tag \[name\] | apply tag to the window, use prefix `+`/`-` to set/unset flag, or no prefix to toggle the flag |
{{< callout type=info >}}
@ -181,6 +183,51 @@ qualifier makes them always effective.
{{< /callout >}}
### Tags
Window may have several tags, either static or dynamic, dynamic tag will have a suffix of `*`.
You may check window tags with `hyprctl clients`.
Use `tagwindow` dispatcher to add a static tag to a window:
```
hyprctl dispatch tagwindow +code # add tag to current window
hyprctl dispatch tagwindow -- -code # remove tag from current window (use `--` to protect the leading `-`)
hyprctl dispatch tagwindow code # toggle the tag of current window
# or you can tag windows matched with a window regex
hyprctl dispatch tagwindow +music deadbeef
hyprctl dispatch tagwindow +media title:Celluloid
```
Use `tag` rule to add a dynamic tag to a window:
```ini
windowrulev2 = tag +term, class:(footclient) # add dynamic tag `term*` to window footclient
windowrulev2 = tag term, class:(footclient) # toggle dynamic tag `term*` for window footclient
windowrulev2 = tag +code, tag:cpp # add dynamic tag `code*` to window with tag `cpp`
windowrulev2 = opacity 0.8, tag:code # set opacity for window with tag `code` or `code*`
windowrulev2 = opacity 0.7, tag:cpp # window with tag `cpp` will match both `code` and `cpp`, the last one will override prior match
windowrulev2 = opacity 0.6, tag:term* # set opacity for window with tag `term*` only, `term` will not be matched
windowrulev2 = tag -code, tag:term # remove dynamic tag `code*` for window with tag `term` or `term*`
```
Or with keybind for convenience:
```ini
bind = $mod Ctrl, 2, tagwindow, alpha_0.2
bind = $mod Ctrl, 4, tagwindow, alpha_0.4
windowrulev2 = opacity 0.2 override, tag:alpha_0.2
windowrulev2 = opacity 0.4 override, tag:alpha_0.4
```
The `tag` rule can only manipulate dynamic tags, and the `tagwindow` dispatcher only work with static tags
(as once the dispatcher is called, dynamic tags will be cleared).
### Example Rules
```ini