mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-19 19:25:41 +02:00
config: layer: add 'overlay' and 'background'
The layer option (Wayland only) now accepts 'overlay' and 'background'. Closes #372
This commit is contained in:
parent
28a18ad91e
commit
d841aeeecd
6 changed files with 34 additions and 7 deletions
|
@ -20,8 +20,11 @@
|
|||
* network: new `quality` tag (Wi-Fi only).
|
||||
* Read alternative config from pipes and FIFOs (e.g. `--config
|
||||
/dev/stdin`) ([#340][340]).
|
||||
* Added `overlay` and `background` as possible `layer` values
|
||||
([#372][372]).
|
||||
|
||||
[340]: https://codeberg.org/dnkl/yambar/pulls/340
|
||||
[372]: https://codeberg.org/dnkl/yambar/issues/372
|
||||
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -18,7 +18,7 @@ struct bar {
|
|||
};
|
||||
|
||||
enum bar_location { BAR_TOP, BAR_BOTTOM };
|
||||
enum bar_layer { BAR_LAYER_TOP, BAR_LAYER_BOTTOM };
|
||||
enum bar_layer { BAR_LAYER_OVERLAY, BAR_LAYER_TOP, BAR_LAYER_BOTTOM, BAR_LAYER_BACKGROUND };
|
||||
enum bar_backend { BAR_BACKEND_AUTO, BAR_BACKEND_XCB, BAR_BACKEND_WAYLAND };
|
||||
|
||||
struct bar_config {
|
||||
|
|
|
@ -814,9 +814,26 @@ create_surface(struct wayland_backend *backend)
|
|||
|
||||
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;
|
||||
|
||||
enum zwlr_layer_shell_v1_layer layer;
|
||||
|
||||
switch (bar->layer) {
|
||||
case BAR_LAYER_BACKGROUND:
|
||||
layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND;
|
||||
break;
|
||||
|
||||
case BAR_LAYER_BOTTOM:
|
||||
layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
|
||||
break;
|
||||
|
||||
case BAR_LAYER_TOP:
|
||||
layer = ZWLR_LAYER_SHELL_V1_LAYER_TOP;
|
||||
break;
|
||||
|
||||
case BAR_LAYER_OVERLAY:
|
||||
layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY;
|
||||
break;
|
||||
}
|
||||
|
||||
backend->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
|
||||
backend->layer_shell, backend->surface,
|
||||
|
|
|
@ -453,7 +453,9 @@ verify_bar_location(keychain_t *chain, const struct yml_node *node)
|
|||
static bool
|
||||
verify_bar_layer(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
return conf_verify_enum(chain, node, (const char *[]){"top", "bottom"}, 2);
|
||||
return conf_verify_enum(
|
||||
chain, node,
|
||||
(const char *[]){"overlay", "top", "bottom", "background"}, 4);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
6
config.c
6
config.c
|
@ -340,10 +340,14 @@ conf_to_bar(const struct yml_node *bar, enum bar_backend backend)
|
|||
const struct yml_node *layer = yml_get_value(bar, "layer");
|
||||
if (layer != NULL) {
|
||||
const char *tmp = yml_value_as_string(layer);
|
||||
if (strcmp(tmp, "top") == 0)
|
||||
if (strcmp(tmp, "overlay") == 0)
|
||||
conf.layer = BAR_LAYER_OVERLAY;
|
||||
else if (strcmp(tmp, "top") == 0)
|
||||
conf.layer = BAR_LAYER_TOP;
|
||||
else if (strcmp(tmp, "bottom") == 0)
|
||||
conf.layer = BAR_LAYER_BOTTOM;
|
||||
else if (strcmp(tmp, "background") == 0)
|
||||
conf.layer = BAR_LAYER_BACKGROUND;
|
||||
else
|
||||
assert(false);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,8 @@ types that are frequently used:
|
|||
| layer
|
||||
: string
|
||||
: no
|
||||
: Layer to put bar on. One of _top_ or _bottom_. Wayland only
|
||||
: Layer to put bar on. One of _overlay_, _top_, _bottom_ or
|
||||
_background_. Wayland only. Default: _bottom_.
|
||||
| left-spacing
|
||||
: int
|
||||
: no
|
||||
|
|
Loading…
Add table
Reference in a new issue