mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-12-05 06:26:30 +01:00
feat(kwin): sleep, wake and lock
While the screen is locked or the machine is asleep, KWin sends its clients no frame callbacks, so nothing komorebi asked for in that time is done: a window that something else moved stays where it was moved, and the monitors can come back in another order or at another size. Nothing told komorebi it had happened, and it kept the layout it had until the next event. kwin::power now watches for the two ends of it: logind's PrepareForSleep on the system bus, which only logind may send, and the lock screen's ActiveChanged on the session bus. When the machine wakes (2.5 seconds after it, while the outputs are found one after another) or the screen is unlocked (0.6 seconds after it, once the lock screen has gone), the monitor reconciliator gets a Wake and calls wake_up: it reconciles the monitors as for an unplug, reads their sizes, follows the windows to the monitors they are on and tiles every monitor, unless the window manager is paused. Going to sleep and locking do nothing, and a machine with no system bus or a session with no lock screen runs without them. The lock screen is a window of KWin's that the bridge already does not report as an application window, so it has no tile. The bridge also compares KWin's active window with the one it last announced once a second, because the window that is active again after an unlock is not always announced. vm-lock-sleep locks and unlocks a real Plasma session and checks that the windows come back to their tiles; a real suspend cannot be tested in the QEMU guest, only the signal wiring, which tests/power.rs covers on private buses. vm-lock-sleep waits for the panel's room before it opens the windows, so that they are tiled once, and compares the window that was moved with the tile the daemon has for it when it looks, give or take a cell of the terminal's font, and not with the frames read earlier: the room can come while the screen is locked, and the tiles read before are then not the ones. The wait is not a check, because a session on a machine as slow as TCG may never take the room.
This commit is contained in:
1 parent
40eec2f6be
commit
0210ec285a
17 files changed
+913
-26
No files matched your search
@@ -82,11 +82,11 @@ without a checkout of the toolchain.
|
||||
some elements are locked in place. It answers the messages on the daemon's
|
||||
socket (`core::SocketMessage`, `process_command`), shows its state (`state`),
|
||||
keeps the monitors in step with the compositor's outputs as they change size
|
||||
and are unplugged and plugged in (`monitor_reconciliator`, `reconcile`),
|
||||
sends its subscribers a notification of each event, message and change of
|
||||
the monitors it handles (`notify_subscribers`), and is configured by a
|
||||
`komorebi.json` that it reads and reads again when it changes
|
||||
(`static_config`).
|
||||
and are unplugged and plugged in, and when the machine wakes or the screen is
|
||||
unlocked (`monitor_reconciliator`, `reconcile`, `kwin::power`), sends its
|
||||
subscribers a notification of each event, message and change of the monitors
|
||||
it handles (`notify_subscribers`), and is configured by a `komorebi.json` that
|
||||
it reads and reads again when it changes (`static_config`).
|
||||
- [`komorebi-client`](komorebi-client): a library that sends messages to the
|
||||
daemon, reads its answers, subscribes to its notifications, and re-exports
|
||||
the types they are made of.
|
||||
@@ -127,6 +127,8 @@ they need from KWin.
|
||||
`just check` runs the formatting check, clippy with warnings denied, the tests,
|
||||
rustdoc with warnings denied, and the type check and tests of the bridge (no
|
||||
package.json: `tsc` and `node` come from the dev shell), inside `nix develop`.
|
||||
The test of the signals for sleep and lock starts private D-Bus buses with
|
||||
`dbus-daemon`, which the dev shell has, and does nothing where there is none.
|
||||
`nix flake check` runs the same checks as derivations, plus `cargo deny`, the
|
||||
TOML and Nix formatting, the tests under `cargo nextest`, and
|
||||
`nixos-module-eval`, which evaluates the NixOS module in real NixOS systems, on
|
||||
@@ -177,6 +179,14 @@ plugged in again. A window that something else moves to another output (a
|
||||
shortcut, an application, KWin itself) is followed to the workspace of the same
|
||||
number on that monitor and tiled there.
|
||||
|
||||
While the screen is locked or the machine is asleep KWin sends its clients no
|
||||
frame callbacks, so what the daemon asked for in that time is not done. The
|
||||
daemon watches for the machine waking up (logind's `PrepareForSleep`) and for
|
||||
the lock screen going away (`org.freedesktop.ScreenSaver`), and then looks at
|
||||
the monitors and at where every window is, and puts each in its tile. The lock
|
||||
screen is a window of KWin's that the bridge does not report as an application
|
||||
window, so it has no tile.
|
||||
|
||||
The window manager models the desktop as monitors, each with a ring of
|
||||
workspaces, each with a ring of containers, each with a ring of windows. A
|
||||
workspace's layout gives each of its containers a tile of the monitor's work
|
||||
|
||||
Reference in new issue
Block a user