From 592e4271338fe7f8cc6a67f6e2bd8a703b9bbfa6 Mon Sep 17 00:00:00 2001 From: Scoopta Date: Mon, 27 Jul 2020 21:49:21 -0700 Subject: [PATCH] Added layer config option --- man/wofi.5 | 3 +++ src/wofi.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/man/wofi.5 b/man/wofi.5 index 6e77e68..e0f89a7 100644 --- a/man/wofi.5 +++ b/man/wofi.5 @@ -174,6 +174,9 @@ Specifies whether the search bar should be hidden. Default is false. .TP .B dynamic_lines=\fIBOOL\fR Specifies whether wofi should be dynamically shrunk to fit the number of visible lines or if it should always stay the same size. Default is false. +.TP +.B layer=\fILAYER\fR +Specifies the layer to open on. The options are background, bottom, top, and overlay. Default is top .SH CSS SELECTORS Any GTK widget can be selected by using the name of its CSS node, these however might change with updates and are not guaranteed to stay constant. Wofi also provides certain widgets with names and classes which can be referenced from CSS to give access to the most important widgets easily. \fBwofi\fR(7) contains the current widget layout used by wofi so if you want to get into CSS directly using GTK widget names look there for info. diff --git a/src/wofi.c b/src/wofi.c index 8d68fb5..fdedb6a 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -1618,6 +1618,7 @@ void wofi_init(struct map* _config) { char* search = map_get(config, "search"); dynamic_lines = strcmp(config_get(config, "dynamic_lines", "false"), "true") == 0; char* monitor = map_get(config, "monitor"); + char* layer = config_get(config, "layer", "top"); keys = map_init_void(); @@ -1728,7 +1729,19 @@ void wofi_init(struct map* _config) { gdk_wayland_window_set_use_custom_surface(gdk_win); wl_surface = gdk_wayland_window_get_wl_surface(gdk_win); - wlr_surface = zwlr_layer_shell_v1_get_layer_surface(shell, wl_surface, output, ZWLR_LAYER_SHELL_V1_LAYER_TOP, "wofi"); + enum zwlr_layer_shell_v1_layer wlr_layer; + + if(strcmp(layer, "background") == 0) { + wlr_layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; + } else if(strcmp(layer, "bottom") == 0) { + wlr_layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; + } else if(strcmp(layer, "top") == 0) { + wlr_layer = ZWLR_LAYER_SHELL_V1_LAYER_TOP; + } else if(strcmp(layer, "overlay") == 0) { + wlr_layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; + } + + wlr_surface = zwlr_layer_shell_v1_get_layer_surface(shell, wl_surface, output, wlr_layer, "wofi"); struct zwlr_layer_surface_v1_listener* surface_listener = malloc(sizeof(struct zwlr_layer_surface_v1_listener)); surface_listener->configure = config_surface; surface_listener->closed = nop;