Skip to content

Commit 9d2235f

Browse files
committed
Add suppport for displaying Waybar as an overlay layer
Configuration option `layer` can now take a value "overlay", which draws the bar on top of the windows without creating an exclusive zone.
1 parent 2277ddd commit 9d2235f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/bar.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,11 @@ void waybar::Bar::onMap(GdkEventAny* ev) {
146146
surface = gdk_wayland_window_get_wl_surface(gdk_window);
147147

148148
auto client = waybar::Client::inst();
149-
auto layer =
150-
config["layer"] == "top" ? ZWLR_LAYER_SHELL_V1_LAYER_TOP : ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
149+
int layer =
150+
config["layer"] == "bottom" ? ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM : ZWLR_LAYER_SHELL_V1_LAYER_TOP;
151+
if (config["layer"] == "overlay")
152+
layer |= ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY;
153+
151154
layer_surface = zwlr_layer_shell_v1_get_layer_surface(
152155
client->layer_shell, surface, output->output, layer, "waybar");
153156

@@ -170,7 +173,7 @@ void waybar::Bar::onMap(GdkEventAny* ev) {
170173

171174
void waybar::Bar::setExclusiveZone(uint32_t width, uint32_t height) {
172175
auto zone = 0;
173-
if (visible) {
176+
if (visible && config["layer"] != "overlay") {
174177
// exclusive zone already includes margin for anchored edge,
175178
// only opposite margin should be added
176179
if (vertical) {

0 commit comments

Comments
 (0)