Add layer option

Only applies to Wayland and the default is still bottom.
This commit is contained in:
Nulo 2021-08-25 13:20:33 -03:00 committed by Daniel Eklöf
parent 7e7c011126
commit eb94c8cceb
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
8 changed files with 35 additions and 1 deletions

View file

@ -433,6 +433,7 @@ bar_new(const struct bar_config *config)
struct private *priv = calloc(1, sizeof(*priv));
priv->monitor = config->monitor != NULL ? strdup(config->monitor) : NULL;
priv->layer = config->layer;
priv->location = config->location;
priv->height = config->height;
priv->background = config->background;

View file

@ -17,12 +17,14 @@ struct bar {
};
enum bar_location { BAR_TOP, BAR_BOTTOM };
enum bar_layer { BAR_LAYER_TOP, BAR_LAYER_BOTTOM };
enum bar_backend { BAR_BACKEND_AUTO, BAR_BACKEND_XCB, BAR_BACKEND_WAYLAND };
struct bar_config {
enum bar_backend backend;
const char *monitor;
enum bar_layer layer;
enum bar_location location;
int height;
int left_spacing, right_spacing;

View file

@ -6,6 +6,7 @@
struct private {
/* From bar_config */
char *monitor;
enum bar_layer layer;
enum bar_location location;
int height;
int left_spacing, right_spacing;

View file

@ -988,10 +988,14 @@ setup(struct bar *_bar)
wl_surface_add_listener(backend->surface, &surface_listener, backend);
enum zwlr_layer_shell_v1_layer layer = bar->layer == BAR_LAYER_BOTTOM
? ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM
: ZWLR_LAYER_SHELL_V1_LAYER_TOP;
backend->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
backend->layer_shell, backend->surface,
backend->monitor != NULL ? backend->monitor->output : NULL,
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, "panel");
layer, "panel");
if (backend->layer_surface == NULL) {
LOG_ERR("failed to create layer shell surface");