Describe dynamic rules (#52)

Co-authored-by: Jef Steelant <jef.steelant_ext@softathome.com>
This commit is contained in:
Jef 2022-11-15 11:22:26 +01:00 committed by GitHub
parent 9f138f7426
commit 9d3a3f4fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 54 additions and 28 deletions

View File

@ -45,6 +45,8 @@ class - class regex
title - title regex
xwayland - 0/1
floating - 0/1
fullscreen - 0/1
pinned - 0/1
```
Keep in mind that you _have_ to declare at least one field, but not all.
@ -58,34 +60,34 @@ you can use `hyprctl clients`.
## Rules
| Rule | Description |
| ---- | ----------- |
| float | floats a window |
| tile | tiles a window |
| fullscreen | fullscreens a window |
| move \[x\] \[y\] | moves a floating window (x,y -> int or %, e.g. 20% or 100. You are also allowed to do `100%-` for the right/bottom anchor, e.g. `100%-20`) Additionally, you can also do `cursor [x] [y]` where x and y are either pixels or percent. Percent is calculated from the window's size. |
| size \[x\] \[y\] | resizes a floating window (x,y -> int or %, e.g. 20% or 100) |
| minsize \[x\] \[y\] | sets the minimum size on creation (x,y -> int) |
| maxsize \[x\] \[y\] | sets the maximum size on creation (x,y -> int) |
| center | if the window is floating, will center it on the monitor |
| pseudo | pseudotiles a window |
| monitor \[id\] | sets the monitor on which a window should open |
| workspace \[w\] | sets the workspace on which a window should open (for workspace syntax, see [dispatchers->workspaces](../Dispatchers#workspaces)). You can also make \[w\] to `unset`, will unset all previous workspace rules applied to this window. You can also add `silent` after the workspace to make the window open silently. |
| opacity \[a\] | additional opacity multiplier. Options for a: `float` -> sets an opacity OR `float float` -> sets activeopacity and inactiveopacity respectively |
| opaque | forces the window to be opaque (can be toggled with the toggleopaque dispatcher) |
| animation \[style\] (\[opt\]) | forces an animation onto a window, with a selected opt. Opt is optional. |
| rounding \[x\] | forces the application to have X pixels of rounding, ignoring the set default (in `decoration:rounding`). Has to be an int. |
| noblur | disables blur for the window |
| nofocus | disables focus to the window |
| noborder | disables borders for the window |
| noshadow | disables shadows for the window |
| forceinput | forces an XWayland window to receive input, even if it requests not to do so. (Might fix issues like e.g. Game Launchers not receiving focus for some reason) |
| windowdance | forces an XWayland window to never refocus, used for games/applications like Rhythm Doctor |
| pin | pins the window *note: floating only* |
| noanim | disables the animations for the window |
| bordercolor \[c\] | force the bordercolor of the window. Options for c: `color` -> sets the active border color OR `color color` -> sets the active and inactive border color of the window. See [variables->colors](../Variables#variable_types) for color definition.
| idleinhibit \[mode\] | sets an idle inhibit rule for the window. If active, apps like `swayidle` will not fire. Modes: `none`, `always`, `focus`, `fullscreen` |
| unset | removes all previously set rules for the given parameters. Please note it has to match EXACTLY. |
| Rule | Description | Dynamic |
| ---- | ----------- | ----------- |
| float | floats a window | |
| tile | tiles a window | |
| fullscreen | fullscreens a window | |
| move \[x\] \[y\] | moves a floating window (x,y -> int or %, e.g. 20% or 100. You are also allowed to do `100%-` for the right/bottom anchor, e.g. `100%-20`) Additionally, you can also do `cursor [x] [y]` where x and y are either pixels or percent. Percent is calculated from the window's size. | |
| size \[x\] \[y\] | resizes a floating window (x,y -> int or %, e.g. 20% or 100) | |
| minsize \[x\] \[y\] | sets the minimum size on creation (x,y -> int) | |
| maxsize \[x\] \[y\] | sets the maximum size on creation (x,y -> int) | |
| center | if the window is floating, will center it on the monitor | |
| pseudo | pseudotiles a window | |
| monitor \[id\] | sets the monitor on which a window should open | |
| workspace \[w\] | sets the workspace on which a window should open (for workspace syntax, see [dispatchers->workspaces](../Dispatchers#workspaces)). You can also make \[w\] to `unset`, will unset all previous workspace rules applied to this window. You can also add `silent` after the workspace to make the window open silently. | |
| opacity \[a\] | additional opacity multiplier. Options for a: `float` -> sets an opacity OR `float float` -> sets activeopacity and inactiveopacity respectively |&check;|
| opaque | forces the window to be opaque (can be toggled with the toggleopaque dispatcher) |&check;|
| animation \[style\] (\[opt\]) | forces an animation onto a window, with a selected opt. Opt is optional. |&check;|
| rounding \[x\] | forces the application to have X pixels of rounding, ignoring the set default (in `decoration:rounding`). Has to be an int. |&check;|
| noblur | disables blur for the window |&check;|
| nofocus | disables focus to the window | |
| noborder | disables borders for the window |&check;|
| noshadow | disables shadows for the window |&check;|
| forceinput | forces an XWayland window to receive input, even if it requests not to do so. (Might fix issues like e.g. Game Launchers not receiving focus for some reason) | |
| windowdance | forces an XWayland window to never refocus, used for games/applications like Rhythm Doctor | |
| pin | pins the window *note: floating only* | |
| noanim | disables the animations for the window |&check;|
| bordercolor \[c\] | force the bordercolor of the window. Options for c: `color` -> sets the active border color OR `color color` -> sets the active and inactive border color of the window. See [variables->colors](../Variables#variable_types) for color definition. |&check;|
| idleinhibit \[mode\] | sets an idle inhibit rule for the window. If active, apps like `swayidle` will not fire. Modes: `none`, `always`, `focus`, `fullscreen` | |
| unset | removes all previously set rules for the given parameters. Please note it has to match EXACTLY. | |
### Example Rules
@ -94,10 +96,34 @@ windowrule = move 100 100,^(kitty)$ # moves kitty to 100 100
windowrule = animation popin,^(kitty)$ # sets the animation style for kitty
windowrule = noblur,^(firefox)$ # disables blur for firefox
windowrule = move cursor -50% -50%,^(kitty)$ # moves kitty to the center of the cursor
windowrulev2 = bordercolor rgb(FF0000) rgb(880808),fullscreen:1 # set bordercolor to red if window is fullscreen
windowrulev2 = bordercolor rgb(FFFF00),title:^(.*Hyprland.*)$ #set bordercolor to yellow when title contains Hyprland
```
### Notes
Rules that are marked as _Dynamic_ will be reevaluated if the matching property of the window changes. For instance, if a rule is defined that changes the bordercolor of a window when it is floating, then the bordercolor will change to the requested color when it is set to floating, and revert to the default color when it is tiled again. Dynamic matching properties are _title_, _floating_, _fullscreen_ and _pinned_.
Rules will be processed from top to bottom, where the _last_ match will take precedence.
i.e.
```ini
windowrulev2 = opacity 0.8 0.8,class:^(kitty)$
windowrulev2 = opacity 0.5 0.5,floating:1
```
-> all kitty windows will have opacity 0.8, except if they are floating. Then they will have opacity 0.5.
-> all floating windows will have opacity 0.5.
```ini
windowrulev2 = opacity 0.5 0.5,floating:1
windowrulev2 = opacity 0.8 0.8,class:^(kitty)$
```
-> all kitty windows will have opacity 0.8, also if they are floating.
-> all other floating windows will have opacity 0.5.
{{< hint type=tip >}}
Opacity is _always_ a PRODUCT of all opacities. E.g. `active_opacity` to