mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-19 15:18:40 +01:00
feat(wm): a command socket and the first messages
Until now the daemon tiled what KWin reported and nothing else could reach it. komorebi takes its orders on a socket, as it does on Windows and on macOS: it handles no key itself, and whatever binds keys runs a command that writes a message. The daemon binds komorebi.sock in $XDG_RUNTIME_DIR/komorebi (DATA_DIR), reads one JSON SocketMessage per line on a thread per connection, and handles each message with the window manager locked, as the thread that handles events does. The first messages are the ones the first komorebic needs: State (the window manager as JSON, from state.rs), MonitorInformation, Query with a StateQuery, Retile and Stop. A question is answered on the same connection, and the answer ends when the daemon closes it. Stop unloads the bridge from KWin, removes the socket and exits; so does a stop signal. The socket is bound once the daemon is connected to KWin, so a komorebi that cannot connect, such as a second one in the same session, which the bus refuses, leaves the socket of the one that runs alone. With --fake-backend the daemon answers on its socket with no compositor at all, which is how the tests run it. komorebi-client is the other end: send_message, send_batch and send_query, and the types the messages are made of. Its doctests serve the socket themselves, tests/daemon.rs runs it against a window manager over the fake desktop, and komorebi/tests/socket.rs runs the daemon binary from its start to a Stop.
This commit is contained in:
1 parent
4386003e30
commit
88aa78b874
22 files changed
+1389
-37
No files matched your search
@@ -155,3 +155,12 @@ bus itself: `NameOwnerChanged` says that `org.kde.KWin` has lost its owner, and
|
||||
has a new one. So losing the name counts as every window closing, and getting it back as the
|
||||
moment to load the bridge into the new KWin, which then reports its desktop as it does at
|
||||
start.
|
||||
|
||||
## Why does komorebi take its orders on a socket?
|
||||
|
||||
komorebi responds to two things: what the compositor reports about windows, and the
|
||||
messages it receives on its socket. It handles no keyboard or mouse input. Binding a key to
|
||||
an action is the job of another program, which runs a command that writes a message on the
|
||||
socket. This is the architecture that bspwm made popular on Linux and yabai on macOS, and
|
||||
the one komorebi has on Windows and on macOS
|
||||
([the design notes of komorebi for Mac](https://github.com/LGUG2Z/komorebi-for-mac/blob/master/docs/design.md)).
|
||||
Reference in new issue
Block a user