2022-10-23 16:39:10 +02:00
# Table of contents
2022-09-24 15:32:40 +02:00
{{< toc > }}
2022-10-23 16:39:10 +02:00
# Window Rules V1
2023-03-27 12:22:35 +02:00
You can set window rules to achieve different behaviors from the active container.
2022-09-24 15:32:40 +02:00
2022-10-23 16:39:10 +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-11-22 22:25:34 +01:00
- `RULE` is a [rule ](#rules ) (and a param if applicable)
2023-04-01 20:36:56 +02:00
- `WINDOW` is a [RegEx ](https://en.wikipedia.org/wiki/Regular_expression ), either:
2022-10-23 16:39:10 +02:00
- 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-23 16:39:10 +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-23 16:39:10 +02:00
# Window Rules V2
2022-09-24 15:32:40 +02:00
2022-10-23 16:39:10 +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-23 16:39:10 +02:00
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
2023-06-24 09:41:53 +02:00
windowrulev2 = float,class:(kitty),title:(kitty)
2022-09-24 15:32:40 +02:00
```
2023-06-24 09:41:53 +02:00
{{< hint type = tip > }}
In the case of dynamic window titles such as browser windows keep in mind how powerful regex is.
2023-08-02 13:23:11 +02:00
for example a window rule of: `windowrule=opacity 0.3 override 0.3 override,title:(.*)(- Youtube)$` will match
*any* window that contains a string of "- Youtube" after any other text. This could be multiple browser windows
2023-06-24 09:41:53 +02:00
or other applications that contain the string for any reason.
for the `windowrulev2 = float,class:(kitty),title:(kitty)` example, the `class:(kitty)` `WINDOW` field is what keeps the window rule
specific to kitty terminals.
{{< / hint > }}
2022-09-24 15:32:40 +02:00
For now, the supported fields are:
2022-10-23 16:39:10 +02:00
2022-09-24 16:03:37 +02:00
```ini
2023-06-24 09:41:53 +02:00
class - class regex
2022-09-24 15:32:40 +02:00
title - title regex
xwayland - 0/1
floating - 0/1
2022-11-15 11:22:26 +01:00
fullscreen - 0/1
pinned - 0/1
2023-08-02 13:23:11 +02:00
workspace - id or name: and name
2022-09-24 15:32:40 +02:00
```
2022-10-23 16:39:10 +02:00
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
2022-11-15 11:22:26 +01:00
| Rule | Description | Dynamic |
| ---- | ----------- | ----------- |
| float | floats a window | |
| tile | tiles a window | |
| fullscreen | fullscreens a window | |
2023-04-14 00:08:01 +02:00
| fakefullscreen | fakefullscreens a window | |
2022-12-23 20:34:57 +01:00
| maximize | maximizes a window | |
2022-11-26 21:44:58 +01:00
| nofullscreenrequest | prevents windows from requesting fullscreen mode, you can still manually toggle fullscreen. | |
2023-07-23 19:47:57 +02:00
| nomaximizerequest | prevents windows from requesting maximized mode, you can still manually toggle maximize. | |
2023-09-12 10:56:23 +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` ). 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. Specify `onscreen` before other parameters to force the window into the screen (e.g. `move onscreen cursor 50% 50%` ) | |
2022-11-15 11:22:26 +01:00
| 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) | |
2023-08-11 16:53:58 +02:00
| center (\[opt\]) | if the window is floating, will center it on the monitor. Set opt as 1 to respect monitor reserved area | |
2022-11-15 11:22:26 +01:00
| pseudo | pseudotiles a window | |
2023-03-18 02:34:58 +01:00
| monitor \[id\] | sets the monitor on which a window should open. `id` can be either id or name (either e.g. `1` or e.g. `DP-1` ) | |
2022-11-15 11:22:26 +01:00
| 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-12-11 18:18:04 +01:00
| opacity \[a\] | additional opacity multiplier. Options for a: `float` -> sets an opacity OR `float float` -> sets activeopacity and inactiveopacity respectively. You can also add `override` after an opacity to make it override instead of a multiplier. (e.g. `1.0 override 0.5 override` ) |✓ |
2022-11-15 11:22:26 +01:00
| opaque | forces the window to be opaque (can be toggled with the toggleopaque dispatcher) |✓ |
2023-03-26 03:02:05 +02:00
| forcergbx | makes hyprland ignore the alpha channel of all the window's surfaces, effectively making it _actually, fully 100% opaque_ | ✓ |
2022-11-15 11:22:26 +01:00
| 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 | |
2023-04-28 16:36:35 +02:00
| noinitialfocus | disables the initial focus to the window | |
2022-11-15 11:22:26 +01:00
| noborder | disables borders for the window |✓ |
2023-07-18 00:13:16 +02:00
| bordersize \[size\] | sets the border size |✓ |
2023-05-31 21:14:33 +02:00
| nodim | disables window dimming for the window |✓ |
2022-11-15 11:22:26 +01:00
| 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 | |
2023-08-30 18:22:04 +02:00
| pin | pins the window (i.e. show it on all workspaces) *note: floating only* | |
2022-11-15 11:22:26 +01:00
| noanim | disables the animations for the window |✓ |
2023-08-08 18:53:03 +02:00
| keepaspectratio | forces aspect ratio when resizing window with the mouse |✓ |
2022-11-15 11:22:26 +01:00
| 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. | |
2022-12-07 17:09:50 +01:00
| nomaxsize | removes max size limitations. Especially useful with windows that report invalid max sizes (e.g. winecfg) | |
2023-01-16 16:07:05 +01:00
| dimaround | dims everything around the window . Please note this rule is meant for floating windows and using it on tiled ones may result in strange behavior. | ✓ |
2023-07-04 12:06:00 +02:00
| stayfocused | forces focus on the window as long as it's visible | |
2023-08-09 22:05:00 +02:00
| xray \[on\] | sets blur xray mode for the window (0 for off, 1 for on, unset for default) | ✓ |
2022-09-24 15:32:40 +02:00
2022-10-23 16:39:10 +02:00
### Example Rules
2022-09-24 16:03:37 +02:00
```ini
2022-11-10 18:01:52 +01:00
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
2022-11-15 11:22:26 +01:00
windowrulev2 = bordercolor rgb(FF0000) rgb(880808),fullscreen:1 # set bordercolor to red if window is fullscreen
2022-12-11 18:18:04 +01:00
windowrulev2 = bordercolor rgb(FFFF00),title:^(.*Hyprland.*)$ # set bordercolor to yellow when title contains Hyprland
windowrule = opacity 1.0 override 0.5 override,^(kitty)$ # set opacity to 1.0 active and 0.5 inactive for kitty
windowrule = rounding 10,^(kitty)$ # set rounding to 10 for kitty
2022-09-24 15:32:40 +02:00
```
2022-10-23 16:39:10 +02:00
### Notes
2023-09-09 16:34:21 +02:00
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.
2022-11-15 11:22:26 +01:00
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.
2022-09-24 15:32:40 +02:00
{{< hint type = tip > }}
2022-10-23 16:39:10 +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-23 16:39:10 +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 > }}
2023-01-25 16:36:45 +01:00
# Layer Rules
Some things in wayland are not windows, but layers. That includes for example most launchers, your status bar or wallpaper.
Those have specific rules separate from windows:
```ini
layerrule = rule, namespace
2023-03-18 00:35:17 +01:00
# or
layerrule = rule, address
2023-01-25 16:36:45 +01:00
```
where `rule` is the rule and `namespace` is the namespace regex (find namespaces in `hyprctl layers` )
2023-03-18 00:35:17 +01:00
or `address` is an address in the form of `address:0x[hex]`
2023-01-25 16:36:45 +01:00
## Rules
| rule | description |
| --- | --- |
2023-03-18 00:30:01 +01:00
| unset | removes all layerRules previously set for a select namespace regex. Please note it has to match _exactly_ |
2023-01-25 16:36:45 +01:00
| noanim | disables animations |
2023-03-18 00:16:59 +01:00
| blur | enables blur for the layer |
2023-06-11 19:31:04 +02:00
| ignorealpha \[a\] | makes blur ignore pixels with opacity of `a` or lower. `a` is float value from 0 to 1. `a = 0` if unspecified. |
| ignorezero | makes blur ignore fully transparent pixels. Same as `ignorealpha 0` . |
2023-08-09 22:05:00 +02:00
| xray \[on\] | sets the blur xray mode for a layer. 0 for off, 1 for on, unset for default. |