windowrules: fix for rewrite (#1278)

ref https://github.com/hyprwm/Hyprland/pull/12269
This commit is contained in:
Vaxry 2025-11-17 18:34:22 +00:00 committed by GitHub
parent ca366ab182
commit f45d5c2e63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 196 additions and 209 deletions

View file

@ -200,33 +200,17 @@ bind = SUPER, E, exec, [workspace 2 silent; float; move 0 0] kitty
### setprop ### setprop
Prop List: Props are any of the _dynamic effects_ of [Window Rules](../Window-Rules#dynamic-effects).
| prop | comment |
| --- | --- |
| alpha | float 0.0 - 1.0 |
| alphaoverride | 0/1, makes the next setting be override instead of multiply |
| alphainactive | float 0.0 - 1.0 |
| alphainactiveoverride | 0/1, makes the next setting be override instead of multiply |
| alphafullscreen | float 0.0 - 1.0 |
| alphafullscreenoverride | 0/1, makes the next setting be override instead of multiply |
| animationstyle | string, cannot be locked |
| activebordercolor | gradient, -1 means not set |
| inactivebordercolor | gradient, -1 means not set |
| maxsize | vec2 (`x y`) |
| minsize | vec2 (`x y`) |
Additional properties can be found in the [Window Rules](../Window-Rules#dynamic-rules) section.
For example: For example:
```sh ```sh
address:0x13371337 noanim 1 address:0x13371337 no_anim 1
address:0x13371337 nomaxsize 0 address:0x13371337 no_max_size 0
address:0x13371337 opaque toggle address:0x13371337 opaque toggle
address:0x13371337 immediate unset address:0x13371337 immediate unset
address:0x13371337 bordersize relative -2 address:0x13371337 border_size relative -2
address:0x13371337 roundingpower relative 0.1 address:0x13371337 rounding_power relative 0.1
``` ```
### Fullscreenstate ### Fullscreenstate

View file

@ -422,7 +422,7 @@ _Subcategory `misc:`_
| exit_window_retains_fullscreen | if true, closing a fullscreen window makes the next focused window fullscreen | bool | false | | exit_window_retains_fullscreen | if true, closing a fullscreen window makes the next focused window fullscreen | bool | false |
| initial_workspace_tracking | if enabled, windows will open on the workspace they were invoked on. 0 - disabled, 1 - single-shot, 2 - persistent (all children too) | int | 1 | | initial_workspace_tracking | if enabled, windows will open on the workspace they were invoked on. 0 - disabled, 1 - single-shot, 2 - persistent (all children too) | int | 1 |
| middle_click_paste | whether to enable middle-click-paste (aka primary selection) | bool | true | | middle_click_paste | whether to enable middle-click-paste (aka primary selection) | bool | true |
| render_unfocused_fps | the maximum limit for renderunfocused windows' fps in the background (see also [Window-Rules](../Window-Rules/#dynamic-rules) - `renderunfocused`)| int | 15 | | render_unfocused_fps | the maximum limit for renderunfocused windows' fps in the background (see also [Window-Rules](../Window-Rules/#dynamic-effects) - `render_unfocused`)| int | 15 |
| disable_xdg_env_checks | disable the warning if XDG environment is externally managed | bool | false | | disable_xdg_env_checks | disable the warning if XDG environment is externally managed | bool | false |
| disable_hyprland_qtutils_check | disable the warning if hyprland-qtutils is not installed | bool | false | | disable_hyprland_qtutils_check | disable the warning if hyprland-qtutils is not installed | bool | false |
| lockdead_screen_delay | delay after which the "lockdead" screen will appear in case a lockscreen app fails to cover all the outputs (5 seconds max) | int | 1000 | | lockdead_screen_delay | delay after which the "lockdead" screen will appear in case a lockscreen app fails to cover all the outputs (5 seconds max) | int | 1000 |

View file

@ -3,17 +3,6 @@ weight: 7
title: Window Rules title: Window Rules
--- ---
> [!WARNING]
> Window rules are **case sensitive**. (e.g. `firefox`
> `Firefox`)
>
> As of Hyprland v0.46.0, RegExes need to fully match the window values. For
> example, in the case of `kitty`:
>
> - `kitty`/`(kitty)`/`^(kitty)$`: Matches.
> - `tty`: Used to match, now won't. Use `.*tty.*` to make it act like before, or
> consider using a more specific RegEx.
> [!WARNING] > [!WARNING]
> Rules are evaluated top to bottom, so the order they're written in does matter! > Rules are evaluated top to bottom, so the order they're written in does matter!
> More info in [Notes](#notes) > More info in [Notes](#notes)
@ -25,61 +14,54 @@ on their properties.
### Syntax ### Syntax
Basic named rule syntax:
```ini ```ini
windowrule=RULE,PARAMETERS windowrule {
name = apply-something
match:class = my-window
border_size = 10
}
``` ```
- `RULE` is a [rule](#rules) (and a param if applicable) Basic anonymous rule syntax:
- `PARAMETERS` is a comma-separated list of various window attributes you can match by. See the fields further down.
Example rule:
```ini ```ini
windowrule = float, class:kitty, title:kitty windowrule = match:class my-window, border_size 10
``` ```
Several rules can be specified in a single line, separated by commas. But have to be followed by at least one parameter. Rules are split into two categories of parameters: _props_ and _effects_. Props
are the `match:` parts, which are used to determine if a window should get the
rule. Effects are what is applied.
Example: _All_ props must match for a rule to be applied.
```ini
windowrule = float, pin, size 400 400, move 0 0, class:kitty, initialTitle:kitty
```
Where float pin size and move are `RULES` and class and initialTitle are `PARAMETERS`.
> [!NOTE] You can have as many props and effects per rule as you please, in any order as you please, as long as:
> In the case of dynamic window titles such as browser windows, keep in mind how - there is only one of one type (e.g. specifying `match:class` twice is invalid)
> powerful RegEx is. - there is at least one _prop_
>
> 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 or other applications that contain the string
> for any reason.
>
> For the `windowrule = float,class:kitty,title:kitty` example, the
> `class:(kitty)` `WINDOW` field is what keeps the window rule specific to kitty
> terminals.
The supported fields for parameters are: ### Props
| Field | Description | The supported fields for props are:
| Field | Argument | Description |
| -------------- | --------------- | | -------------- | --------------- |
| class:\[RegEx\] | Windows with `class` matching `RegEx`. | | match:class | \[RegEx\] | Windows with `class` matching `RegEx`. |
| title:\[RegEx\] | Windows with `title` matching `RegEx`. | | match:title | \[RegEx\] | Windows with `title` matching `RegEx`. |
| initialClass:\[RegEx\] | Windows with `initialClass` matching `RegEx`. | | match:initial_class | \[RegEx\] | Windows with `initialClass` matching `RegEx`. |
| initialTitle:\[RegEx\] | Windows with `initialTitle` matching `RegEx`. | | match:initial_title |\[RegEx\] | Windows with `initialTitle` matching `RegEx`. |
| tag:\[name\] | Windows with matching `tag`. | | match:tag | \[name\] | Windows with matching `tag`. |
| xwayland:\[0/1\] | Xwayland windows. | | match:xwayland | \[bool\] | Xwayland windows. |
| floating:\[0/1\] | Floating windows. | | match:float | \[bool\] | Floating windows. |
| fullscreen:\[0/1\] | Fullscreen windows. | | match:fullscreen | \[bool\] | Fullscreen windows. |
| pinned:\[0/1\] | Pinned windows. | | match:pin | \[bool\] | Pinned windows. |
| focus:\[0/1\] | Currently focused window. | | match:focus | \[bool\] | Currently focused window. |
| group:\[0/1\] | Grouped windows. | | match:group | \[bool\] | Grouped windows. |
| modal:\[0/1\] | Modal windows (e.g. "Are you sure" popups) | | match:modal | \[bool\] | Modal windows (e.g. "Are you sure" popups) |
| fullscreenstate:\[internal\] \[client\] | Windows with matching `fullscreenstate`. `internal` and `client` can be `*` - any, `0` - none, `1` - maximize, `2` - fullscreen, `3` - maximize and fullscreen. | | match:fullscreen_state_client | \[client\] | Windows with matching `fullscreenstate`. `client` can be `0` - none, `1` - maximize, `2` - fullscreen, `3` - maximize and fullscreen. |
| workspace:\[w\] | Windows on matching workspace. `w` can be `id` or `name:string`. | | match:fullscreen_state_internal | \[internal\] | Windows with matching `fullscreenstate`. `internal` can be `0` - none, `1` - maximize, `2` - fullscreen, `3` - maximize and fullscreen. |
| onworkspace:\[w\] | Windows on matching workspace. `w` can be `id`, `name:string` or `workspace selector`. | | match:workspace | \[workspace\] | Windows on matching workspace. `w` can be `id`, `name:string` or `workspace selector`. |
| content:\[none\|photo\|video\|game\] | Windows with specified content type | | match:content | \[int\] | Windows with specified content type (none = 0, photo = 1, video = 2, game = 3) |
| xdgTag:\[string\] | Match a window by its xdgTag (see `hyprctl clients` to check if it has one) | | match:xdg_tag | \[RegEx\] | Match a window by its xdgTag (see `hyprctl clients` to check if it has one) |
Keep in mind that you _have_ to declare at least one field, but not all. Keep in mind that you _have_ to declare at least one field, but not all.
@ -90,105 +72,107 @@ Keep in mind that you _have_ to declare at least one field, but not all.
> [!NOTE] > [!NOTE]
> In the output of the `hyprctl clients` command: > In the output of the `hyprctl clients` command:
> `fullscreen` refers to `fullscreenstate.internal` and > `fullscreen` refers to `fullscreen_state_internal` and
> `fullscreenClient` refers to `fullscreenstate.client` > `fullscreenClient` refers to `fullscreen_state_client`
### RegEx writing ### RegEx writing
Please note Hyprland uses [Google's RE2](https://github.com/google/re2) for parsing RegEx. This means that all operations requiring polynomial Please note Hyprland uses [Google's RE2](https://github.com/google/re2) for parsing RegEx. This means that all operations requiring polynomial
time to compute will not work. See the [RE2 wiki](https://github.com/google/re2/wiki/Syntax) for supported extensions. time to compute will not work. See the [RE2 wiki](https://github.com/google/re2/wiki/Syntax) for supported extensions.
If you want to _negate_ a ReGex, as in pass only when the RegEx _fails_, you can prefix it with `negative:`, e.g.: `negative:kitty`. If you want to _negate_ a RegEx, as in pass only when the RegEx _fails_, you can prefix it with `negative:`, e.g.: `negative:kitty`.
## Rules ## Effects
### Static rules ### Static effects
Static rules are evaluated once when the window is opened and never again. This essentially means that it is always the `initialTitle` and `initialClass` which will be found when matching on `title` and `class`, respectively. Static effects are evaluated once when the window is opened and never again. This essentially means that it is always the `initialTitle` and `initialClass` which will be found when matching on `title` and `class`, respectively.
> [!WARNING] > [!WARNING]
> It is not possible to `float` (or any other static rule) a window based on a change in the `title` after the window has been created. This applies to all static rules listed here. > It is not possible to `float` (or any other static rule) a window based on a change in the `title` after the window has been created. This applies to all static effects listed here.
| Rule | Description | | Effect | argument | Description |
| ---- | ----------- | | ---- | ----------- |
| float | Floats a window. | | float | \[on\] | Floats a window. |
| tile | Tiles a window. | | tile | \[on\] |Tiles a window. |
| fullscreen | Fullscreens a window. | | fullscreen | \[on\] | Fullscreens a window. |
| maximize | Maximizes a window. | | maximize | \[on\] | Maximizes a window. |
| persistentsize | Allows size persistence between application launches for floating windows. | | fullscreen_state | \[internal\] \[client\] | Sets the focused window's fullscreen mode and the one sent to the client, where internal and client can be `0` - none, `1` - maximize, `2` - fullscreen, `3` - maximize and fullscreen. |
| fullscreenstate \[internal\] \[client\] | Sets the focused window's fullscreen mode and the one sent to the client, where internal and client can be `0` - none, `1` - maximize, `2` - fullscreen, `3` - maximize and fullscreen. | | move | \[expr\] \[expr\] | Moves a floating window to a given coordinate, monitor-local. Two expressions are space-separated. |
| move \[x\] \[y\] | Moves a floating window (`x, y` -> int or %, e.g. `100` or `20%`.<br>You are also allowed to do `100%-` for the right/bottom anchor, e.g. `100%-20`. In addition, the option supports the subtraction of the window's size with `100%-w-`, e.g. `100%-w-20`. This results in a gap at the right/bottom edge of the screen to the window with the defined subtracted size). <br> 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%`) | | size | \[expr\] \[expr\] | Resizes a floating window to a given size. Two expressions are space-separated. |
| size \[w\] \[h\] | Resizes a floating window (`w, h` -> int or %, e.g. `1280, 720` or `50%, 50%`.<br>`<` and `>` may also be prefixed in conjunction, to specify respectively the maximum or minimum allowed size. (e.g. `<1280` or `<40%` -> maximum size, `>300` or `>10%` -> minimum size).<br>Note that int values in pixels will be scaled by your monitor's scaling factor. | | pseudo | \[on\] | Pseudotiles a window. |
| center (\[opt\]) | If the window is floating, will center it on the monitor. Set opt to `1` to respect monitor reserved area. | | monitor | \[id\] | Sets the monitor on which a window should open. `id` can be either the id number or the name (e.g. `1` or `DP-1`). |
| pseudo | Pseudotiles a window. | | workspace | \[w\] | Sets the workspace on which a window should open (for workspace syntax, see [dispatchers->workspaces](../Dispatchers#workspaces)). <br> You can also set \[w\] to `unset`. This will unset all previous workspace rules applied to this window. Additionally you can add `silent` after the workspace to make the window open silently. |
| monitor \[id\] | Sets the monitor on which a window should open. `id` can be either the id number or the name (e.g. `1` or `DP-1`). | | no_initial_focus | \[on\] | Disables the initial focus to the window |
| workspace \[w\] | Sets the workspace on which a window should open (for workspace syntax, see [dispatchers->workspaces](../Dispatchers#workspaces)). <br> You can also set \[w\] to `unset`. This will unset all previous workspace rules applied to this window. Additionally you can add `silent` after the workspace to make the window open silently. | | pin | \[on\] | Pins the window (i.e. show it on all workspaces). _Note: floating only_. |
| noinitialfocus | Disables the initial focus to the window | | group | \[options\] | Sets window group properties. See the note below. |
| pin | Pins the window (i.e. show it on all workspaces). _Note: floating only_. | | suppress_event | \[types...\] | Ignores specific events from the window. Events are space separated, and can be: `fullscreen`, `maximize`, `activate`, `activatefocus`, `fullscreenoutput`. |
| unset \[rule\] | Unset rules for the matching `PARAMETERS` (exact match required) or a specific `RULE`. No rule defaults to `all`. | | content | \[none\|photo\|video\|game\] | Sets content type. |
| nomaxsize | Removes max size limitations. Especially useful with windows that report invalid max sizes (e.g. winecfg). | | no_close_for | \[ms\] | Makes the window uncloseable with the `killactive` dispatcher for a given amount of ms on open. |
| stayfocused | Forces focus on the window as long as it's visible. |
| group \[options\] | Sets window group properties. See the note below. |
| suppressevent \[types...\] | Ignores specific events from the window. Events are space separated, and can be: `fullscreen`, `maximize`, `activate`, `activatefocus`, `fullscreenoutput`. |
| content \[none\|photo\|video\|game\] | Sets content type. |
| noclosefor \[ms\] | Makes the window uncloseable with the `killactive` dispatcher for a given amount of ms on open. |
### Dynamic rules #### Expressions
Dynamic rules are re-evaluated every time a property changes. Expressions are space-separated, so your math cannot have spaces. They are regular, math expressions, with a few variables exposed,
names of which are self-explanatory. All position variables are monitor-local.
| Rule | Description | - `monitor_w` and `monitor_h` for monitor size
- `window_x` and `window_y` for window position
- `window_w` and `window_h` for window size
- `cursor_x` and `cursor_y` for cursor position
Example expressions:
- `window_w*0.5`
- `(monitor_w/2)+17`
It's probably a good idea to surround your expressions with parentheses for clarity, with space-separation:
- `(monitor_w*0.5) (monitor_h*0.5)`
- `((monitor_w*0.5)+17) (monitor_h*0.2)`
### Dynamic effects
Dynamic effects are re-evaluated every time a property changes.
| Effect | argument | Description |
| ---- | ----------- | | ---- | ----------- |
| animation \[style\] (\[opt\]) | Forces an animation onto a window, with a selected opt. Opt is optional. | | persistent_size | \[on\] | Allows size persistence between application launches for floating windows. |
| bordercolor \[c\] | Force the bordercolor of the window. <br> Options for c: `color`/`color ... color angle` -> sets the active border color/gradient OR `color color`/`color ... color angle color ... color [angle]` -> sets the active and inactive border color/gradient of the window. See [variables->colors](../Variables#variable-types) for color definition. | | no_max_size | \[on\] | Removes max size limitations. Especially useful with windows that report invalid max sizes (e.g. winecfg). |
| idleinhibit \[mode\] | Sets an idle inhibit rule for the window. If active, apps like `hypridle` will not fire. Modes: `none`, `always`, `focus`, `fullscreen`. | | stay_focused | \[on\] | Forces focus on the window as long as it's visible. |
| opacity \[a\] | Additional opacity multiplier. Options for a: `float` -> sets an overall opacity, `float float` -> sets activeopacity and inactiveopacity respectively, `float float float` -> sets activeopacity, inactiveopacity and fullscreenopacity respectively. | | animation | \[style\] (\[opt\]) | Forces an animation onto a window, with a selected opt. Opt is optional. |
| tag \[name\] | Applies the tag `name` to the window, use prefix `+`/`-` to set/unset flag, or no prefix to toggle the flag. | | border_color | \[c\] | Force the bordercolor of the window. <br> Options for c: `color`/`color ... color angle` -> sets the active border color/gradient OR `color color`/`color ... color angle color ... color [angle]` -> sets the active and inactive border color/gradient of the window. See [variables->colors](../Variables#variable-types) for color definition. |
| maxsize \[w\] \[h\] | Sets the maximum size (x,y -> int). Applies to floating windows. (use `misc:size_limits_tiled` to include tiled windows.) | | idle_inhibit | \[mode\] | Sets an idle inhibit rule for the window. If active, apps like `hypridle` will not fire. Modes: `none`, `always`, `focus`, `fullscreen`. |
| minsize \[w\] \[h\] | Sets the minimum size (x,y -> int). Applies to floating windows. (use `misc:size_limits_tiled` to include tiled windows.) | | opacity | \[a\] | Additional opacity multiplier. Options for a: `float` -> sets an overall opacity, `float float` -> sets activeopacity and inactiveopacity respectively, `float float float` -> sets activeopacity, inactiveopacity and fullscreenopacity respectively. |
| tag | \[name\] | Applies the tag `name` to the window, use prefix `+`/`-` to set/unset flag, or no prefix to toggle the flag. |
| max_size | \[w\] \[h\] | Sets the maximum size (x,y -> int). Applies to floating windows. (use `misc:size_limits_tiled` to include tiled windows.) |
| min_size | \[w\] \[h\] | Sets the minimum size (x,y -> int). Applies to floating windows. (use `misc:size_limits_tiled` to include tiled windows.) |
| border_size | \[int\] | Sets the border size. |
| rounding | \[int\] | Forces the application to have X pixels of rounding, ignoring the set default (in `decoration:rounding`). Has to be an int. |
| rounding_power | \[float\] | Overrides the rounding power for the window (see `decoration:rounding_power`). |
| allows_input | \[on\] | Forces an XWayland window to receive input, even if it requests not to do so. (Might fix issues like Game Launchers not receiving focus for some reason) |
| dim_around | \[on\] | Dims everything around the window. Please note that this rule is meant for floating windows and using it on tiled ones may result in strange behavior. |
| decorate | \[on\] | (default is _true_) Whether to draw window decorations or not |
| focus_on_activate | \[on\] | Whether Hyprland should focus an app that requests to be focused (an `activate` request). |
| keep_aspect_ratio | \[on\] | Forces aspect ratio when resizing window with the mouse. |
| nearest_neighbor | \[on\] | Forces the window to use [nearest neighbor](https://en.wikipedia.org/wiki/Image_scaling#Nearest-neighbor_interpolation) filtering. |
| no_anim | \[on\] | Disables the animations for the window. |
| no_blur | \[on\] | Disables blur for the window. |
| no_dim | \[on\] | Disables window dimming for the window. |
| no_focus | \[on\] | Disables focus to the window. |
| no_follow_mouse | \[on\] | Prevents the window from being focused when the mouse moves over it when `input:follow_mouse=1` is set. |
| no_rounding | \[on\] | Disables rounding for the window. |
| no_shadow | \[on\] | Disables shadows for the window. |
| no_shortcuts_inhibit | \[on\] | Disallows the app from [inhibiting your shortcuts](https://wayland.app/protocols/keyboard-shortcuts-inhibit-unstable-v1). |
| no_screen_share | \[on\] | Hides the window and its popups from screen sharing by drawing black rectangles in their place. The rectangles are drawn even if other windows are above. |
| no_vrr | \[on\] | Disables VRR for the window. Only works when [`misc:vrr`](../Variables/#Misc) is set to `2` or `3`. |
| opaque | \[on\] | Forces the window to be opaque. |
| force_rgbx | \[on\] | Forces Hyprland to ignore the alpha channel on the whole window's surfaces, effectively making it _actually, fully 100% opaque_. |
| sync_fullscreen | \[on\] | Whether the fullscreen mode should always be the same as the one sent to the window (will only take effect on the next fullscreen mode change). |
| immediate | \[on\] | Forces the window to allow tearing. See [the Tearing page](../Tearing). |
| xray | \[on\] | Sets blur xray mode for the window. |
| render_unfocused | \[on\] | Forces the window to think it's being rendered when it's not visible. See also [Variables - Misc](../Variables/#Misc) for setting `render_unfocused_fps`. |
| scroll_mouse | \[float\] | Forces the window to override the variable `input:scroll_factor`. |
| scroll_touchpad | \[float\] | Forces the window to override the variable `input:touchpad:scroll_factor`. |
The following rules can also be set with [`setprop`](../Dispatchers#setprop): All dynamic effects can be set with `setprop`, see [`setprop`](../Dispatchers#setprop).
| Rule | Description |
| ---- | ----------- |
| bordersize \[int\] | Sets the border size. |
| rounding \[int\] | Forces the application to have X pixels of rounding, ignoring the set default (in `decoration:rounding`). Has to be an int. |
| roundingpower \[float\] | Overrides the rounding power for the window (see `decoration:rounding_power`). |
| allowsinput \[on\] | Forces an XWayland window to receive input, even if it requests not to do so. (Might fix issues like Game Launchers not receiving focus for some reason) |
| dimaround \[on\] | Dims everything around the window. Please note that this rule is meant for floating windows and using it on tiled ones may result in strange behavior. |
| decorate \[on\] | Whether to draw window decorations or not |
| focusonactivate \[on\] | Whether Hyprland should focus an app that requests to be focused (an `activate` request). |
| keepaspectratio \[on\] | Forces aspect ratio when resizing window with the mouse. |
| nearestneighbor \[on\] | Forces the window to use [nearest neighbor](https://en.wikipedia.org/wiki/Image_scaling#Nearest-neighbor_interpolation) filtering. |
| noanim \[on\] | Disables the animations for the window. |
| noblur \[on\] | Disables blur for the window. |
| noborder \[on\] | Disables borders for the window. |
| nodim \[on\] | Disables window dimming for the window. |
| nofocus \[on\] | Disables focus to the window. |
| nofollowmouse \[on\] | Prevents the window from being focused when the mouse moves over it when `input:follow_mouse=1` is set. |
| nomaxsize \[on\] | Disables max size for the window. |
| norounding \[on\] | Disables rounding for the window. |
| noshadow \[on\] | Disables shadows for the window. |
| noshortcutsinhibit \[on\] | Disallows the app from [inhibiting your shortcuts](https://wayland.app/protocols/keyboard-shortcuts-inhibit-unstable-v1). |
| opaque \[on\] | Forces the window to be opaque. |
| forcergbx \[on\] | Forces Hyprland to ignore the alpha channel on the whole window's surfaces, effectively making it _actually, fully 100% opaque_. |
| syncfullscreen \[on\] | Whether the fullscreen mode should always be the same as the one sent to the window (will only take effect on the next fullscreen mode change). |
| immediate \[on\] | Forces the window to allow tearing. See [the Tearing page](../Tearing). |
| xray \[on\] | Sets blur xray mode for the window. |
| renderunfocused | Forces the window to think it's being rendered when it's not visible. See also [Variables - Misc](../Variables/#Misc) for setting `render_unfocused_fps`. |
| scrollmouse \[float\] | Forces the window to override the variable `input:scroll_factor`. |
| scrolltouchpad \[float\] | Forces the window to override the variable `input:touchpad:scroll_factor`. |
| noscreenshare \[on\] | Hides the window and its popups from screen sharing by drawing black rectangles in their place. The rectangles are drawn even if other windows are above. |
| novrr \[on\] | Disables VRR for the window. Only works when [`misc:vrr`](../Variables/#Misc) is set to `2` or `3`. |
> [!NOTE]
> When using window rules, \[on\] can be set to `0` for _disabled_, `1` for _enabled_, or left blank to use the default value.
>
> When using `setprop`, \[on\] can be set to `0` for _disabled_, `1` for _enabled_,
> `toggle` to toggle the state or `unset` to unset previous values.
>
> When using `setprop`, \[int\] can also be `unset` to unset previous
> values.
### `group` window rule options ### `group` window rule options
@ -228,15 +212,15 @@ hyprctl dispatch tagwindow +media title:Celluloid
Use the `tag` rule to add a dynamic tag to a window: Use the `tag` rule to add a dynamic tag to a window:
```ini ```ini
windowrule = tag +term, class:footclient # Add dynamic tag `term*` to window footclient. windowrule = tag +term, match:class footclient # Add dynamic tag `term*` to window footclient.
windowrule = tag term, class:footclient # Toggle dynamic tag `term*` for window footclient. windowrule = tag term, match:class footclient # Toggle dynamic tag `term*` for window footclient.
windowrule = tag +code, tag:cpp # Add dynamic tag `code*` to window with tag `cpp`. windowrule = tag +code, match:tag cpp # Add dynamic tag `code*` to window with tag `cpp`.
windowrule = opacity 0.8, tag:code # Set opacity for window with tag `code` or `code*`. windowrule = opacity 0.8, match:tag code # Set opacity for window with tag `code` or `code*`.
windowrule = opacity 0.7, tag:cpp # Window with tag `cpp` will match both `code` and `cpp`, the last one will override prior match. windowrule = opacity 0.7, match:tag cpp # Window with tag `cpp` will match both `code` and `cpp`, the last one will override prior match.
windowrule = opacity 0.6, tag:term* # Set opacity for window with tag `term*` only, `term` will not be matched. windowrule = opacity 0.6, match:tag term* # Set opacity for window with tag `term*` only, `term` will not be matched.
windowrule = tag -code, tag:term # Remove dynamic tag `code*` for window with tag `term` or `term*`. windowrule = tag -code, match:tag term # Remove dynamic tag `code*` for window with tag `term` or `term*`.
``` ```
Or with a keybind for convenience: Or with a keybind for convenience:
@ -245,8 +229,8 @@ Or with a keybind for convenience:
bind = $mod Ctrl, 2, tagwindow, alpha_0.2 bind = $mod Ctrl, 2, tagwindow, alpha_0.2
bind = $mod Ctrl, 4, tagwindow, alpha_0.4 bind = $mod Ctrl, 4, tagwindow, alpha_0.4
windowrule = opacity 0.2 override, tag:alpha_0.2 windowrule = opacity 0.2 override, match:tag alpha_0.2
windowrule = opacity 0.4 override, tag:alpha_0.4 windowrule = opacity 0.4 override, match:tag alpha_0.4
``` ```
The `tag` rule can only manipulate dynamic tags, and the `tagwindow` dispatcher only works with static tags (i.e. once the dispatcher is called, dynamic tags will be cleared). The `tag` rule can only manipulate dynamic tags, and the `tagwindow` dispatcher only works with static tags (i.e. once the dispatcher is called, dynamic tags will be cleared).
@ -254,32 +238,38 @@ The `tag` rule can only manipulate dynamic tags, and the `tagwindow` dispatcher
### Example Rules ### Example Rules
```ini ```ini
windowrule = move 100 100, class:kitty # Move kitty to 100 100 # Move kitty to 100 100 and add an anim style
windowrule = animation popin, class:kitty # Set the animation style for kitty windowrule {
windowrule = noblur, class:firefox # Disable blur for firefox name = move-kitty
windowrule = move cursor -50% -50%, class:kitty # Move kitty to the center of the cursor match:class = kitty
windowrule = bordercolor rgb(FF0000) rgb(880808), fullscreen:1 # Set bordercolor to red if window is fullscreen
windowrule = bordercolor rgb(00FF00), fullscreenstate:* 1 # Set bordercolor to green if window's client fullscreen state is 1(maximize) (internal state can be anything) move = 100 100
windowrule = bordercolor rgb(FFFF00), title:.*Hyprland.* # Set bordercolor to yellow when title contains Hyprland animation = popin
windowrule = opacity 1.0 override 0.5 override 0.8 override, class:kitty # Set opacity to 1.0 active, 0.5 inactive and 0.8 fullscreen for kitty }
windowrule = rounding 10, class:kitty # Set rounding to 10 for kitty
windowrule = stayfocused, class:(pinentry-)(.*) # Fix pinentry losing focus windowrule = noblur, match:class firefox # Disable blur for firefox
windowrule = move cursor -50% -50%, match:class kitty # Move kitty to the center of the cursor
windowrule = bordercolor rgb(FF0000) rgb(880808), match:fullscreen 1 # Set bordercolor to red if window is fullscreen
windowrule = bordercolor rgb(FFFF00), match:title .*Hyprland.* # Set bordercolor to yellow when title contains Hyprland
windowrule = opacity 1.0 override 0.5 override 0.8 override, match:class kitty # Set opacity to 1.0 active, 0.5 inactive and 0.8 fullscreen for kitty
windowrule = match:class kitty, rounding 10 # Set rounding to 10 for kitty
windowrule = match:class (pinentry-)(.*), stayfocused # Fix pinentry losing focus
``` ```
### Notes ### Notes
Rules that are marked as _Dynamic_ will be reevaluated if the matching property Effects that are marked as _Dynamic_ will be reevaluated if the matching property
of the window changes.<br> of the window changes.<br>
For instance, if a rule is defined that changes the `bordercolor` of a window For instance, if a rule is defined that changes the `border_color` of a window
when it is floating, then the `bordercolor` will change to the requested color when it is floating, then the `border_color` will change to the requested color
when it is set to floating, and revert to the default color when it is tiled again. when it is set to floating, and revert to the default color when it is tiled again.
Rules will be processed from top to bottom, where the _last_ match will take Effects will be processed from top to bottom, where the _last_ match will take
precedence. i.e. precedence. i.e.
```ini ```ini
windowrule = opacity 0.8 0.8, class:kitty windowrule = opacity 0.8 0.8, match:class kitty
windowrule = opacity 0.5 0.5, floating:1 windowrule = opacity 0.5 0.5, match:floating yes
``` ```
Here, all non-fullscreen kitty windows will have `opacity 0.8`, except if Here, all non-fullscreen kitty windows will have `opacity 0.8`, except if
@ -287,8 +277,8 @@ they are floating. Otherwise, they will have `opacity 0.5`. The rest of the
non-fullscreen floating windows will have `opacity 0.5`. non-fullscreen floating windows will have `opacity 0.5`.
```ini ```ini
windowrule = opacity 0.5 0.5,floating:1 windowrule = opacity 0.5 0.5, match:floating true
windowrule = opacity 0.8 0.8,class:kitty windowrule = opacity 0.8 0.8, match:class kitty
``` ```
Here, all kitty windows will have `opacity 0.8`, even if they are floating. Here, all kitty windows will have `opacity 0.8`, even if they are floating.
@ -307,40 +297,53 @@ The rest of the floating windows will have `opacity 0.5`.
> fully opaque regardless of other opacity rules: > fully opaque regardless of other opacity rules:
> >
> ```ini > ```ini
> windowrule = opacity 0.8 override 0.8 override 1.0 override, class:kitty > windowrule = match:class kitty, opacity 0.8 override 0.8 override 1.0 override
> ``` > ```
### Dynamically enabling / disabling / changing rules
Only named rules can be dynamically changed, enabled or disabled. Anonymous rules cannot be.
For enabling or disabling, the keyword `enable` is exposed:
```sh
hyprctl keyword 'windowrule[my-rule-name]:enable false'
```
For changing properties, the same syntax can be used:
```sh
hyprctl keyword 'windowrule[my-rule-name]:match:class kitty'
```
_the singlequotes are necessary, otherwise your shell might try to parse the string_
## Layer Rules ## Layer Rules
Some things in Wayland are not windows, but layers. That includes, for example: Some things in Wayland are not windows, but layers. That includes, for example:
app launchers, status bars, or wallpapers. app launchers, status bars, or wallpapers.
Those have specific rules, separate from windows: Those have specific rules, separate from windows. Their syntax is the exact same,
but they have different props and effects.
```ini ### Props
layerrule = rule, namespace
# or
layerrule = rule, address
```
where `rule` is the rule and `namespace` is the namespace RegEx (find | Field | Argument | Description |
namespaces in `hyprctl layers`) or `address` is an address in the form of | -------------- | --------------- |
`address:0x[hex]`. | match:namespace | \[RegEx\] | namespace of the layer, check `hyprctl layers`. |
### Rules ### Effects
| rule | description | | effect | argument | description |
| ---- | ----------- | | ---- | ----------- |
| unset | Removes all layerRules previously set for a select namespace RegEx. Please note it has to match _exactly_. | | no_anim | \[on\] | Disables animations. |
| noanim | Disables animations. | | blur | \[on\] | Enables blur for the layer. |
| blur | Enables blur for the layer. | | blur_popups | \[on\] | Enables blur for the popups. |
| blurpopups | Enables blur for the popups. | | ignore_alpha | \[a\] | Makes blur ignore pixels with opacity of `a` or lower. `a` is float value from `0` to `1`. `a = 0` if unspecified. |
| ignorealpha \[a\] | Makes blur ignore pixels with opacity of `a` or lower. `a` is float value from `0` to `1`. `a = 0` if unspecified. | | dim_around | \[on\] | Dims everything behind the layer. |
| ignorezero | Makes blur ignore fully transparent pixels. Same as `ignorealpha 0`. | | xray | \[on\] | Sets the blur xray mode for a layer. `0` for off, `1` for on, `unset` for default. |
| dimaround | Dims everything behind the layer. | | animation | \[style\] | Allows you to set a specific animation style for this layer. |
| xray \[on\] | Sets the blur xray mode for a layer. `0` for off, `1` for on, `unset` for default. | | order | \[n\] | Sets the order relative to other layers. A higher `n` means closer to the edge of the monitor. Can be negative. `n = 0` if unspecified. |
| animation \[style\] | Allows you to set a specific animation style for this layer. | | abovelock | \[0/1/2\] | If non-zero, renders the layer above the lockscreen when the session is locked. If set to `2`, you can interact with the layer on the lockscreen, otherwise it will only be rendered above it. |
| order \[n\] | Sets the order relative to other layers. A higher `n` means closer to the edge of the monitor. Can be negative. `n = 0` if unspecified. | | noscreenshare | \[on\] | Hides the layer from screen sharing by drawing a black rectangle over it. |
| abovelock \[interactable\] | Renders the layer above the lockscreen when the session is locked. If set to `true`, you can interact with the layer on the lockscreen, otherwise it will only be rendered above it. |
| noscreenshare \[on\] | Hides the layer from screen sharing by drawing a black rectangle over it. |