mirror of
https://git.sr.ht/~leon_plickat/wayneko
synced 2025-09-19 07:53:21 +02:00
wayneko now sleeps at night
This commit is contained in:
parent
a4f7f31a37
commit
4a80ed2c09
2 changed files with 11 additions and 0 deletions
|
@ -22,6 +22,7 @@ wayneko \- Neko on Wayland
|
|||
.P
|
||||
Display an animated neko cat on the bottom of an output.
|
||||
Responds to the pointer being near the bottom edge of that output.
|
||||
While most cats are usually active at night, wayneko likes to sleep when it's late.
|
||||
.P
|
||||
Requires the Wayland server to implement \fBzwlr-layer-shell-unstable-v1\fR.
|
||||
.
|
||||
|
|
10
wayneko.c
10
wayneko.c
|
@ -793,6 +793,16 @@ static bool animation_next_state_with_hotspot (uint32_t x)
|
|||
/** Returns true if new frame is needed. */
|
||||
static bool animation_next_state_normal (void)
|
||||
{
|
||||
/* Neko likes to sleep at night. */
|
||||
const long now = time(NULL);
|
||||
struct tm tm = *localtime(&now);
|
||||
if ( tm.tm_hour >= 23 || tm.tm_hour <= 6 )
|
||||
{
|
||||
const bool need_frame = current_neko != NEKO_SLEEP_1 && current_neko != NEKO_SLEEP_2;
|
||||
animation_neko_do_sleep();
|
||||
return need_frame;
|
||||
}
|
||||
|
||||
switch (current_neko)
|
||||
{
|
||||
case NEKO_STARE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue