~emersion/public-inbox

kanshi: Re-evaluate profiles upon monitor unplug event. v1 PROPOSED

Darrel Griët: 1
 Re-evaluate profiles upon monitor unplug event.

 1 files changed, 3 insertions(+), 0 deletions(-)
#978303 .build.yml failed
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/40604/mbox | git am -3
Learn more about email & git

[PATCH kanshi] Re-evaluate profiles upon monitor unplug event. Export this patch

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
kanshi/patches/.build.yml: FAILED in 21s

[Re-evaluate profiles upon monitor unplug event.][0] from [Darrel Griët][1]

[0]: https://lists.sr.ht/~emersion/public-inbox/patches/40604
[1]: mailto:dgriet@gmail.com

✗ #978303 FAILED kanshi/patches/.build.yml https://builds.sr.ht/~emersion/job/978303
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.