mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 22:01:22 +01:00
feat(wm): subscribe to notifications
A program such as a status bar has to follow the window manager, and so far it could only ask: komorebi on Windows and on macOS sends notifications for that. The daemon now keeps subscribers, each a Unix socket in its data directory that a program listens on, and after each event and each message it handles, it connects to every subscriber and writes the event or the message with the state after it. A subscriber can ask to be sent only what changed the state; a window that is shown and a new subscription are always sent, so a subscriber has the state as soon as it subscribes. A subscriber that cannot be connected to is dropped with its socket file and not tried again, and a stopping daemon closes an empty connection to each one. komorebic gains subscribe-socket and unsubscribe-socket, and komorebi-client subscribe and subscribe_with_options, which bind the socket and subscribe. The tests subscribe through real sockets against the fake desktop: a shown window is sent with the state that has it, a subscriber that filters is not sent a question that changed nothing, and one that is gone is dropped.
This commit is contained in:
1 parent
6f657e53e3
commit
e2d757bbb0
20 files changed
+1078
-25
No files matched your search
@@ -171,3 +171,14 @@ Because the daemon takes no input but its socket. `komorebic` turns a command li
|
||||
message on the socket and, for a question, prints the answer. A key binding, a script and a
|
||||
person at a terminal all drive komorebi the same way, by running `komorebic` (the design
|
||||
notes of komorebi for Mac, linked above).
|
||||
|
||||
## Why does komorebi send notifications to subscribers?
|
||||
|
||||
So that a program such as a status bar can follow the window manager. The README of komorebi
|
||||
for Windows demonstrates a custom status bar integrated through its notifications
|
||||
([Window Manager Event Subscriptions](https://github.com/LGUG2Z/komorebi#window-manager-event-subscriptions)),
|
||||
and komorebi for Mac sends the same notifications to Unix sockets, which is also how
|
||||
`komorebic` talks to its daemon
|
||||
([its README](https://github.com/LGUG2Z/komorebi-for-mac#window-manager-event-subscriptions)).
|
||||
A subscriber here is a Unix socket, as on macOS. The named pipes that komorebi on Windows
|
||||
sends notifications to are not ported, since the socket subscribers do the same.
|
||||
Reference in new issue
Block a user