From b48594f150b91471bdbc32e45e462b8e3e4189d9 Mon Sep 17 00:00:00 2001 From: Leon Henrik Plickat Date: Sun, 18 Feb 2024 21:18:06 +0100 Subject: [PATCH] add --layer flag --- wayneko.1 | 11 +++++++++++ wayneko.c | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/wayneko.1 b/wayneko.1 index 7b37b3f..e7b7f09 100644 --- a/wayneko.1 +++ b/wayneko.1 @@ -16,6 +16,7 @@ wayneko \- Neko on Wayland .OP \-\-background\-colour 0xRRGGBB[AA] .OP \-\-outline\-colour 0xRRGGBB[AA] .OP \-\-type neko|inu|random +.OP \-\-layer background|bottom|top|overlay .OP \-\-follow\-pointer true|false .OP \-\-survive\-close .YS @@ -59,6 +60,16 @@ This option lets you choose between neko and her friend inu. .RE . .P +\fB\-\-layer\fR \fBbackground\fR|\fBbottom\fR|\fBtop\fR|\fBoverlay\fR +.RS +Set the layer for the surface. +Defaults to bottom. +Bottom is typically beneath regular windows and top above them. +Overlay is usually displayed even over fullscreen windows. +Background may conflict with wallpaper clients. +.RE +. +.P \fB\-\-follow\-pointer\fR \fBtrue\fR|\fBfalse\fR .RS Set whether neko follows the pointer when it approaches the bottom of the output diff --git a/wayneko.c b/wayneko.c index 13138c2..428bd2b 100644 --- a/wayneko.c +++ b/wayneko.c @@ -31,6 +31,8 @@ const char usage[] = " --background-colour 0xRRGGBB[AA]\n" " --outline-colour 0xRRGGBB[AA]\n" " --type neko|inu|random\n" + " --layer background|bottom|top|overlay\n" + " --follow-pointer true|false\n" " --survive-close\n" "\n"; @@ -73,6 +75,7 @@ enum Neko current_neko = NEKO_STARE; enum Type type = NEKO; bool follow_pointer = true; bool recreate_surface_on_close = false; +enum zwlr_layer_shell_v1_layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; struct Seat { @@ -1097,7 +1100,7 @@ static void surface_create (void) layer_shell, surface.wl_surface, NULL, - ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, + layer, "wayneko" ); @@ -1310,6 +1313,18 @@ int main (int argc, char *argv[]) return EXIT_FAILURE; } } + else if ( strcmp(argv[i], "--layer") == 0 ) + { + const char *a = get_argument(argc, argv, &i); + if ( strcmp(a, "background") == 0 ) + layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; + else if ( strcmp(a, "bottom") == 0 ) + layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; + else if ( strcmp(a, "top") == 0 ) + layer = ZWLR_LAYER_SHELL_V1_LAYER_TOP; + else if ( strcmp(a, "overlay") == 0 ) + layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; + } else { fprintf(stderr, "ERROR: Unknown option: %s\n", argv[i]);