feat(wm): workspace rules

A workspace rule sends the windows of an application to a workspace: an initial
rule once, when komorebi first sees the window, and a permanent rule every time,
so that a window the user takes away goes back. A rule is a rule on the window's
executable, class, title or path, with a monitor and a workspace index, or the
name of a workspace. It comes from komorebi.json (workspace_rules and
initial_workspace_rules of a workspace, made again from the file each time it is
read) or from komorebic (workspace-rule, initial-workspace-rule, their named
forms, and the commands that clear and enforce them).

The window manager looks at the rules before it handles each event about a
window it manages, and again when the configuration is loaded, so the windows
that were open when the daemon started are sent too. A window that leaves the
workspace in front is taken out of the layout and hidden, as the back of a stack
is, and it is put on the desktop of its new workspace, which is what it comes
back to and is tiled on when that workspace is shown. A window that moves
between workspaces that are not in front is put on the desktop of its new
workspace as well. A floating window that goes to another monitor is moved onto
it, and a workspace that does not exist yet is made.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:37 -07:00
1 parent c6874ff5db
commit efcc90d279
33 files changed
+1694 -14

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
```text
Remove all application association rules for all workspaces
Usage: clear-all-workspace-rules
Options:
-h, --help
Print help
```
+14
View File
@@ -0,0 +1,14 @@
```text
Remove all application association rules for a named workspace
Usage: clear-named-workspace-rules <WORKSPACE>
Arguments:
<WORKSPACE>
Name of a workspace
Options:
-h, --help
Print help
```
+17
View File
@@ -0,0 +1,17 @@
```text
Remove all application association rules for a workspace by monitor and workspace index
Usage: clear-workspace-rules <MONITOR> <WORKSPACE>
Arguments:
<MONITOR>
Monitor index (zero-indexed)
<WORKSPACE>
Workspace index on the specified monitor (zero-indexed)
Options:
-h, --help
Print help
```
+10
View File
@@ -0,0 +1,10 @@
```text
Enforce all workspace rules, including initial workspace rules that have already been applied
Usage: enforce-workspace-rules
Options:
-h, --help
Print help
```
+24
View File
@@ -0,0 +1,24 @@
```text
Add a rule to associate an application with a named workspace on first show
Usage: initial-named-workspace-rule <IDENTIFIER> <ID> <WORKSPACE>
Arguments:
<IDENTIFIER>
Possible values:
- exe: Executable name
- class: Role or subrole
- title: Window title
- path: Executable path
<ID>
Identifier as a string
<WORKSPACE>
Name of a workspace
Options:
-h, --help
Print help (see a summary with '-h')
```
+27
View File
@@ -0,0 +1,27 @@
```text
Add a rule to associate an application with a workspace on first show
Usage: initial-workspace-rule <IDENTIFIER> <ID> <MONITOR> <WORKSPACE>
Arguments:
<IDENTIFIER>
Possible values:
- exe: Executable name
- class: Role or subrole
- title: Window title
- path: Executable path
<ID>
Identifier as a string
<MONITOR>
Monitor index (zero-indexed)
<WORKSPACE>
Workspace index on the specified monitor (zero-indexed)
Options:
-h, --help
Print help (see a summary with '-h')
```
+24
View File
@@ -0,0 +1,24 @@
```text
Add a rule to associate an application with a named workspace
Usage: named-workspace-rule <IDENTIFIER> <ID> <WORKSPACE>
Arguments:
<IDENTIFIER>
Possible values:
- exe: Executable name
- class: Role or subrole
- title: Window title
- path: Executable path
<ID>
Identifier as a string
<WORKSPACE>
Name of a workspace
Options:
-h, --help
Print help (see a summary with '-h')
```
+27
View File
@@ -0,0 +1,27 @@
```text
Add a rule to associate an application with a workspace
Usage: workspace-rule <IDENTIFIER> <ID> <MONITOR> <WORKSPACE>
Arguments:
<IDENTIFIER>
Possible values:
- exe: Executable name
- class: Role or subrole
- title: Window title
- path: Executable path
<ID>
Identifier as a string
<MONITOR>
Monitor index (zero-indexed)
<WORKSPACE>
Workspace index on the specified monitor (zero-indexed)
Options:
-h, --help
Print help (see a summary with '-h')
```