diff --git a/Makefile b/Makefile
index 32d96f0..e12645a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-3.0-only
SDK ?= ../osos-lab/rvx-sdk
OUT ?= build
-extensions := balance crossfeed dsp night-shift playback-log
+extensions := balance crossfeed dsp fast-seek long-audio-fix night-shift playback-log sleep-timer
.PHONY: all $(extensions)
all: $(extensions)
diff --git a/NOTICE b/NOTICE
index 8f60e86..bf30576 100644
--- a/NOTICE
+++ b/NOTICE
@@ -4,7 +4,13 @@ Balance, Crossfeed, DSP and the Night Shift scheduling and gamma code are from
RevolaOS extensions, revision 36d197b180e55a304ea0468de4330c0d07fe715f.
Night Shift derives from kayboll’s RepriseOS work. Playback Log derives from
the work of brilliant-alien and lgreitis in osos-lab. Its Settings artwork is
-from osos-lab commit 10485fa. The original RevolaOS notice follows.
+from osos-lab commit 10485fa. Sleep Timer, Fast Seek and Long Audio Fix are
+from RevolaOS extensions, revision c179e6dc21ea8a32e46bf9af1d0906c8793190e8.
+Sleep Timer is based on kayboll’s RepriseOS Sleep Timer shortcut; Fast Seek
+and Long Audio Fix are the same fixes as kayboll’s RepriseOS pull requests
+63 and 62. Their catalog icons and the Sleep Timer moon are Cupertino Icons
+glyphs (MIT), see the LICENSE.cupertino-icons beside each. The original
+RevolaOS notice follows.
RevolaOS
Copyright (C) 2026 The RevolaOS Authors. GPL-3.0-only.
diff --git a/README.md b/README.md
index c7692aa..aa3881a 100644
--- a/README.md
+++ b/README.md
@@ -6,5 +6,8 @@ This repository hosts the source for these RepriseOS extensions and accepts prop
- [Night Shift](extensions/night-shift/) warms the display manually or automatically from sunset to sunrise.
- [Playback Log](extensions/playback-log/) records listening history for scrobbling and optional detailed reports.
- [Crossfeed](extensions/crossfeed/) blends a little of each stereo channel into the other for headphone listening. It uses the included [DSP library](extensions/dsp/).
+- [Sleep Timer](extensions/sleep-timer/) sets Apple's sleep timer from the Now Playing context menu and shows the minutes left in Now Playing.
+- [Fast Seek](extensions/fast-seek/) makes seeks in long AAC and Apple Lossless files jump to the target instead of stepping through every frame.
+- [Long Audio Fix](extensions/long-audio-fix/) plays AAC and Apple Lossless files longer than 13.5 hours to the end.
To add your extension to the catalog, open a PR following the [submission guide](catalog/README.md). Later releases are picked up automatically.
diff --git a/catalog/sources.toml b/catalog/sources.toml
index 1e88372..5224842 100644
--- a/catalog/sources.toml
+++ b/catalog/sources.toml
@@ -22,3 +22,18 @@ tag_prefix = "playback-log/v"
repo = "RepriseOS/repriseos-extensions"
path = "extensions/dsp"
tag_prefix = "dsp/v"
+
+[fast-seek]
+repo = "RepriseOS/repriseos-extensions"
+path = "extensions/fast-seek"
+tag_prefix = "fast-seek/v"
+
+[long-audio-fix]
+repo = "RepriseOS/repriseos-extensions"
+path = "extensions/long-audio-fix"
+tag_prefix = "long-audio-fix/v"
+
+[sleep-timer]
+repo = "RepriseOS/repriseos-extensions"
+path = "extensions/sleep-timer"
+tag_prefix = "sleep-timer/v"
diff --git a/extensions/fast-seek/Makefile b/extensions/fast-seek/Makefile
new file mode 100644
index 0000000..cb973a7
--- /dev/null
+++ b/extensions/fast-seek/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-3.0-only
+main_SOURCES := main.c
+include $(SDK)/rv.mk
diff --git a/extensions/fast-seek/README.md b/extensions/fast-seek/README.md
new file mode 100644
index 0000000..cdc5d6f
--- /dev/null
+++ b/extensions/fast-seek/README.md
@@ -0,0 +1,15 @@
+# Fast Seek
+
+The same approach as [Seek MP4 audio by chunk instead of sample by sample](https://github.com/RepriseOS/repriseos/pull/63) by kayboll for RepriseOS, arrived at independently.
+
+Apple's MP4 parser seeks an AAC or Apple Lossless file (M4A, M4B) by stepping through every sample to the target, reading the sample-size table from disk in 128 KB windows. A backward seek starts from the first sample. A jump of several hours in an audiobook takes seconds and many disk reads. Chapters, the scrubber and resuming an episode all seek this way.
+
+The extension binds the entry of the sample walk. It finds the chunk holding the target from the in-memory time-to-sample and sample-to-chunk tables and starts the walk at that chunk's first sample, leaving Apple's loop at most a few seconds of audio in iTunes files. Files with more than one edit, or more than one frame length before the target, seek the stock way.
+
+Disabling it restores Apple's walk at once.
+
+| | |
+|---|---|
+| Default | on |
+| Memory | image only |
+| Settings | none |
diff --git a/extensions/fast-seek/assets/LICENSE.cupertino-icons b/extensions/fast-seek/assets/LICENSE.cupertino-icons
new file mode 100644
index 0000000..581f84c
--- /dev/null
+++ b/extensions/fast-seek/assets/LICENSE.cupertino-icons
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 Vladimir Kharlampidi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/extensions/fast-seek/assets/settings-fast-seek.png b/extensions/fast-seek/assets/settings-fast-seek.png
new file mode 100644
index 0000000..80b782f
Binary files /dev/null and b/extensions/fast-seek/assets/settings-fast-seek.png differ
diff --git a/extensions/fast-seek/assets/settings-fast-seek.svg b/extensions/fast-seek/assets/settings-fast-seek.svg
new file mode 100644
index 0000000..37928d2
--- /dev/null
+++ b/extensions/fast-seek/assets/settings-fast-seek.svg
@@ -0,0 +1,5 @@
+
diff --git a/extensions/fast-seek/listing.toml b/extensions/fast-seek/listing.toml
new file mode 100644
index 0000000..b7b0b9f
--- /dev/null
+++ b/extensions/fast-seek/listing.toml
@@ -0,0 +1,3 @@
+details = "Seek, pick a chapter or resume in a long AAC or Apple Lossless file (M4A, M4B). Playback continues at the target right away instead of after a long pause. Nothing is added to the menus."
+
+icon = "assets/settings-fast-seek.png"
diff --git a/extensions/fast-seek/main.c b/extensions/fast-seek/main.c
new file mode 100644
index 0000000..fe56917
--- /dev/null
+++ b/extensions/fast-seek/main.c
@@ -0,0 +1,152 @@
+/* SPDX-License-Identifier: GPL-3.0-only */
+
+/* The same approach as RepriseOS pull request 63 by kayboll, arrived at
+ * independently. */
+
+/* Apple's MP4 parser seeks by stepping through every sample from its current
+ * position, or from the first sample when the target lies behind, until the
+ * presentation time reaches the target: about 155 instructions per AAC frame and
+ * a 128 KB table read every 32,768 frames. This handler runs at the entry of
+ * that walk (MP4Parser_SeekAudioTrack), works out from the time-to-sample and
+ * sample-to-chunk runs which chunk holds the target, moves the track state to
+ * that chunk's first sample and lets Apple's loop finish the chunk, loading the
+ * table windows as it always does. Tables outside the plain shape (several
+ * edits, several time-to-sample runs before the target, windows not at the
+ * table start) leave the walk to Apple. */
+
+#include "osos-2.0.5.h"
+#include "rv_api.h"
+#include "rv_sites.h"
+#include "rv_ui.h"
+
+static const struct rv_api *api;
+
+static uint32_t word(const void *base, uint32_t offset)
+{
+ return RV_FIELD(base, offset, uint32_t);
+}
+
+static uint64_t pair(const void *base, uint32_t offset)
+{
+ return (uint64_t)word(base, offset + 4) << 32 | word(base, offset);
+}
+
+static void set_pair(void *base, uint32_t offset, uint64_t value)
+{
+ RV_FIELD(base, offset, uint32_t) = (uint32_t)value;
+ RV_FIELD(base, offset + 4, uint32_t) = (uint32_t)(value >> 32);
+}
+
+/* a × b for b below 2^16 (timescales and frame lengths), without the 64-bit
+ * multiply helper. */
+static uint64_t mul(uint32_t a, uint32_t b)
+{
+ uint32_t low = (a & 0xffff) * b, high = (a >> 16) * b;
+ return ((uint64_t)(high >> 16) << 32) + ((uint64_t)(high & 0xffff) << 16) + low;
+}
+
+/* Move the audio track to the first sample of the chunk that holds the seek
+ * target, when the tables allow it. Samples and chunks are 1-based, as in the
+ * track state. */
+static void position(uint8_t *parser, uint32_t ms)
+{
+ uint8_t *track = RV_FIELD(parser, MP4Parser_audio_track, uint8_t *);
+ /* Apple's walk returns at once for a track without a chunk offset atom. */
+ if (!track || pair(track, MP4Track_chunk_offset_atom) == UINT64_MAX)
+ return;
+ const uint8_t *sizes = RV_FIELD(track, MP4Track_sample_sizes, const uint8_t *);
+ const uint8_t *chunks = RV_FIELD(track, MP4Track_chunk_offsets, const uint8_t *);
+ const uint8_t *runs = RV_FIELD(track, MP4Track_sample_to_chunk, const uint8_t *);
+ const uint8_t *times = RV_FIELD(track, MP4Track_time_to_sample, const uint8_t *);
+ const uint8_t *edits = RV_FIELD(track, MP4Track_edits, const uint8_t *);
+ uint32_t timescale = word(track, MP4Track_timescale);
+ if (!sizes || !chunks || !runs || !times || !timescale || timescale > 0xffff)
+ return;
+ uint32_t run_count = word(runs, MP4SampleTable_count);
+ if (word(times, MP4SampleTable_window_first) ||
+ !word(times, MP4SampleTable_count) || word(runs, MP4SampleTable_window_first) ||
+ !run_count || run_count > MP4_SampleToChunkWindow)
+ return;
+ /* One edit, already the current one: presentation time starts at its media start. */
+ uint64_t edit_start = 0;
+ if (edits) {
+ if (word(edits, MP4EditList_count) != 1 || word(track, MP4Track_edit_index))
+ return;
+ edit_start = pair(track, MP4Track_edit_media_start);
+ if (edit_start == UINT64_MAX)
+ return;
+ }
+ /* Only the first time-to-sample run; a target past it stays with Apple. */
+ const uint8_t *time = RV_FIELD(times, MP4SampleTable_window, const uint8_t *);
+ uint32_t delta = word(time, MP4TimeToSampleEntry_delta);
+ uint32_t in_run = word(time, MP4TimeToSampleEntry_count);
+ if (!delta || delta > 0xffff)
+ return;
+ /* The first sample inside the edit, and the sample at which Apple's loop stops,
+ * rounded down: the loop can only move forward from where it is put. */
+ uint64_t target = Runtime_UDiv64(mul(ms, timescale), 1000);
+ uint64_t first = Runtime_UDiv64(edit_start + delta - 1, delta) + 1;
+ uint64_t stop = first - 1 + Runtime_UDiv64(target, delta);
+ if (stop < 1 || stop > in_run || stop > word(sizes, MP4SampleSizeTable_count))
+ return;
+ /* The chunk holding `stop`, from the sample-to-chunk runs. */
+ const uint8_t *run = RV_FIELD(runs, MP4SampleTable_window, const uint8_t *);
+ uint32_t chunk_count = word(chunks, MP4SampleTable_count);
+ uint32_t index = (uint32_t)stop - 1, before = 0, run_index = 0, chunk, chunk_first;
+ for (;; run_index++, run += MP4SampleToChunkEntry_bytes) {
+ uint32_t from = word(run, MP4SampleToChunkEntry_first_chunk);
+ uint32_t per = word(run, MP4SampleToChunkEntry_samples_per_chunk);
+ uint32_t until = run_index + 1 < run_count
+ ? word(run + MP4SampleToChunkEntry_bytes,
+ MP4SampleToChunkEntry_first_chunk)
+ : chunk_count + 1;
+ if (!per || until <= from)
+ return;
+ uint32_t span = (until - from) * per;
+ if (index - before < span) {
+ chunk = from + (index - before) / per;
+ chunk_first = before + (chunk - from) * per + 1;
+ break;
+ }
+ before += span;
+ if (run_index + 1 >= run_count)
+ return;
+ }
+ /* Already inside the stretch Apple would walk forward: leave it. */
+ uint32_t sample = word(track, MP4Track_sample);
+ if (sample >= chunk_first && sample <= stop)
+ return;
+ RV_FIELD(track, MP4Track_sample, uint32_t) = chunk_first;
+ RV_FIELD(track, MP4Track_sample_to_chunk_index, uint32_t) = run_index;
+ RV_FIELD(track, MP4Track_chunk, uint32_t) = chunk;
+ RV_FIELD(track, MP4Track_sample_in_chunk, uint32_t) = 0;
+ RV_FIELD(track, MP4Track_chunk_byte_offset, uint32_t) = 0;
+ RV_FIELD(track, MP4Track_time_to_sample_index, uint32_t) = 0;
+ RV_FIELD(track, MP4Track_time_to_sample_run, uint32_t) = chunk_first - 1;
+ set_pair(track, MP4Track_decode_time, mul(chunk_first - 1, delta));
+ set_pair(track, MP4Track_presentation_time,
+ chunk_first > first ? mul(chunk_first - (uint32_t)first, delta) : 0);
+}
+
+static uint32_t on_seek(uint8_t *parser, uint32_t ms, const void *next)
+{
+ position(parser, ms);
+ return api->hook_next(next, (uint32_t)parser, ms, 0, 0, 0, 0);
+}
+
+static const struct rv_hook hooks[] = {
+ RV_HOOK_FILTER(RV_SITE_MP4Parser_SeekAudioTrack_entry, on_seek),
+};
+
+static const struct rv_descriptor extension = {
+ .size = sizeof extension,
+ RV_HOOKS(hooks),
+};
+
+const struct rv_descriptor *rv_module_entry(const struct rv_api *core,
+ rv_extension_handle handle)
+{
+ (void)handle;
+ api = core;
+ return &extension;
+}
diff --git a/extensions/fast-seek/manifest.toml b/extensions/fast-seek/manifest.toml
new file mode 100644
index 0000000..15895a3
--- /dev/null
+++ b/extensions/fast-seek/manifest.toml
@@ -0,0 +1,13 @@
+id = "fast-seek"
+name = "Fast Seek"
+description = "Seeking in long AAC and Apple Lossless files (audiobooks, podcasts) jumps straight to the target instead of stepping through every frame on the way."
+version = "0.1.0"
+author = "RepriseOS and RevolaOS contributors"
+license = "GPL-3.0-only"
+api = "1.82"
+stability = "beta"
+category = "media"
+
+[[module]]
+name = "main"
+trigger = "always"
diff --git a/extensions/long-audio-fix/Makefile b/extensions/long-audio-fix/Makefile
new file mode 100644
index 0000000..cb973a7
--- /dev/null
+++ b/extensions/long-audio-fix/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-3.0-only
+main_SOURCES := main.c
+include $(SDK)/rv.mk
diff --git a/extensions/long-audio-fix/README.md b/extensions/long-audio-fix/README.md
new file mode 100644
index 0000000..47657f8
--- /dev/null
+++ b/extensions/long-audio-fix/README.md
@@ -0,0 +1,15 @@
+# Long Audio Fix
+
+The same fix as [Play MP4 audiobooks past 13.5 hours](https://github.com/RepriseOS/repriseos/pull/62) by kayboll for RepriseOS, arrived at independently.
+
+Apple's MP4 parser ends an AAC or Apple Lossless file (M4A, M4B) once playback passes 2^31 samples: 13:31:35 at 44.1 kHz, 12:25:39 at 48 kHz. Past that point every sample counts as outside the edit list, so the track ends, and a seek there ends it at once. This affects files with an edit list, which iTunes, ffmpeg and most audiobook tools write.
+
+The parser keeps the decode time in 64 bits but compares it with the edit list in 32. The extension replaces the three sign-extensions of the low word with loads of the high word.
+
+Disabling it restores Apple's compares at once.
+
+| | |
+|---|---|
+| Default | on |
+| Memory | image only |
+| Settings | none |
diff --git a/extensions/long-audio-fix/assets/LICENSE.cupertino-icons b/extensions/long-audio-fix/assets/LICENSE.cupertino-icons
new file mode 100644
index 0000000..581f84c
--- /dev/null
+++ b/extensions/long-audio-fix/assets/LICENSE.cupertino-icons
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 Vladimir Kharlampidi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/extensions/long-audio-fix/assets/settings-long-audio-fix.png b/extensions/long-audio-fix/assets/settings-long-audio-fix.png
new file mode 100644
index 0000000..d527304
Binary files /dev/null and b/extensions/long-audio-fix/assets/settings-long-audio-fix.png differ
diff --git a/extensions/long-audio-fix/assets/settings-long-audio-fix.svg b/extensions/long-audio-fix/assets/settings-long-audio-fix.svg
new file mode 100644
index 0000000..2233d75
--- /dev/null
+++ b/extensions/long-audio-fix/assets/settings-long-audio-fix.svg
@@ -0,0 +1,5 @@
+
diff --git a/extensions/long-audio-fix/listing.toml b/extensions/long-audio-fix/listing.toml
new file mode 100644
index 0000000..3c0a10d
--- /dev/null
+++ b/extensions/long-audio-fix/listing.toml
@@ -0,0 +1,3 @@
+details = "Play an AAC or Apple Lossless file (M4A, M4B) longer than 13.5 hours. It plays to the end instead of stopping at 13:31:35. Nothing is added to the menus."
+
+icon = "assets/settings-long-audio-fix.png"
diff --git a/extensions/long-audio-fix/main.c b/extensions/long-audio-fix/main.c
new file mode 100644
index 0000000..6a16b74
--- /dev/null
+++ b/extensions/long-audio-fix/main.c
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-3.0-only */
+
+/* The same fix as RepriseOS pull request 62 by kayboll, arrived at independently. */
+
+/* The MP4 parser compares a track's 64-bit decode time with its edit list after
+ * sign-extending the low word, so past 2^31 media ticks (13:31:35 at 44.1 kHz)
+ * every sample counts as outside the edit and the track ends. Each site holds
+ * `asr r1, r0, #31` with r0 the low word; the replacement loads the high word
+ * from the track instead. */
+
+#include "rv_api.h"
+#include "rv_sites.h"
+#include "rv_ui.h"
+
+static const struct rv_hook hooks[] = {
+ /* ldr r1, [r2, #-20]: r2 is track + edit_media_start, the high word of decode_time
+ * sits 20 bytes before it. */
+ RV_HOOK_WORD(RV_SITE_MP4Parser_ReadEditStartTest_word, 0xe5121014),
+ /* ldr r1, [r2, #-28]: r2 is track + edit_media_end. */
+ RV_HOOK_WORD(RV_SITE_MP4Parser_ReadEditEndTest_word, 0xe512101c),
+ /* The same compare in the seek walk, r2 again track + edit_media_end. */
+ RV_HOOK_WORD(RV_SITE_MP4Parser_SeekEditEndTest_word, 0xe512101c),
+};
+
+static const struct rv_descriptor extension = {
+ .size = sizeof extension,
+ RV_HOOKS(hooks),
+};
+
+const struct rv_descriptor *rv_module_entry(const struct rv_api *core,
+ rv_extension_handle handle)
+{
+ (void)core;
+ (void)handle;
+ return &extension;
+}
diff --git a/extensions/long-audio-fix/manifest.toml b/extensions/long-audio-fix/manifest.toml
new file mode 100644
index 0000000..1f5d05d
--- /dev/null
+++ b/extensions/long-audio-fix/manifest.toml
@@ -0,0 +1,13 @@
+id = "long-audio-fix"
+name = "Long Audio Fix"
+description = "AAC and Apple Lossless files longer than 13.5 hours (12.4 hours at 48 kHz) play to the end instead of stopping partway."
+version = "0.1.0"
+author = "RepriseOS and RevolaOS contributors"
+license = "GPL-3.0-only"
+api = "1.82"
+stability = "beta"
+category = "media"
+
+[[module]]
+name = "main"
+trigger = "always"
diff --git a/extensions/sleep-timer/Makefile b/extensions/sleep-timer/Makefile
new file mode 100644
index 0000000..3dde248
--- /dev/null
+++ b/extensions/sleep-timer/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-3.0-only
+main_SOURCES := main.c indicator.c
+include $(SDK)/rv.mk
diff --git a/extensions/sleep-timer/README.md b/extensions/sleep-timer/README.md
new file mode 100644
index 0000000..6600134
--- /dev/null
+++ b/extensions/sleep-timer/README.md
@@ -0,0 +1,13 @@
+# Sleep Timer
+
+Based on [Sleep Timer shortcut](https://github.com/RepriseOS/repriseos/pull/75) by kayboll in RepriseOS.
+
+Adds Sleep Timer to the Now Playing context menu (hold Select) of a song, podcast episode, iTunes U episode or audiobook. It opens a list of Apple's sleep timer choices, Off, 15, 30, 60, 90 and 120 Minutes, with the active one highlighted. Choosing one sets Apple's timer, the one Extras > Alarms > Sleep Timer sets, and returns to Now Playing.
+
+While the timer runs, Now Playing shows the minutes left and a moon before the shuffle icon. From an hour the minutes read h:mm.
+
+| | |
+|---|---|
+| Default | on |
+| Memory | image only; about 1 KB for the Now Playing image from setting the timer until Now Playing shows it stopped, and a 4.6 KB scratch while its minutes are drawn |
+| Settings | none |
diff --git a/extensions/sleep-timer/assets/LICENSE.cupertino-icons b/extensions/sleep-timer/assets/LICENSE.cupertino-icons
new file mode 100644
index 0000000..581f84c
--- /dev/null
+++ b/extensions/sleep-timer/assets/LICENSE.cupertino-icons
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 Vladimir Kharlampidi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/extensions/sleep-timer/assets/render.py b/extensions/sleep-timer/assets/render.py
new file mode 100755
index 0000000..ce96c96
--- /dev/null
+++ b/extensions/sleep-timer/assets/render.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-3.0-only
+"""Render moon.h, the moon of the Now Playing timer: Cupertino Icons moon_fill
+fitted into an 11 x 11 coverage mask, one byte per pixel. Drawing uses
+ImageMagick's `magick`; the font (CupertinoIcons.ttf from the Flutter
+`cupertino_icons` package, MIT, see LICENSE.cupertino-icons) is not in the
+repository.
+
+ python3 assets/render.py --font CupertinoIcons.ttf
+ python3 assets/render.py --font CupertinoIcons.ttf --check
+"""
+
+import argparse
+import os
+import subprocess
+import sys
+from pathlib import Path
+
+HERE = Path(__file__).resolve().parent
+OUT = HERE.parent / "moon.h"
+SIZE = 11
+MOON_FILL = 0xF719
+
+
+def render(font):
+ pixels = subprocess.run(
+ [
+ "magick",
+ "-background",
+ "black",
+ "-fill",
+ "white",
+ "-font",
+ font,
+ "-pointsize",
+ "400",
+ f"label:{chr(MOON_FILL)}",
+ "-trim",
+ "+repage",
+ "-resize",
+ f"{SIZE}x{SIZE}",
+ "-gravity",
+ "Center",
+ "-extent",
+ f"{SIZE}x{SIZE}",
+ "-colorspace",
+ "gray",
+ "-depth",
+ "8",
+ "gray:-",
+ ],
+ check=True,
+ capture_output=True,
+ ).stdout
+ if len(pixels) != SIZE * SIZE:
+ sys.exit(f"magick returned {len(pixels)} bytes, not {SIZE * SIZE}")
+ rows = "\n".join(
+ " " + ", ".join(f"{p:3d}" for p in pixels[y * SIZE : (y + 1) * SIZE]) + ","
+ for y in range(SIZE)
+ )
+ return (
+ "/* SPDX-License-Identifier: GPL-3.0-only */\n\n"
+ "/* Generated by assets/render.py from Cupertino Icons moon_fill (MIT, see\n"
+ " * assets/LICENSE.cupertino-icons). */\n\n"
+ f"#define MOON_SIZE {SIZE}\n\n"
+ "/* clang-format off */\n"
+ f"static const unsigned char moon[MOON_SIZE * MOON_SIZE] = {{\n{rows}\n}};\n"
+ "/* clang-format on */\n"
+ )
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
+ parser.add_argument(
+ "--font", default=os.environ.get("CUPERTINO_ICONS"), help="CupertinoIcons.ttf"
+ )
+ parser.add_argument("--check", action="store_true", help="fail when moon.h differs")
+ args = parser.parse_args()
+ if not args.font:
+ sys.exit("give the font with --font or CUPERTINO_ICONS")
+ text = render(args.font)
+ if args.check:
+ if not OUT.exists() or OUT.read_text() != text:
+ sys.exit(f"{OUT.name} is out of date: run {Path(__file__).name}")
+ return
+ OUT.write_text(text)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/extensions/sleep-timer/assets/settings-sleep-timer.png b/extensions/sleep-timer/assets/settings-sleep-timer.png
new file mode 100644
index 0000000..090d4fc
Binary files /dev/null and b/extensions/sleep-timer/assets/settings-sleep-timer.png differ
diff --git a/extensions/sleep-timer/assets/settings-sleep-timer.svg b/extensions/sleep-timer/assets/settings-sleep-timer.svg
new file mode 100644
index 0000000..8803515
--- /dev/null
+++ b/extensions/sleep-timer/assets/settings-sleep-timer.svg
@@ -0,0 +1,5 @@
+
diff --git a/extensions/sleep-timer/indicator.c b/extensions/sleep-timer/indicator.c
new file mode 100644
index 0000000..11badb4
--- /dev/null
+++ b/extensions/sleep-timer/indicator.c
@@ -0,0 +1,210 @@
+/* SPDX-License-Identifier: GPL-3.0-only */
+
+/* The timer is drawn as the stock shuffle glyph is stored: an Indexed8 BMap of
+ * black at alpha levels up to the glyph's own 0xce. The minutes are drawn in
+ * Apple's Helvetica, black on an opaque white scratch, and read back as
+ * coverage, so the glyph blitter's handling of alpha does not matter. */
+
+#include "indicator.h"
+#include "moon.h"
+#include "osos-2.0.5.h"
+#include "rv_libc.h"
+#include
+
+enum {
+ HEIGHT = 14, /* the shuffle glyph's */
+ MOON_GAP = 3, /* between the minutes and the moon */
+ CHAIN_GAP = 5, /* before the shuffle glyph, as between shuffle and repeat */
+ LEVELS = 33,
+ INK = 0xce, /* the shuffle glyph's darkest alpha */
+ SCRATCH_W = 48, /* the minutes, "2:00" at most */
+ SCRATCH_H = 24,
+ FONT_SIZE = 0x40, /* bold, as tall as the glyphs beside it */
+};
+
+static uint32_t font[2];
+static uint8_t font_built;
+static uint8_t *built;
+static uint32_t built_minutes;
+static const void *built_shuffle;
+
+static uint32_t word(const uint8_t *p)
+{
+ return p[0] | (uint32_t)p[1] << 8 | (uint32_t)p[2] << 16 | (uint32_t)p[3] << 24;
+}
+
+static void put_word(uint8_t *p, uint32_t value)
+{
+ for (unsigned i = 0; i < 4; i++)
+ p[i] = (uint8_t)(value >> (8 * i));
+}
+
+static void header(uint8_t *b, uint16_t format, uint16_t stride, uint16_t depth,
+ uint32_t width, uint32_t height, uint32_t payload)
+{
+ for (unsigned i = 0; i < BMap_payload; i++)
+ b[i] = 0;
+ b[BMap_format] = (uint8_t)format;
+ b[BMap_format + 1] = (uint8_t)(format >> 8);
+ b[BMap_stride] = (uint8_t)stride;
+ b[BMap_stride + 1] = (uint8_t)(stride >> 8);
+ b[BMap_depth] = (uint8_t)depth;
+ put_word(b + BMap_bounds + 8, height);
+ put_word(b + BMap_bounds + 12, width);
+ put_word(b + BMap_payload_bytes, payload);
+}
+
+/* Draws `text` into a scratch block from `api` and leaves its coverage, trimmed
+ * to the ink, at the start of the block, SCRATCH_W bytes a row; the ink's width
+ * and height in *ink_w and *ink_h. NULL when nothing could be drawn. */
+static uint8_t *draw_minutes(const struct rv_api *api, rv_extension_handle self,
+ const char *text, int *ink_w, int *ink_h)
+{
+ uint8_t *scratch = api->alloc(self, BMap_payload + SCRATCH_W * SCRATCH_H * 4);
+ if (!scratch)
+ return NULL;
+ header(scratch, BMapFormat_BGRA8888, SCRATCH_W * 4, 32, SCRATCH_W, SCRATCH_H,
+ SCRATCH_W * SCRATCH_H * 4);
+ uint32_t storage[Bitmap_bytes / 4];
+ uint32_t context[GraphicsContext_bytes / 4];
+ Bitmap_Construct(storage);
+ GraphicsContext_InitFromBitmapResource(context, storage, scratch);
+ static const uint8_t white[4] = {0xff, 0xff, 0xff, 0xff},
+ black[4] = {0, 0, 0, 0xff};
+ int32_t all[4] = {0, 0, SCRATCH_H, SCRATCH_W};
+ GraphicsContext_SetColor(context, white);
+ GraphicsContext_SetDrawMode(context, GraphicsDrawMode_Copy);
+ GraphicsContext_FillRect(context, all);
+ if (!font_built) {
+ Font_Construct(font, "Helvetica", FONT_SIZE, 1);
+ font_built = 1;
+ }
+ GraphicsContext_SetFont(context, font);
+ GraphicsContext_SetColor(context, black);
+ GraphicsContext_SetDrawMode(context, GraphicsDrawMode_Text);
+ GraphicsContext_SetTextPen(context, 2, 2 + GraphicsContext_GetFontAscent(context));
+ GraphicsContext_DrawUtf8(context, text);
+ GraphicsContext_Destroy(context);
+ Bitmap_Destroy(storage);
+
+ /* Each coverage byte lands at or before the pixel it is read from. */
+ const uint8_t *pixels = scratch + BMap_payload;
+ int left = SCRATCH_W, right = -1, top = SCRATCH_H, bottom = -1;
+ for (int i = 0; i < SCRATCH_W * SCRATCH_H; i++) {
+ uint8_t c = 0xff - pixels[i * 4 + 2];
+ scratch[i] = c;
+ if (c) {
+ int x = i % SCRATCH_W, y = i / SCRATCH_W;
+ left = x < left ? x : left;
+ right = x > right ? x : right;
+ top = y < top ? y : top;
+ bottom = y > bottom ? y : bottom;
+ }
+ }
+ if (right < 0) {
+ api->free(self, scratch);
+ return NULL;
+ }
+ for (int y = top; y <= bottom; y++)
+ for (int x = left; x <= right; x++)
+ scratch[(y - top) * SCRATCH_W + x - left] = scratch[y * SCRATCH_W + x];
+ *ink_w = right - left + 1;
+ *ink_h = bottom - top + 1;
+ return scratch;
+}
+
+static uint8_t level(uint32_t coverage)
+{
+ return (uint8_t)((coverage * (LEVELS - 1) + 127) / 255);
+}
+
+/* The stock glyph's pixel alpha at (x, y) as one of our levels. */
+static uint8_t glyph_level(const uint8_t *g, int x, int y)
+{
+ uint32_t colors = word(g + BMap_payload),
+ stride = g[BMap_stride] | g[BMap_stride + 1] << 8;
+ uint8_t index = g[BMap_payload + 4 + colors * 4 + y * stride + x];
+ if (index >= colors)
+ return 0;
+ uint32_t alpha = g[BMap_payload + 4 + index * 4 + 3];
+ uint32_t l = (alpha * (LEVELS - 1) + INK / 2) / INK;
+ return (uint8_t)(l < LEVELS ? l : LEVELS - 1);
+}
+
+static int glyph_usable(const uint8_t *g, int *w, int *h)
+{
+ const int32_t top = (int32_t)word(g + BMap_bounds),
+ left = (int32_t)word(g + BMap_bounds + 4);
+ *h = (int32_t)word(g + BMap_bounds + 8) - top;
+ *w = (int32_t)word(g + BMap_bounds + 12) - left;
+ return g[BMap_format] == (uint8_t)BMapFormat_Indexed8 && !g[BMap_format + 1] &&
+ g[BMap_depth] == 8 && !top && !left && *w > 0 && *h > 0 && *h <= HEIGHT &&
+ word(g + BMap_payload) <= 256;
+}
+
+void indicator_free(const struct rv_api *api, rv_extension_handle self)
+{
+ if (built)
+ api->free(self, built);
+ built = NULL;
+}
+
+const void *indicator_build(const struct rv_api *api, rv_extension_handle self,
+ uint32_t minutes, const void *shuffle)
+{
+ if (built && built_minutes == minutes && built_shuffle == shuffle)
+ return built;
+ char text[8];
+ if (minutes < 60)
+ rv_format(text, sizeof text, "%lu", minutes);
+ else
+ rv_format(text, sizeof text, "%lu:%02lu", minutes / 60, minutes % 60);
+ int text_w, text_h;
+ uint8_t *cover = draw_minutes(api, self, text, &text_w, &text_h);
+ if (!cover)
+ return NULL;
+ int glyph_w = 0, glyph_h = 0;
+ if (shuffle && !glyph_usable(shuffle, &glyph_w, &glyph_h))
+ shuffle = NULL;
+
+ int timer = text_w + MOON_GAP + MOON_SIZE;
+ int width = timer + (shuffle ? CHAIN_GAP + glyph_w : 0);
+ uint32_t pixels = BMap_payload + 4 + LEVELS * 4;
+ uint8_t *b = api->alloc(self, pixels + (uint32_t)(width * HEIGHT));
+ if (!b) {
+ api->free(self, cover);
+ return NULL;
+ }
+ header(b, BMapFormat_Indexed8, (uint16_t)width, 8, (uint32_t)width, HEIGHT,
+ 4 + LEVELS * 4 + (uint32_t)(width * HEIGHT));
+ put_word(b + BMap_payload, LEVELS);
+ for (unsigned i = 0; i < LEVELS; i++) {
+ uint8_t *entry = b + BMap_payload + 4 + i * 4;
+ entry[0] = entry[1] = entry[2] = 0;
+ entry[3] = (uint8_t)(i * INK / (LEVELS - 1));
+ }
+ int text_y = (HEIGHT - text_h) / 2; /* ink taller than HEIGHT is clipped */
+ int moon_x = text_w + MOON_GAP, moon_y = (HEIGHT - MOON_SIZE) / 2;
+ for (int y = 0; y < HEIGHT; y++)
+ for (int x = 0; x < width; x++) {
+ uint8_t *out = b + pixels + y * width + x;
+ if (x < text_w)
+ *out = y >= text_y && y < text_y + text_h
+ ? level(cover[(y - text_y) * SCRATCH_W + x])
+ : 0;
+ else if (x >= moon_x && x < timer)
+ *out = y >= moon_y && y < moon_y + MOON_SIZE
+ ? level(moon[(y - moon_y) * MOON_SIZE + x - moon_x])
+ : 0;
+ else if (shuffle && x >= timer + CHAIN_GAP && y < glyph_h)
+ *out = glyph_level(shuffle, x - timer - CHAIN_GAP, y);
+ else
+ *out = 0;
+ }
+ api->free(self, cover);
+ indicator_free(api, self);
+ built = b;
+ built_minutes = minutes;
+ built_shuffle = shuffle;
+ return built;
+}
diff --git a/extensions/sleep-timer/indicator.h b/extensions/sleep-timer/indicator.h
new file mode 100644
index 0000000..4fd4073
--- /dev/null
+++ b/extensions/sleep-timer/indicator.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-3.0-only */
+#ifndef SLEEP_TIMER_INDICATOR_H
+#define SLEEP_TIMER_INDICATOR_H
+#include "rv_api.h"
+#include
+
+/* The Now Playing shuffle image with the timer before it: the minutes left
+ * and a moon, then `shuffle` (a stock BMap, NULL when shuffle is off) 5 px to
+ * their right. A BMap in a block from `api`, NULL when the heap is
+ * full; freed with indicator_free. UI task. */
+const void *indicator_build(const struct rv_api *api, rv_extension_handle self,
+ uint32_t minutes, const void *shuffle);
+void indicator_free(const struct rv_api *api, rv_extension_handle self);
+
+#endif
diff --git a/extensions/sleep-timer/listing.toml b/extensions/sleep-timer/listing.toml
new file mode 100644
index 0000000..741d663
--- /dev/null
+++ b/extensions/sleep-timer/listing.toml
@@ -0,0 +1,15 @@
+details = "Hold Select in Now Playing and choose Sleep Timer to set Apple's sleep timer without leaving the song. While it runs, Now Playing shows the minutes left before the shuffle icon."
+
+icon = "assets/settings-sleep-timer.png"
+
+[[screenshots]]
+file = "screenshots/context-menu.png"
+alt = "The Now Playing context menu of an audiobook with Sleep Timer highlighted, above File Info and Cancel."
+
+[[screenshots]]
+file = "screenshots/list.png"
+alt = "The Sleep Timer list: Off, 15, 30, 60, 90 and 120 Minutes, with 30 Minutes highlighted."
+
+[[screenshots]]
+file = "screenshots/now-playing.png"
+alt = "Now Playing with 30 and a moon in the top right, where the shuffle icon goes."
diff --git a/extensions/sleep-timer/main.c b/extensions/sleep-timer/main.c
new file mode 100644
index 0000000..95c99cc
--- /dev/null
+++ b/extensions/sleep-timer/main.c
@@ -0,0 +1,150 @@
+/* SPDX-License-Identifier: GPL-3.0-only */
+
+/* Based on RepriseOS payload/sleep_timer.c (91d94ce) by kayboll.
+ *
+ * Sleep Timer in the Now Playing context menu: Apple's sleep timer choices as
+ * a full-width list. Choosing one sets the stock timer, the one Extras >
+ * Alarms > Sleep Timer sets, and returns to Now Playing. While the timer runs,
+ * Now Playing shows the minutes left and a moon before the shuffle icon. */
+
+#include "indicator.h"
+#include "osos-2.0.5.h"
+#include "rv_api.h"
+#include "rv_libc.h"
+#include "rv_sites.h"
+#include "rv_ui.h"
+
+#define POLL_MS 2000 /* the App counts the minutes on its own timer */
+
+static const struct rv_api *api;
+static rv_extension_handle self;
+static struct rv_timer *poll;
+static uint32_t shown; /* minutes on the image Now Playing has, 0 for none */
+static int stopping;
+static char label[16];
+
+static void *service(void)
+{
+ return AlarmsService_Get();
+}
+
+static uint32_t active_choice(void)
+{
+ return RV_FIELD(service(), AlarmsService_sleep_timer_choice, uint32_t);
+}
+
+static uint32_t remaining(void)
+{
+ return RV_FIELD(App, App_sleep_timer_remaining, uint32_t);
+}
+
+/* Now Playing asks for the shuffle image again. */
+static void refresh(void)
+{
+ Model_Notify(NowPlayingModel_Get(), Property_Bitmap, Property_ShuffleImage);
+}
+
+static void tick(void *arg)
+{
+ (void)arg;
+ uint32_t want = active_choice() ? remaining() : 0;
+ if (want != shown)
+ refresh();
+ if (!active_choice())
+ rv_timer_cancel(api, self, &poll);
+}
+
+static uint32_t property(uintptr_t model, uint32_t type, uint32_t which, uintptr_t out,
+ const void *next)
+{
+ uint32_t handled = api->hook_next(next, model, type, which, out, 0, 0);
+ if (type != Property_Bitmap || which != Property_ShuffleImage)
+ return handled;
+ uintptr_t *image = (uintptr_t *)out;
+ if (stopping || !active_choice()) {
+ /* Now Playing takes this answer in place of ours. */
+ indicator_free(api, self);
+ shown = 0;
+ return handled;
+ }
+ const void *bitmap =
+ indicator_build(api, self, remaining(), handled ? (void *)*image : NULL);
+ if (!bitmap)
+ return handled;
+ *image = (uintptr_t)bitmap;
+ shown = remaining();
+ if (!poll)
+ poll = api->timer_start(self, POLL_MS, 1, tick, NULL);
+ return 1;
+}
+
+static uint32_t count(const struct rv_context *ctx)
+{
+ (void)ctx;
+ return RV_FIELD(service(), AlarmsService_sleep_timer_choice_count, uint32_t);
+}
+
+static const char *row(const struct rv_context *ctx, uint32_t index,
+ const char **detail)
+{
+ (void)ctx;
+ *detail = NULL;
+ const uint8_t *choices =
+ RV_FIELD(service(), AlarmsService_sleep_timer_choices, const uint8_t *);
+ uint32_t minutes = RV_FIELD(choices + index * SleepTimerChoice_bytes,
+ SleepTimerChoice_minutes, uint32_t);
+ if (!minutes)
+ return "Off";
+ rv_format(label, sizeof label, "%lu Minutes", minutes);
+ return label;
+}
+
+static int choose(const struct rv_context *ctx, uint32_t index)
+{
+ (void)ctx;
+ AlarmsService_SelectSleepTimer(service(), index);
+ refresh();
+ return 1;
+}
+
+static uint32_t active(const struct rv_context *ctx)
+{
+ (void)ctx;
+ return active_choice();
+}
+
+static void unload(void)
+{
+ stopping = 1;
+ refresh();
+ indicator_free(api, self);
+}
+
+static const struct rv_hook hooks[] = {
+ RV_HOOK_FILTER(RV_SITE_NowPlayingModel_Property_slot, property),
+};
+
+static const struct rv_screen screens[] = {
+ RV_SCREEN_DYNAMIC_LIST("timer", "Sleep Timer", count, row, .dynamic.select = choose,
+ .layout = RV_LAYOUT_FULL, .dynamic.initial = active),
+};
+
+static const struct rv_menu_entry entries[] = {
+ RV_MENU_ENTRY(RV_MENU_NOW_PLAYING_CONTEXT, 0, RV_ROW_PUSH("Sleep Timer", "timer")),
+};
+
+static const struct rv_descriptor extension = {
+ .size = sizeof extension,
+ RV_HOOKS(hooks),
+ RV_SCREENS(screens),
+ RV_ENTRIES(entries),
+ .unload = unload,
+};
+
+const struct rv_descriptor *rv_module_entry(const struct rv_api *core,
+ rv_extension_handle handle)
+{
+ api = core;
+ self = handle;
+ return &extension;
+}
diff --git a/extensions/sleep-timer/manifest.toml b/extensions/sleep-timer/manifest.toml
new file mode 100644
index 0000000..2b9dc38
--- /dev/null
+++ b/extensions/sleep-timer/manifest.toml
@@ -0,0 +1,13 @@
+id = "sleep-timer"
+name = "Sleep Timer"
+description = "Set Apple's sleep timer from the Now Playing context menu and see the minutes left in Now Playing."
+version = "0.1.0"
+author = "RepriseOS and RevolaOS contributors"
+license = "GPL-3.0-only"
+api = "1.82"
+stability = "beta"
+category = "media"
+
+[[module]]
+name = "main"
+trigger = "always"
diff --git a/extensions/sleep-timer/moon.h b/extensions/sleep-timer/moon.h
new file mode 100644
index 0000000..0621d94
--- /dev/null
+++ b/extensions/sleep-timer/moon.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-3.0-only */
+
+/* Generated by assets/render.py from Cupertino Icons moon_fill (MIT, see
+ * assets/LICENSE.cupertino-icons). */
+
+#define MOON_SIZE 11
+
+/* clang-format off */
+static const unsigned char moon[MOON_SIZE * MOON_SIZE] = {
+ 0, 9, 124, 201, 30, 0, 0, 0, 0, 0, 0,
+ 4, 128, 253, 187, 8, 0, 0, 0, 0, 0, 0,
+ 82, 241, 255, 165, 1, 0, 0, 0, 0, 0, 0,
+ 188, 255, 255, 179, 5, 0, 0, 0, 0, 0, 0,
+ 242, 255, 255, 221, 32, 0, 0, 0, 0, 0, 0,
+ 254, 255, 255, 255, 132, 2, 0, 0, 0, 0, 0,
+ 237, 255, 255, 255, 244, 129, 28, 2, 0, 2, 14,
+ 174, 255, 255, 255, 255, 254, 215, 167, 148, 168, 187,
+ 60, 225, 255, 255, 255, 255, 255, 255, 255, 255, 145,
+ 0, 81, 221, 255, 255, 255, 255, 255, 245, 145, 16,
+ 0, 0, 52, 161, 228, 249, 241, 195, 95, 8, 0,
+};
+/* clang-format on */
diff --git a/extensions/sleep-timer/screenshots/context-menu.png b/extensions/sleep-timer/screenshots/context-menu.png
new file mode 100644
index 0000000..a03bd07
Binary files /dev/null and b/extensions/sleep-timer/screenshots/context-menu.png differ
diff --git a/extensions/sleep-timer/screenshots/list.png b/extensions/sleep-timer/screenshots/list.png
new file mode 100644
index 0000000..5de4477
Binary files /dev/null and b/extensions/sleep-timer/screenshots/list.png differ
diff --git a/extensions/sleep-timer/screenshots/now-playing.png b/extensions/sleep-timer/screenshots/now-playing.png
new file mode 100644
index 0000000..e2598b4
Binary files /dev/null and b/extensions/sleep-timer/screenshots/now-playing.png differ
diff --git a/tests/test_catalog.py b/tests/test_catalog.py
index fd4de66..14c6ca5 100644
--- a/tests/test_catalog.py
+++ b/tests/test_catalog.py
@@ -40,8 +40,9 @@ def test_preview_packages_and_referenced_images(self):
for entry in entries.values():
assets = [entry["package"]]
if entry["category"] != "library":
- self.assertTrue(entry["screenshots"][0]["alt"])
- self.assertEqual(entry["screenshots"][0]["width"], 320)
+ for shot in entry["screenshots"]:
+ self.assertTrue(shot["alt"])
+ self.assertEqual(shot["width"], 320)
assets += [entry["icon"], *entry["screenshots"]]
for asset in assets:
data = (self.out / asset["url"]).read_bytes()