Make idle timeout configurable

This commit is contained in:
Hannes Braun 2024-03-24 15:59:07 +01:00 committed by Leon Henrik Plickat
commit 2c10d982e7
Failed to generate hash of commit
2 changed files with 22 additions and 2 deletions

View file

@ -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 .SH NAME
.P .P
@ -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 \-\-idle-sleep seconds
.OP \-\-layer background|bottom|top|overlay .OP \-\-layer background|bottom|top|overlay
.OP \-\-follow\-pointer true|false .OP \-\-follow\-pointer true|false
.OP \-\-survive\-close .OP \-\-survive\-close
@ -60,6 +61,13 @@ This option lets you choose between neko and her friend inu.
.RE .RE
. .
.P .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 \fB\-\-layer\fR \fBbackground\fR|\fBbottom\fR|\fBtop\fR|\fBoverlay\fR
.RS .RS
Set the layer for the surface. Set the layer for the surface.

View file

@ -79,7 +79,7 @@ bool recreate_surface_on_close = false;
enum zwlr_layer_shell_v1_layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; enum zwlr_layer_shell_v1_layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
struct ext_idle_notifier_v1 *idle_notifier = NULL; 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 struct Seat
{ {
@ -1414,6 +1414,18 @@ int main (int argc, char *argv[])
else if ( strcmp(a, "overlay") == 0 ) else if ( strcmp(a, "overlay") == 0 )
layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; 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 else
{ {
fprintf(stderr, "ERROR: Unknown option: %s\n", argv[i]); fprintf(stderr, "ERROR: Unknown option: %s\n", argv[i]);