From bcc61e5147fb57a3b4bfb9a2a33065a0cf6da67b Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Fri, 12 Oct 2018 20:32:48 +0100 Subject: swaybar: handle mode/hidden_state changes As well as adding the hidden_state property to the bar config struct, this commit handles barconfig_update events when the mode or hidden_state changes, and uses a new function determine_bar_visibility to hide or show the bar as required, using, respectively, destroy_layer_surface, which is also newly added, and add_layer_surface, which has been changed to allow dynamically adding the surface. --- swaybar/render.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'swaybar/render.c') diff --git a/swaybar/render.c b/swaybar/render.c index d226ba32..670630cf 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -494,6 +494,9 @@ static const struct wl_callback_listener output_frame_listener = { void render_frame(struct swaybar_output *output) { assert(output->surface != NULL); + if (!output->layer_surface) { + return; + } free_hotspots(&output->hotspots); @@ -519,7 +522,9 @@ void render_frame(struct swaybar_output *output) { if (height != output->height) { // Reconfigure surface zwlr_layer_surface_v1_set_size(output->layer_surface, 0, height); - zwlr_layer_surface_v1_set_exclusive_zone(output->layer_surface, height); + if (strcmp(output->bar->config->mode, "dock") == 0) { + zwlr_layer_surface_v1_set_exclusive_zone(output->layer_surface, height); + } // TODO: this could infinite loop if the compositor assigns us a // different height than what we asked for wl_surface_commit(output->surface); -- cgit v1.2.3-54-g00ecf