hyprland-wiki/pages/Configuring/Window-Rules.md

105 lines
3.6 KiB
Markdown
Raw Normal View History

2022-10-20 18:22:43 +02:00
# Table of contents
2022-10-19 15:22:42 +02:00
2022-09-24 15:32:40 +02:00
{{< toc >}}
2022-10-20 22:54:34 +02:00
# Window Rules V1
2022-09-24 15:32:40 +02:00
You can set window rules to achieve different behaviours from the active container.
2022-10-20 22:54:34 +02:00
## Syntax
2022-09-24 15:32:40 +02:00
2022-09-24 16:03:37 +02:00
```ini
2022-09-24 15:32:40 +02:00
windowrule=RULE,WINDOW
```
2022-10-19 18:14:08 +02:00
- `RULE` is a rule (and a param if applicable)
- `WINDOW` is a RegEx, either:
- plain RegEx (for matching a window class);
- `title:` followed by a regex (for matching a window's title)
2022-09-24 15:32:40 +02:00
2022-10-20 22:54:34 +02:00
### Examples
2022-09-24 15:32:40 +02:00
2022-09-24 16:03:37 +02:00
```ini
2022-09-24 15:32:40 +02:00
windowrule=float,^(kitty)$
windowrule=move 0 0,title:^(Firefox)(.*)$
```
2022-10-20 22:54:34 +02:00
# Window Rules V2
2022-09-24 15:32:40 +02:00
2022-10-19 15:22:42 +02:00
In order to allow more flexible rules, while retaining compatibility with the above
rule system, window rules V2 were implemented.
2022-09-24 15:32:40 +02:00
In V2, you are allowed to match multiple variables.
2022-10-19 18:14:08 +02:00
the `RULE` field is unchanged, but in the `WINDOW` field, you can put regexes
for multiple values like so:
2022-10-19 15:22:42 +02:00
2022-09-24 16:03:37 +02:00
```ini
2022-09-24 15:32:40 +02:00
windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
```
For now, the supported fields are:
2022-10-19 15:22:42 +02:00
2022-09-24 16:03:37 +02:00
```ini
2022-09-24 15:32:40 +02:00
class - class regex
title - title regex
xwayland - 0/1
floating - 0/1
```
2022-10-19 18:14:08 +02:00
Keep in mind that you _have_ to declare at least one field, but not all.
{{< hint type=tip >}}
2022-10-19 18:14:08 +02:00
To get more information about a window's class, title, XWayland status or its size;
you can use `hyprctl clients`.
{{< /hint >}}
2022-09-24 15:32:40 +02:00
## 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) |
| 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) |
| pin | pins the window *note: floating only* |
| noanim | disables the animations for the window |
2022-10-19 15:22:42 +02:00
2022-10-19 18:14:08 +02:00
### Example Rules
2022-10-19 15:22:42 +02:00
2022-09-24 16:03:37 +02:00
```ini
2022-09-24 15:32:40 +02:00
windowrule = move 100 100,^(kitty)$
windowrule = animation popin,^(kitty)$
windowrule = noblur,^(firefox)$
```
2022-10-20 22:54:34 +02:00
### Notes
2022-10-19 17:38:11 +02:00
2022-09-24 15:32:40 +02:00
{{< hint type=tip >}}
2022-10-20 18:02:59 +02:00
Opacity is _always_ a PRODUCT of all opacities. E.g. `active_opacity` to
2022-09-24 15:32:40 +02:00
0.5 and windowrule opacity to 0.5 will result in a total opacity 0.25. You are
allowed to set opacities over 1, but any opacity product over 1 will cause
2022-10-20 18:02:59 +02:00
graphical glitches. E.g. `0.5 * 2 = 1`, and it will be fine, `0.5 * 4` will cause
2022-09-24 15:32:40 +02:00
graphical glitches.
{{< /hint >}}