diff --git a/wayneko.1 b/wayneko.1 index 7ab427f..6eb8775 100644 --- a/wayneko.1 +++ b/wayneko.1 @@ -17,6 +17,8 @@ wayneko \- Neko on Wayland .OP \-\-outline\-colour 0xRRGGBB[AA] .OP \-\-type neko|inu|random .OP \-\-idle-sleep seconds +.OP \-\-sleepiness num +.OP \-\-sleepiness-night num .OP \-\-layer background|bottom|top|overlay .OP \-\-follow\-pointer true|false .OP \-\-survive\-close @@ -68,6 +70,21 @@ idle. .RE . .P +\fB\-\-sleepiness\fR \fInum\fR +.RS +Set neko's sleepiness as an integer (greater than 0). Higher values make neko +more sleepy. Defaults to 4. +.RE +. +.P +\fB\-\-sleepiness-night\fR \fInum\fR +.RS +Set neko's sleepiness at night as an integer (greater than 0). Higher values +make neko more sleepy. This setting acts as an additional sleepiness on top of +the normal sleepiness. Defaults to 5. +.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 241ebc6..1ee6bcb 100644 --- a/wayneko.c +++ b/wayneko.c @@ -81,6 +81,9 @@ enum zwlr_layer_shell_v1_layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; struct ext_idle_notifier_v1 *idle_notifier = NULL; uint32_t neko_idle_timeout_ms = 180000; /* 3 minutes. */ +int sleepiness = 4; +int sleepiness_night = 5; + struct Seat { struct wl_list link; @@ -919,7 +922,7 @@ static bool animation_next_state_normal (void) * If the neko is already awake, slightly higher chance to stay awake. */ const bool neko_is_sleeping = current_neko == NEKO_SLEEP_1 || current_neko == NEKO_SLEEP_2; - if ( animtation_neko_wants_sleep() && (( neko_is_sleeping && rand() % 5 != 0 ) || ( !neko_is_sleeping && rand() % 2 != 0 )) ) + if ( animtation_neko_wants_sleep() && (( neko_is_sleeping && rand() % sleepiness_night != 0 ) || ( !neko_is_sleeping && rand() % 2 != 0 )) ) { switch (current_neko) { @@ -1008,7 +1011,7 @@ static bool animation_next_state_normal (void) case NEKO_SLEEP_1: case NEKO_SLEEP_2: - if ( rand() % 4 == 0 ) + if ( rand() % sleepiness == 0 ) { if ( rand() % 2 == 0 ) animation_neko_do_shock(); @@ -1429,6 +1432,30 @@ int main (int argc, char *argv[]) return EXIT_FAILURE; } } + else if ( strcmp(argv[i], "--sleepiness") == 0 ) + { + const char *a = get_argument(argc, argv, &i); + int i = atoi(a); + if (i != 0) + sleepiness = abs(i) + 1; + else + { + fprintf(stderr, "ERROR: Invalid argument '%s' for flag '--sleepiness'.\n", a); + return EXIT_FAILURE; + } + } + else if ( strcmp(argv[i], "--sleepiness-night") == 0 ) + { + const char *a = get_argument(argc, argv, &i); + int i = atoi(a); + if (i != 0) + sleepiness_night = abs(i) + 1; + else + { + fprintf(stderr, "ERROR: Invalid argument '%s' for flag '--sleepiness-night'.\n", a); + return EXIT_FAILURE; + } + } else { fprintf(stderr, "ERROR: Unknown option: %s\n", argv[i]);