swaybar: when hiding bar, save old height to be restored upon reshow
Previously, when the bar was hidden, the height would be set to 0. This meant that if the bar was empty upon reshow, it would not render since the height was still 0, which made it seem there was a problem. Now, the height is not reset, but the width is, to indicate upon reshow that the layer surface needed reconfiguring.
This commit is contained in:
parent
a29ee77411
commit
4dba7c084a
|
@ -367,7 +367,6 @@ static void destroy_layer_surface(struct swaybar_output *output) {
|
||||||
zwlr_layer_surface_v1_destroy(output->layer_surface);
|
zwlr_layer_surface_v1_destroy(output->layer_surface);
|
||||||
wl_surface_attach(output->surface, NULL, 0, 0); // detach buffer
|
wl_surface_attach(output->surface, NULL, 0, 0); // detach buffer
|
||||||
output->layer_surface = NULL;
|
output->layer_surface = NULL;
|
||||||
output->height = 0;
|
|
||||||
output->width = 0;
|
output->width = 0;
|
||||||
output->frame_scheduled = false;
|
output->frame_scheduled = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,7 +519,7 @@ void render_frame(struct swaybar_output *output) {
|
||||||
if (config_height >= 0 && height < (uint32_t)config_height) {
|
if (config_height >= 0 && height < (uint32_t)config_height) {
|
||||||
height = config_height;
|
height = config_height;
|
||||||
}
|
}
|
||||||
if (height != output->height) {
|
if (height != output->height || output->width == 0) {
|
||||||
// Reconfigure surface
|
// Reconfigure surface
|
||||||
zwlr_layer_surface_v1_set_size(output->layer_surface, 0, height);
|
zwlr_layer_surface_v1_set_size(output->layer_surface, 0, height);
|
||||||
if (strcmp(output->bar->config->mode, "dock") == 0) {
|
if (strcmp(output->bar->config->mode, "dock") == 0) {
|
||||||
|
|
Loading…
Reference in a new issue