The output_manager_handle_head() function is only called when a new head is introduced.
This will add a new head to the link structure and try to apply a matching profile.
Whenever a head disapears the head_handle_finished() function is called.
The link structure is updated accordingly but a new profile isn't applied if needed.
This adds this functionallity it may fix https://todo.sr.ht/~emersion/kanshi/61 but this has not been tested with i3. Instead this was tested with Hyprland.
Signed-off-by: Darrel Griët <dgriet@gmail.com>
---
main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/main.c b/main.c
index 202b780..ece21c5 100644
--- a/main.c
+++ b/main.c
@@ -426,6 +426,7 @@ static void head_handle_scale(void *data,
static void head_handle_finished(void *data,
struct zwlr_output_head_v1 *wlr_head) {
struct kanshi_head *head = data;
+ struct kanshi_state *state = head->state;
wl_list_remove(&head->link);
if (zwlr_output_head_v1_get_version(head->wlr_head) >= 3) {
zwlr_output_head_v1_release(head->wlr_head);
@@ -438,6 +439,8 @@ static void head_handle_finished(void *data,
free(head->model);
free(head->serial_number);
free(head);
+
+ try_apply_profiles(state);
}
void head_handle_make(void *data,
--
2.40.0
The compositor is supposed to send a zwlr_output_manager_v1.done event
after any configuration change. IOW, a done event should be sent after
the finished event.
The done event allows the client to handle all of the individual events
in an atomic fashion.