aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/swaybar/bar.h1
-rw-r--r--sway/commands/bar/mode.c2
-rw-r--r--sway/sway-bar.5.scd6
-rw-r--r--swaybar/bar.c16
4 files changed, 21 insertions, 4 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h
index dfadc200..031993b5 100644
--- a/include/swaybar/bar.h
+++ b/include/swaybar/bar.h
@@ -58,6 +58,7 @@ struct swaybar_output {
58 struct zxdg_output_v1 *xdg_output; 58 struct zxdg_output_v1 *xdg_output;
59 struct wl_surface *surface; 59 struct wl_surface *surface;
60 struct zwlr_layer_surface_v1 *layer_surface; 60 struct zwlr_layer_surface_v1 *layer_surface;
61 struct wl_region *input_region;
61 uint32_t wl_name; 62 uint32_t wl_name;
62 63
63 struct wl_list workspaces; // swaybar_workspace::link 64 struct wl_list workspaces; // swaybar_workspace::link
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index 68a80abf..1081ad4b 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -20,6 +20,8 @@ static struct cmd_results *bar_set_mode(struct bar_config *bar, const char *mode
20 bar->mode = strdup("hide"); 20 bar->mode = strdup("hide");
21 } else if (strcasecmp("invisible", mode) == 0) { 21 } else if (strcasecmp("invisible", mode) == 0) {
22 bar->mode = strdup("invisible"); 22 bar->mode = strdup("invisible");
23 } else if (strcasecmp("overlay", mode) == 0) {
24 bar->mode = strdup("overlay");
23 } else { 25 } else {
24 return cmd_results_new(CMD_INVALID, "Invalid value %s", mode); 26 return cmd_results_new(CMD_INVALID, "Invalid value %s", mode);
25 } 27 }
diff --git a/sway/sway-bar.5.scd b/sway/sway-bar.5.scd
index 13827e5e..1f4ceaf2 100644
--- a/sway/sway-bar.5.scd
+++ b/sway/sway-bar.5.scd
@@ -84,11 +84,13 @@ Sway allows configuring swaybar in the sway configuration file.
84 debug-events`. To disable the default behavior for a button, use the 84 debug-events`. To disable the default behavior for a button, use the
85 command _nop_. 85 command _nop_.
86 86
87*mode* dock|hide|invisible 87*mode* dock|hide|invisible|overlay
88 Specifies the visibility of the bar. In _dock_ mode, it is permanently 88 Specifies the visibility of the bar. In _dock_ mode, it is permanently
89 visible at one edge of the screen. In _hide_ mode, it is hidden unless the 89 visible at one edge of the screen. In _hide_ mode, it is hidden unless the
90 modifier key is pressed, though this behaviour depends on the hidden state. 90 modifier key is pressed, though this behaviour depends on the hidden state.
91 In _invisible_ mode, it is permanently hidden. Default is _dock_. 91 In _invisible_ mode, it is permanently hidden. In _overlay_ mode, it is
92 permanently visible on top of other windows. (In _overlay_ mode the bar is
93 transparent to input events.) Default is _dock_.
92 94
93*hidden_state* hide|show 95*hidden_state* hide|show
94 Specifies the behaviour of the bar when it is in _hide_ mode. When the 96 Specifies the behaviour of the bar when it is in _hide_ mode. When the
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}