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

106 lines
3.9 KiB
Markdown
Raw Normal View History

# Table of contents
2022-09-24 15:32:40 +02:00
{{< toc >}}
# Window Rules V1
You can set window rules to achieve different behaviours from the active container.
2022-09-24 15:32:40 +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
```
- `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
### 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)(.*)$
```
# Window Rules V2
2022-09-24 15:32:40 +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.
the `RULE` field is unchanged, but in the `WINDOW` field, you can put regexes
for multiple values like so:
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-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
```
Keep in mind that you _have_ to declare at least one field, but not all.
{{< hint type=tip >}}
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 |
2022-10-26 13:36:25 +02:00
| 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`) |
2022-09-24 15:32:40 +02:00
| size \[x\] \[y\] | resizes a floating window (x,y -> int or %, e.g. 20% or 100) |
2022-10-06 10:11:13 +02:00
| minsize \[x\] \[y\] | sets the minimum size on creation (x,y -> int) |
2022-10-15 20:41:37 +02:00
| maxsize \[x\] \[y\] | sets the maximum size on creation (x,y -> int) |
2022-09-24 15:32:40 +02:00
| 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. |
2022-09-24 15:32:40 +02:00
| 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 |
2022-10-20 21:35:58 +02:00
| noborder | disables borders for the window |
| noshadow | disables shadows for the window |
2022-09-24 15:32:40 +02:00
| 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) |
2022-10-20 23:45:43 +02:00
| windowdance | forces an XWayland window to never refocus, used for games/applications like Rhythm Doctor |
2022-09-24 15:32:40 +02:00
| pin | pins the window *note: floating only* |
2022-10-06 10:17:03 +02:00
| noanim | disables the animations for the window |
2022-10-31 13:28:04 +01:00
| idleinhibit \[mode\] | sets an idle inhibit rule for the window. If active, apps like `swayidle` will not fire. Modes: `none`, `always`, `focus`, `fullscreen` |
2022-09-24 15:32:40 +02:00
### Example Rules
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)$
```
### Notes
2022-09-24 15:32:40 +02:00
{{< hint type=tip >}}
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
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 >}}