aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar
diff options
context:
space:
mode:
authorLibravatar Milkey Mouse <milkeymouse@meme.institute>2019-02-23 21:59:36 -0800
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-24 20:05:47 -0500
commit2f7247e08a16610228067c9ec34d2b6d897e15fa (patch)
tree7cf9ef96257a196b12620cf3659a45635e818e7b /swaybar
parentadd --i3 flag to hide_edge_borders (diff)
downloadsway-2f7247e08a16610228067c9ec34d2b6d897e15fa.tar.gz
sway-2f7247e08a16610228067c9ec34d2b6d897e15fa.tar.zst
sway-2f7247e08a16610228067c9ec34d2b6d897e15fa.zip
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.c16
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) {
51 if (output->surface != NULL) { 51 if (output->surface != NULL) {
52 wl_surface_destroy(output->surface); 52 wl_surface_destroy(output->surface);
53 } 53 }
54 if (output->input_region != NULL) {
55 wl_region_destroy(output->input_region);
56 }
54 zxdg_output_v1_destroy(output->xdg_output); 57 zxdg_output_v1_destroy(output->xdg_output);
55 wl_output_destroy(output->output); 58 wl_output_destroy(output->output);
56 destroy_buffer(&output->buffers[0]); 59 destroy_buffer(&output->buffers[0]);
@@ -100,16 +103,25 @@ static void add_layer_surface(struct swaybar_output *output) {
100 103
101 struct swaybar_config *config = bar->config; 104 struct swaybar_config *config = bar->config;
102 bool hidden = strcmp(config->mode, "hide") == 0; 105 bool hidden = strcmp(config->mode, "hide") == 0;
106 bool overlay = !hidden && strcmp(config->mode, "overlay") == 0;
103 output->layer_surface = zwlr_layer_shell_v1_get_layer_surface( 107 output->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
104 bar->layer_shell, output->surface, output->output, 108 bar->layer_shell, output->surface, output->output,
105 hidden ? ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY : 109 hidden || overlay ? ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY :
106 ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, "panel"); 110 ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, "panel");
107 assert(output->layer_surface); 111 assert(output->layer_surface);
108 zwlr_layer_surface_v1_add_listener(output->layer_surface, 112 zwlr_layer_surface_v1_add_listener(output->layer_surface,
109 &layer_surface_listener, output); 113 &layer_surface_listener, output);
110 114
115 if (overlay) {
116 // Empty input region
117 output->input_region = wl_compositor_create_region(bar->compositor);
118 assert(output->input_region);
119
120 wl_surface_set_input_region(output->surface, output->input_region);
121 }
122
111 zwlr_layer_surface_v1_set_anchor(output->layer_surface, config->position); 123 zwlr_layer_surface_v1_set_anchor(output->layer_surface, config->position);
112 if (hidden) { 124 if (hidden || overlay) {
113 zwlr_layer_surface_v1_set_exclusive_zone(output->layer_surface, -1); 125 zwlr_layer_surface_v1_set_exclusive_zone(output->layer_surface, -1);
114 } 126 }
115} 127}