configurable layer shell setup

This commit is contained in:
Raphael Robatsch 2021-10-21 08:28:22 +02:00
parent 9b72acd912
commit b60462feb6
2 changed files with 6 additions and 2 deletions

View file

@ -15,9 +15,12 @@ const zwlr_layer_surface_v1_listener Bar::_layerSurfaceListener = {
Bar::Bar(const wl_output *output)
{
_surface = wl_compositor_create_surface(compositor);
_layerSurface = zwlr_layer_shell_v1_get_layer_surface(wlrLayerShell, _surface, nullptr, ZWLR_LAYER_SHELL_V1_LAYER_TOP, "net.tapesoftware.Somebar");
_layerSurface = zwlr_layer_shell_v1_get_layer_surface(wlrLayerShell,
_surface, nullptr, ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, "net.tapesoftware.Somebar");
zwlr_layer_surface_v1_add_listener(_layerSurface, &_layerSurfaceListener, this);
zwlr_layer_surface_v1_set_anchor(_layerSurface, ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT);
auto anchor = topbar ? ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP : ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
zwlr_layer_surface_v1_set_anchor(_layerSurface,
anchor | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT);
zwlr_layer_surface_v1_set_size(_layerSurface, 0, barSize);
zwlr_layer_surface_v1_set_exclusive_zone(_layerSurface, barSize);
wl_surface_commit(_surface);

View file

@ -2,3 +2,4 @@
// See LICENSE file for copyright and license details.
constexpr int barSize = 20;
constexpr bool topbar = 1;