diff options
author | Milkey Mouse <milkeymouse@meme.institute> | 2019-02-23 21:59:36 -0800 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-02-24 20:05:47 -0500 |
commit | 2f7247e08a16610228067c9ec34d2b6d897e15fa (patch) | |
tree | 7cf9ef96257a196b12620cf3659a45635e818e7b /swaybar | |
parent | 2510e3df384d9ab7b27e66c27371ec44606f5d8e (diff) |
swaybar: add overlay mode (fix #1620)
Overlay mode puts the bar above normal windows and passes through/ignores any
touch/mouse/keyboard events that would be sent to it.
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/bar.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index db1c1222..ca7cd88c 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -51,6 +51,9 @@ static void swaybar_output_free(struct swaybar_output *output) { if (output->surface != NULL) { wl_surface_destroy(output->surface); } + if (output->input_region != NULL) { + wl_region_destroy(output->input_region); + } zxdg_output_v1_destroy(output->xdg_output); wl_output_destroy(output->output); destroy_buffer(&output->buffers[0]); @@ -100,16 +103,25 @@ static void add_layer_surface(struct swaybar_output *output) { struct swaybar_config *config = bar->config; bool hidden = strcmp(config->mode, "hide") == 0; + bool overlay = !hidden && strcmp(config->mode, "overlay") == 0; output->layer_surface = zwlr_layer_shell_v1_get_layer_surface( bar->layer_shell, output->surface, output->output, - hidden ? ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY : + hidden || overlay ? ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY : ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, "panel"); assert(output->layer_surface); zwlr_layer_surface_v1_add_listener(output->layer_surface, &layer_surface_listener, output); + if (overlay) { + // Empty input region + output->input_region = wl_compositor_create_region(bar->compositor); + assert(output->input_region); + + wl_surface_set_input_region(output->surface, output->input_region); + } + zwlr_layer_surface_v1_set_anchor(output->layer_surface, config->position); - if (hidden) { + if (hidden || overlay) { zwlr_layer_surface_v1_set_exclusive_zone(output->layer_surface, -1); } } |