Skip to content

Commit

Permalink
Add suppport for displaying Waybar as an overlay layer
Browse files Browse the repository at this point in the history
Configuration option `layer` can now take a value "overlay", which draws the bar
on top of the windows without creating an exclusive zone.
  • Loading branch information
nyyManni committed Dec 26, 2019
1 parent 2277ddd commit 9d2235f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,11 @@ void waybar::Bar::onMap(GdkEventAny* ev) {
surface = gdk_wayland_window_get_wl_surface(gdk_window);

auto client = waybar::Client::inst();
auto layer =
config["layer"] == "top" ? ZWLR_LAYER_SHELL_V1_LAYER_TOP : ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
int layer =
config["layer"] == "bottom" ? ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM : ZWLR_LAYER_SHELL_V1_LAYER_TOP;
if (config["layer"] == "overlay")
layer |= ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY;

layer_surface = zwlr_layer_shell_v1_get_layer_surface(
client->layer_shell, surface, output->output, layer, "waybar");

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

void waybar::Bar::setExclusiveZone(uint32_t width, uint32_t height) {
auto zone = 0;
if (visible) {
if (visible && config["layer"] != "overlay") {
// exclusive zone already includes margin for anchored edge,
// only opposite margin should be added
if (vertical) {
Expand Down

0 comments on commit 9d2235f

Please sign in to comment.