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

@ -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]);