mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-28 19:32:48 +01:00
feat(kwin): borders drawn by the compositor
komorebi draws no border. KWin's KDE Rounded Corners effect does, outside each window in the gap the layout leaves, and komorebi says how it looks. The window manager describes a Look (a border with a width, a radius and two colors) and asks the backend for it with Backend::apply_look after every event, message and retile. The backend answers whether borders are being drawn, and the layout leaves room around the windows only while they are: a border with no effect to draw it takes none. The KWin backend writes the effect's settings into the user's kwinrc, with every inner outline off (the effect's default draws one over the title bar), loads the effect when borders are on and has it read them again. It unloads the effect and puts the user's settings back when the borders go or komorebi exits. The module installs the effect (effects.borders), which is built to stay unloaded until komorebi asks, and vm-look reads the pixels around two windows in a real session. The session library of the VM tests also waits for the panel of the Plasma shell now: a window komorebi tiles before the panel is made is tiled under it, which hides the bottom of its border from a screenshot. Kde.wait_for_panel_room waits until the daemon's work area is not the whole of its monitor, which is the daemon having learned that the panel takes room, and vm-look calls it where the daemon starts, before the windows open. The shell makes its panel and KWin takes room for it a while later, which the daemon learns of up to a second after, so a daemon that tiles in between puts the windows under the panel and tiles them again, and a screenshot taken between the two shows frames as high as the screen. It is a wait and not a check, since a session that is too slow, as TCG often is, may never take the room. komorebic gets border, border-width and border-offset, and visible-windows. komorebi.json takes the same settings as border, border_width and border_offset, and border_radius, which has no command. The module warns when config asks for borders and the effect is not installed.
This commit is contained in:
1 parent
efcc90d279
commit
2c35e4bb6f
53 files changed
+2546
-64
No files matched your search
+19
-2
@@ -141,8 +141,18 @@ the run.
|
||||
- `desk(wid)` is the number of the desktop a window is on and `shown()` the one
|
||||
KWin shows, both counted from 1 as `kdotool` counts, `desktops()` how many
|
||||
desktops KWin has, `desktop_names()` their names in order (the parking desktop
|
||||
of a stack is the one named `komorebi-park`), and `kwinrc(group, key)` a value
|
||||
of the user's `kwinrc`.
|
||||
of a stack is the one named `komorebi-park`), `kwinrc(group, key)` a value of
|
||||
the user's `kwinrc`, and `kwinrc_group(group)` every key of a group, which a
|
||||
test compares before and after komorebi to see that the user's settings are
|
||||
put back.
|
||||
- `effect_supported(name)` and `effect_loaded(name)` ask KWin whether an effect is
|
||||
installed (KWin found it when it started) and loaded, and `unload_effect(name)`
|
||||
unloads one, whoever loaded it.
|
||||
- `pixels` reads a screenshot: `pixels.pixel(image, x, y)` is the color of a
|
||||
pixel, `pixels.near(a, b)` compares two colors within a tolerance, since a
|
||||
compositor blends the edge of what it draws, and `pixels.ring(image, frame,
|
||||
color)` names the sides of a window's frame that have no ring of `color` just
|
||||
outside them, which is how a test sees a border.
|
||||
- `kwin_script(name, source, keep=)` runs a KWin script and returns the lines it
|
||||
reported: the script calls `report(...)`, which `print`s a line marked with
|
||||
`name` to KWin's log, and ends with `report("done")`. A script that is kept
|
||||
@@ -161,6 +171,13 @@ Two traps are worth knowing about before writing a screenshot test:
|
||||
on it, so "the screenshot is not blank" passes while Plasma is still
|
||||
starting. `Kde.session` waits for the splash process to exit, and a test
|
||||
should check a pixel it knows, such as the middle of a terminal.
|
||||
- The panel comes after the shell. A window tiled before the panel was made is
|
||||
tiled under it, which hides the bottom of its border from a screenshot, and
|
||||
nothing tiles it again. `Kde.session` waits until the shell has made a panel. KWin takes
|
||||
the room for the panel a while after that, and a daemon learns of it up to a second later: a
|
||||
test that opens windows right after the daemon starts waits with
|
||||
`Kde.wait_for_panel_room` first. It is a wait and not a check, because a session that is too
|
||||
slow may never take the room.
|
||||
- NixOS wraps programs, so a process's name is the wrapper's (`.plasmashell-wrapped`),
|
||||
and `pgrep -x plasmashell` never matches. Match the command line instead, with
|
||||
a bracket in the pattern (`pgrep -f '[p]lasmashell'`) so that the shell running
|
||||
|
||||
Reference in new issue
Block a user