2024-02-20 21:16:07 +01:00
---
weight: 8
title: Workspace Rules
---
2023-05-01 23:28:16 +02:00
2024-02-20 21:16:07 +01:00
You can set workspace rules to achieve workspace-specific behaviors. For
instance, you can define a workspace where all windows are drawn without borders
or gaps.
2023-05-01 23:28:16 +02:00
2024-02-20 21:16:07 +01:00
For layout-specific rules, see the specific layout page. For example:
2024-07-30 21:59:15 +02:00
[Master Layout->Workspace Rules ](../Master-Layout#workspace-rules ).
2024-02-20 21:16:07 +01:00
2024-03-19 22:04:09 +01:00
### Workspace selectors
2024-07-30 21:59:15 +02:00
Workspaces that have already been created can be targeted by workspace
selectors, e.g. `r[2-4] w[t1]` .
2024-03-19 22:04:09 +01:00
2024-07-30 21:59:15 +02:00
Selectors have props separated by a space. No spaces are allowed inside props
themselves.
2024-03-19 22:04:09 +01:00
Props:
2024-11-06 19:34:37 +01:00
- `r[A-B]` - ID range from A to B inclusive
- `s[bool]` - Whether the workspace is special or not
- `n[bool]` , `n[s:string]` , `n[e:string]` - named actions. `n[bool]` ->
whether a workspace is a named workspace, `s` and `e` are starts and ends
with respectively
- `m[monitor]` - Monitor selector
- `w[(flags)A-B]` , `w[(flags)X]` - Prop for window counts on the workspace.
A-B is an inclusive range, X is a specific number. Flags can be omitted.
It can be `t` for tiled-only, `f` for floating-only, `g` to count groups
instead of windows, and `v` to count only visible windows.
- `f[-1]` , `f[0]` , `f[1]` , `f[2]` - fullscreen state of the workspace. `-1` : no
fullscreen, `0` : fullscreen, `1` : maximized, `2` , fullscreen without
fullscreen state sent to the window.
2024-03-19 22:04:09 +01:00
2024-02-20 21:16:07 +01:00
### Syntax
2023-05-01 23:28:16 +02:00
```ini
2024-07-30 21:59:15 +02:00
workspace = WORKSPACE, RULES
2023-05-01 23:28:16 +02:00
```
2024-02-20 21:16:07 +01:00
- WORKSPACE is a valid workspace identifier (see
2024-03-17 13:44:39 +01:00
[Dispatchers->Workspaces ](../Dispatchers#workspaces )). This field is
2024-03-19 22:04:09 +01:00
mandatory. This _can be_ a workspace selector, but please note
workspace selectors can only match _existing_ workspaces.
2023-05-01 23:28:16 +02:00
- RULES is one (or more) rule(s) as described here in [rules ](#rules ).
### Examples
2024-02-20 21:16:07 +01:00
2023-05-01 23:28:16 +02:00
```ini
2024-07-30 21:59:15 +02:00
workspace = name:myworkspace, gapsin:0, gapsout:0
workspace = 3, rounding:false, bordersize:0
workspace = w[tg1-4], shadow:false
2023-05-01 23:28:16 +02:00
```
2024-10-11 11:54:11 +02:00
#### Smart gaps
2024-10-29 22:38:10 +01:00
To replicate "smart gaps" / "no gaps when only" from other WMs/Compositors, use this bad boy:
2024-10-11 11:54:11 +02:00
```ini
2024-10-29 22:38:10 +01:00
workspace = w[t1], gapsout:0, gapsin:0
workspace = w[tg1], gapsout:0, gapsin:0
workspace = f[1], gapsout:0, gapsin:0
windowrulev2 = bordersize 0, floating:0, onworkspace:w[t1]
windowrulev2 = rounding 0, floating:0, onworkspace:w[t1]
windowrulev2 = bordersize 0, floating:0, onworkspace:w[tg1]
windowrulev2 = rounding 0, floating:0, onworkspace:w[tg1]
windowrulev2 = bordersize 0, floating:0, onworkspace:f[1]
windowrulev2 = rounding 0, floating:0, onworkspace:f[1]
2024-10-11 11:54:11 +02:00
```
2023-05-01 23:28:16 +02:00
## Rules
2024-02-20 21:16:07 +01:00
2023-05-05 16:42:26 +02:00
| Rule | Description | type |
2024-02-20 21:16:07 +01:00
| --- | --- | --- |
2024-04-21 16:35:48 +02:00
| monitor:[m] | Binds a workspace to a monitor. See [syntax ](#syntax ) and [Monitors ](../Monitors ). | string |
2023-05-05 16:42:26 +02:00
| default:[b] | Whether this workspace should be the default workspace for the given monitor | bool |
2024-03-17 13:44:39 +01:00
| gapsin:[x] | Set the gaps between windows (equivalent to [General->gaps_in ](../Variables#general )) | int |
| gapsout:[x] | Set the gaps between windows and monitor edges (equivalent to [General->gaps_out ](../Variables#general )) | int |
| bordersize:[x] | Set the border size around windows (equivalent to [General->border_size ](../Variables#general )) | int |
2024-02-20 21:16:07 +01:00
| border:[b] | Whether to draw borders or not | bool |
| shadow:[b] | Whether to draw shadows or not | bool |
2023-05-05 16:42:26 +02:00
| rounding:[b] | Whether to draw rounded windows or not | bool |
2023-05-01 23:28:16 +02:00
| decorate:[b] | Whether to draw window decorations or not | bool |
2023-10-09 21:28:28 +02:00
| persistent:[b] | Keep this workspace alive even if empty and inactive | bool |
2024-03-17 13:44:39 +01:00
| on-created-empty:[c] | A command to be executed once a workspace is created empty (i.e. not created by moving a window to it). See the [command syntax ](../Dispatchers#executing-with-rules ) | string |
2024-02-27 23:45:25 +01:00
| defaultName:[s] | A default name for the workspace. | string |
2023-05-01 23:28:16 +02:00
### Example Rules
2024-02-20 21:16:07 +01:00
2023-05-01 23:28:16 +02:00
```ini
2023-05-05 16:42:26 +02:00
workspace = 3, rounding:false, decorate:false
workspace = name:coding, rounding:false, decorate:false, gapsin:0, gapsout:0, border:false, decorate:false, monitor:DP-1
workspace = 8,bordersize:8
workspace = name:Hello, monitor:DP-1, default:true
2024-01-31 11:25:11 +01:00
workspace = name:gaming, monitor:desc:Chimei Innolux Corporation 0x150C, default:true
2023-10-23 00:10:47 +02:00
workspace = 5, on-created-empty:[float] firefox
workspace = special:scratchpad, on-created-empty:foot
2023-05-05 16:42:26 +02:00
```