diff --git a/wayneko.1 b/wayneko.1 index e7b7f09..7ab427f 100644 --- a/wayneko.1 +++ b/wayneko.1 @@ -1,4 +1,4 @@ -.TH WAYNEKO 1 2023-08-14 "git.sr.ht/~leon_plickat/wayneko" "General Commands Manual" +.TH WAYNEKO 1 2024-03-24 "git.sr.ht/~leon_plickat/wayneko" "General Commands Manual" . .SH NAME .P @@ -16,6 +16,7 @@ wayneko \- Neko on Wayland .OP \-\-background\-colour 0xRRGGBB[AA] .OP \-\-outline\-colour 0xRRGGBB[AA] .OP \-\-type neko|inu|random +.OP \-\-idle-sleep seconds .OP \-\-layer background|bottom|top|overlay .OP \-\-follow\-pointer true|false .OP \-\-survive\-close @@ -60,6 +61,13 @@ This option lets you choose between neko and her friend inu. .RE . .P +\fB\-\-idle-sleep\fR \fIseconds\fR +.RS +Set the time in seconds after which neko will go to sleep when the user is +idle. +.RE +. +.P \fB\-\-layer\fR \fBbackground\fR|\fBbottom\fR|\fBtop\fR|\fBoverlay\fR .RS Set the layer for the surface. diff --git a/wayneko.c b/wayneko.c index 78578a7..bb540c4 100644 --- a/wayneko.c +++ b/wayneko.c @@ -79,7 +79,7 @@ bool recreate_surface_on_close = false; enum zwlr_layer_shell_v1_layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; struct ext_idle_notifier_v1 *idle_notifier = NULL; -const uint32_t neko_idle_timeout_ms = 180000; /* 3 minutes. */ // TODO make configurable +uint32_t neko_idle_timeout_ms = 180000; /* 3 minutes. */ struct Seat { @@ -1414,6 +1414,18 @@ int main (int argc, char *argv[]) else if ( strcmp(a, "overlay") == 0 ) layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; } + else if ( strcmp(argv[i], "--idle-sleep") == 0 ) + { + const char *a = get_argument(argc, argv, &i); + int timeout = atoi(a); + if (timeout > 0) + neko_idle_timeout_ms = (uint32_t) timeout * 1000; + else + { + fprintf(stderr, "ERROR: Invalid argument '%s' for flag '--idle-sleep'.\n", a); + return EXIT_FAILURE; + } + } else { fprintf(stderr, "ERROR: Unknown option: %s\n", argv[i]);