forked from virt-mirrors/wayneko
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
|
.P
|
||||||
Display an animated neko cat on the bottom of an output.
|
Display an animated neko cat on the bottom of an output.
|
||||||
Responds to the pointer being near the bottom edge of that 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
|
.P
|
||||||
Requires the Wayland server to implement \fBzwlr-layer-shell-unstable-v1\fR.
|
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. */
|
/** Returns true if new frame is needed. */
|
||||||
static bool animation_next_state_normal (void)
|
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)
|
switch (current_neko)
|
||||||
{
|
{
|
||||||
case NEKO_STARE:
|
case NEKO_STARE:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue