add --layer flag

This commit is contained in:
Leon Henrik Plickat 2024-02-18 21:18:06 +01:00
commit b48594f150
2 changed files with 27 additions and 1 deletions

View file

@ -16,6 +16,7 @@ wayneko \- Neko on Wayland
.OP \-\-background\-colour 0xRRGGBB[AA] .OP \-\-background\-colour 0xRRGGBB[AA]
.OP \-\-outline\-colour 0xRRGGBB[AA] .OP \-\-outline\-colour 0xRRGGBB[AA]
.OP \-\-type neko|inu|random .OP \-\-type neko|inu|random
.OP \-\-layer background|bottom|top|overlay
.OP \-\-follow\-pointer true|false .OP \-\-follow\-pointer true|false
.OP \-\-survive\-close .OP \-\-survive\-close
.YS .YS
@ -59,6 +60,16 @@ This option lets you choose between neko and her friend inu.
.RE .RE
. .
.P .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 \fB\-\-follow\-pointer\fR \fBtrue\fR|\fBfalse\fR
.RS .RS
Set whether neko follows the pointer when it approaches the bottom of the output Set whether neko follows the pointer when it approaches the bottom of the output

View file

@ -31,6 +31,8 @@ const char usage[] =
" --background-colour 0xRRGGBB[AA]\n" " --background-colour 0xRRGGBB[AA]\n"
" --outline-colour 0xRRGGBB[AA]\n" " --outline-colour 0xRRGGBB[AA]\n"
" --type neko|inu|random\n" " --type neko|inu|random\n"
" --layer background|bottom|top|overlay\n"
" --follow-pointer true|false\n"
" --survive-close\n" " --survive-close\n"
"\n"; "\n";
@ -73,6 +75,7 @@ enum Neko current_neko = NEKO_STARE;
enum Type type = NEKO; enum Type type = NEKO;
bool follow_pointer = true; bool follow_pointer = true;
bool recreate_surface_on_close = false; bool recreate_surface_on_close = false;
enum zwlr_layer_shell_v1_layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
struct Seat struct Seat
{ {
@ -1097,7 +1100,7 @@ static void surface_create (void)
layer_shell, layer_shell,
surface.wl_surface, surface.wl_surface,
NULL, NULL,
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, layer,
"wayneko" "wayneko"
); );
@ -1310,6 +1313,18 @@ int main (int argc, char *argv[])
return EXIT_FAILURE; 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 else
{ {
fprintf(stderr, "ERROR: Unknown option: %s\n", argv[i]); fprintf(stderr, "ERROR: Unknown option: %s\n", argv[i]);