feat(wm): transparency for the windows without the focus

The window in front of every container is see-through, unless its container has
the focus on the focused monitor, so that the window being worked in stands out.
The opacity of a window is a property KWin has: komorebi sets it through the
bridge, as a fraction of 255, and KWin draws the window so. The window manager
keeps the opacity it gave each window and, after every event and message, sends
only the difference, makes a window opaque again when it should no longer be
see-through, and makes every one opaque when it stops. Windows an ignore rule
covers, and workspaces that do not tile, are left as they are.

The patched border effect already draws a window again when its opacity changes,
so the border follows it. komorebic gets transparency, transparency-alpha and
toggle-transparency, and the state of the daemon says what the settings are.
vm-features checks the pixels in the middle of a focused window and of one that
is not.

A monocled window is opaque on the focused monitor and see-through on another.
komorebi.json takes transparency, transparency_alpha and
transparency_ignore_rules.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:49 -07:00
1 parent abfa8c6a5c
commit fa1e822e44
36 files changed
+974 -30

No files matched your search

+11
View File
@@ -120,6 +120,17 @@ runs.
settings as they are, and one that has it and leaves out `duration` or `style` leaves that one as it
is; a value given for every kind of animation takes the settings of single kinds away.
### Transparency
| Key | Default | What it does |
|---|---|---|
| `transparency` | `false` | Whether the windows that do not have the focus are see-through |
| `transparency_alpha` | `200` | How opaque they are, from 0 to 255 |
| `transparency_ignore_rules` | none | Rules for the windows that are never see-through |
[Transparency](transparency.md) explains which windows are see-through. `transparency_ignore_rules`
is a list of rules, which [Rules](#rules) describes, and has no command.
### Rules
| Key | What it does |
+63
View File
@@ -0,0 +1,63 @@
# Transparency
komorebi can make the windows that do not have the focus see-through, so that the one you are
working in stands out. It does not draw anything itself: the opacity of a window is a property
KWin has, which komorebi sets. Transparency is off by default.
## Turning it on
[`komorebic transparency`](../cli/transparency.md) turns transparency on or off,
[`komorebic toggle-transparency`](../cli/toggle-transparency.md) switches it, and
[`komorebic transparency-alpha`](../cli/transparency-alpha.md) sets how opaque a see-through window
is, from 0 (not there at all) to 255 (not see-through): 200 by default.
```sh
komorebic transparency enable
komorebic transparency-alpha 150
komorebic toggle-transparency
```
## In komorebi.json
The same settings are keys of [`komorebi.json`](configuration.md#transparency): `transparency`,
`transparency_alpha` and `transparency_ignore_rules`, a list of rules, as [Rules](rules.md)
explains them, for the windows that are never see-through.
```json
{
"transparency": true,
"transparency_alpha": 150,
"transparency_ignore_rules": [
{ "kind": "Exe", "id": "mpv", "matching_strategy": "Equals" }
]
}
```
The file sets them when the daemon starts and when the file changes. A file that leaves out
`transparency` or `transparency_alpha` has the defaults, off and 200, so a change made with a
command does not survive the file changing. The ignore rules add up, as the other rules do.
## Which windows are see-through
On the workspace each monitor shows, the window in front in every container is see-through unless
its container has the focus on the focused monitor. A window on a monitor that is not the focused
one is see-through, whatever its container. On a workspace with a monocle the monocled window is
the only one that counts: it is opaque on the focused monitor and see-through on another. A
workspace that does not tile has no see-through windows, and neither does a window that a rule
keeps out of it: the rules are the `transparency_ignore_rules` of
[`komorebi.json`](configuration.md#transparency), which no command sets.
Windows that are not in front, such as the other windows of a stack, are not on the screen and
are left as they are. With transparency off, every window is opaque.
## What is put back
When komorebi exits, every window it made see-through is opaque again. A window that closes needs
nothing.
## The border
The border effect draws a window from a texture that has the window's opacity in it. The build
of the effect that the flake installs draws a window again when its opacity changes, so the border
and the window change together. With the stock effect a change of opacity alone does not show
until the window changes.