feat(wm): application specific configuration

Rules for particular applications can be kept in files of their own,
applications.json, which komorebi.json names with
app_specific_configuration_path: one path or a list. The ignore, manage and
floating rules of every application in a file are added to the lists the
configuration's own rules go in, so a file can be shared or kept apart from the
settings.

A path with no file behind it is skipped with a warning, since one komorebi.json
is meant to work on every platform and may name a file that only another
platform has; a file that is there and is not an applications.json is an error.
The titleless and tabbed rules of other platforms are read and do nothing.

komorebic/applications.json is a start for Plasma: it floats the calculators,
the screenshot tool, the authentication dialog and System Settings. A test opens
the windows it names.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:37 -07:00
1 parent 5eaa613f50
commit ed34286bca
15 files changed
+564 -6

No files matched your search

@@ -0,0 +1,73 @@
# Application specific configuration
Some applications need to be told how to behave under a tiling window manager: a calculator that
should float instead of taking a tile, a launcher that should never be tiled. The
[rules](rules.md) that say so can be put in `komorebi.json`, or in a file of their own,
`applications.json`, that the configuration names. The file can be shared, or kept apart from
the settings, and a list of files can be put together from several sources.
## The file
`applications.json` is an object with one entry for each application. The name of the entry is
only for the reader. Each entry has lists of [rules](rules.md), as `komorebi.json` has them:
```json
{
"KDE Plasma": {
"floating": [
{ "kind": "Class", "id": "org.kde.kcalc", "matching_strategy": "Equals" },
{ "kind": "Class", "id": "org.kde.spectacle", "matching_strategy": "Equals" }
]
},
"Steam": {
"ignore": [{ "kind": "Exe", "id": "steam", "matching_strategy": "Equals" }]
}
}
```
| List | What it does | In `komorebi.json` |
|---|---|---|
| `ignore` | komorebi leaves the windows alone | `ignore_rules` |
| `manage` | komorebi tiles the windows, whatever the ignore rules say | `manage_rules` |
| `floating` | the windows open floating | `floating_applications` |
| `titleless`, `tabbed` | nothing: they work around how another platform exposes windows, and a KWin window is always a window | `titleless_applications`, `tabbed_applications` |
An entry named `$schema` has the address of a schema as its value, as an editor wants it, and
is ignored.
## Naming the file
`app_specific_configuration_path` in `komorebi.json` is the path of one file, or a list of paths:
```json
{
"app_specific_configuration_path": "$HOME/.config/komorebi/applications.json"
}
```
```json
{
"app_specific_configuration_path": [
"$HOME/.config/komorebi/applications.json",
"$HOME/.config/komorebi/mine.json"
]
}
```
Environment variables in a path, such as `$HOME`, are replaced. The files are read when
`komorebi.json` is: when the daemon starts, and again when the configuration changes. Their rules
are added to the ones the daemon has, after the rules of `komorebi.json` itself, which
[Configuration](configuration.md#rules) explains.
A path with no file behind it is skipped, and the daemon logs a warning: one `komorebi.json` can
serve every platform, even if it names a file that only another platform has. A file that is
there and is not an `applications.json`, or has a rule that is not valid, is an error: the daemon
does not start with it, and a reload with it fails and logs the error. Only a file with the
extension `.json` is read.
## The file komorebi ships
[`komorebic/applications.json`](../../komorebic/applications.json) in the repository has an
entry for KDE Plasma, which floats the calculators of KDE and GNOME, the screenshot tool, the
authentication dialog of Plasma and System Settings. A test loads it, and opens the windows it
names.
+1
View File
@@ -96,6 +96,7 @@ can have values of their own, which come before the default.
| `ignore_rules` | Windows komorebi leaves alone (`float_rules` is the same key under its old name) |
| `manage_rules` | Windows komorebi tiles whatever the ignore rules say |
| `floating_applications` | Windows that open floating |
| `app_specific_configuration_path` | One `applications.json`, or a list of them, whose rules are added to these ([Application specific configuration](application-specific-configuration.md)) |
Each is a list of rules, which [Rules](rules.md) explains. A rule is an object with `kind` (`Exe`,
`Class`, `Title` or `Path`), `id` and `matching_strategy` (`Equals`, `StartsWith`, `EndsWith`,