Skip to content

Commit 3f7f1b1

Browse files
committed
Update documentation for v1.4.0 cache system
- Add --cache-size flag documentation with examples - Document cache IPC commands (cache-list, cache-stats, unload, listactive) - Remove outdated 'Future Commands' section - Add 'Instant Switching' to key features - Add cache usage example to quick-start guide - Add internal dev docs to gitignore
1 parent 7e674fa commit 3f7f1b1

5 files changed

Lines changed: 113 additions & 6 deletions

File tree

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,13 @@ opencode.json
7474
gslapper-*.tar.gz
7575
gslapper-*.tar.gz.opencode.json
7676

77-
# Development documentation
77+
# Development documentation (internal research/notes - not for public docs)
7878
docs/plans/
7979
docs/VERIFICATION_*.md
80+
docs/README.md
81+
docs/development/*-analysis.md
82+
docs/development/*-comparison.md
83+
docs/development/gstreamer-*.md
8084
CODE_REVIEW.md
8185
GAP_ANALYSIS.md
8286
IMPLEMENTATION_PLAN.md

docs/getting-started/quick-start.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,27 @@ Run in the background:
3838
gslapper -f -o "loop" DP-1 /path/to/video.mp4
3939
```
4040

41+
## With Image Cache (Instant Switching)
42+
43+
Cache images in RAM for near-instant wallpaper changes:
44+
45+
```bash
46+
# Start with cache enabled (256 MB)
47+
gslapper --cache-size 256 -I /tmp/gslapper.sock DP-1 /path/to/image1.jpg
48+
49+
# Switch to another image instantly (via IPC)
50+
echo "change /path/to/image2.jpg" | nc -U /tmp/gslapper.sock
51+
52+
# Check cache usage
53+
echo "cache-stats" | nc -U /tmp/gslapper.sock
54+
```
55+
56+
**What happens:**
57+
- First image is automatically cached when displayed
58+
- Subsequent `change` commands cache new images on-the-fly
59+
- Switching back to a cached image is near-instant (no re-decode)
60+
- LRU eviction removes least-recently-used images when cache is full
61+
4162
## Making Wallpapers Persistent
4263

4364
To make your wallpaper survive reboots and logins, see the [Persistent Wallpapers](../user-guide/persistent-wallpapers.md) guide. It covers:

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
- **Video Wallpapers** - Plays MP4, MKV, WebM, and other video formats
2424
- **Static Images** - Supports JPEG, PNG, WebP, and GIF
25+
- **Instant Switching** - RAM cache for near-instant wallpaper changes
2526
- **Fade Transitions** - Smooth transitions between wallpapers
2627
- **Multi-Monitor** - Works with multiple displays independently
2728
- **IPC Control** - Change wallpapers at runtime via Unix socket

docs/user-guide/command-line-options.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,38 @@ Enable IPC control via Unix socket.
7878
gslapper -I /tmp/gslapper.sock DP-1 video.mp4
7979
```
8080

81+
## Cache Options
82+
83+
### `--cache-size SIZE_MB`
84+
85+
Enable image cache with specified size in MB. Caches decoded RGBA image data in RAM for instant wallpaper switching.
86+
87+
```bash
88+
# 256 MB cache (recommended for ~10-30 images depending on resolution)
89+
gslapper --cache-size 256 -I /tmp/gslapper.sock DP-1 /path/to/image.jpg
90+
91+
# Switch images instantly via IPC
92+
echo "change /path/to/other.jpg" | nc -U /tmp/gslapper.sock
93+
```
94+
95+
**Default:** `0` (disabled)
96+
97+
**Recommended Values:**
98+
- `128` MB - For smaller image collections (~5-15 images at 4K)
99+
- `256` MB - General purpose (~10-30 images at 4K)
100+
- `512` MB - Large collections or many high-resolution images
101+
102+
**Features:**
103+
- Automatic caching when images are displayed
104+
- LRU (Least Recently Used) eviction when cache is full
105+
- Cache hits result in near-instant wallpaper changes
106+
- Query cache usage via IPC: `cache-stats`, `cache-list`
107+
108+
**Notes:**
109+
- Only works with static images (JPEG, PNG, WebP, etc.)
110+
- Videos are not cached (use GStreamer pipeline directly)
111+
- Cache is cleared on exit
112+
81113
## Video Options
82114

83115
### `-o, --gst-options "OPTIONS"`

docs/user-guide/ipc-control.md

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,59 @@ case "$1" in
148148
esac
149149
```
150150

151-
## Future Commands
151+
## Cache Management Commands
152152

153-
The following commands are planned for future releases:
153+
These commands require `--cache-size` to be enabled.
154154

155-
- `preload <path>` - Preload image into cache
156-
- `unload <path>` - Remove image from cache
157-
- `list` - List preloaded images
155+
### `cache-list`
156+
157+
List all cached images with dimensions and sizes.
158+
159+
```bash
160+
echo "cache-list" | nc -U /tmp/gslapper.sock
161+
```
162+
163+
**Response:** List of cached images, one per line:
164+
```
165+
/path/to/image1.jpg 3840x2160 31.64 MB [*]
166+
/path/to/image2.png 2560x1440 14.06 MB
167+
```
168+
169+
The `[*]` marker indicates currently displayed image.
170+
171+
### `cache-stats`
172+
173+
Show cache usage statistics.
174+
175+
```bash
176+
echo "cache-stats" | nc -U /tmp/gslapper.sock
177+
```
178+
179+
**Response:** `45.70/256.00 MB (2 images)` or `Cache disabled`
180+
181+
### `unload <target>`
182+
183+
Remove images from cache. Target can be:
184+
- `unused` - Remove all images not currently displayed
185+
- `all` - Clear entire cache (including displayed image)
186+
- `<path>` - Remove specific image by path
187+
188+
```bash
189+
echo "unload unused" | nc -U /tmp/gslapper.sock
190+
echo "unload all" | nc -U /tmp/gslapper.sock
191+
echo "unload /path/to/image.jpg" | nc -U /tmp/gslapper.sock
192+
```
193+
194+
**Response:** `OK: Unloaded N image(s)` or `ERROR: <message>`
195+
196+
### `listactive`
197+
198+
Show currently displayed wallpaper(s) and output(s).
199+
200+
```bash
201+
echo "listactive" | nc -U /tmp/gslapper.sock
202+
```
203+
204+
**Response:** `ACTIVE: <output> <type> <path>`
205+
206+
Example: `ACTIVE: DP-1 image /home/user/wallpaper.jpg`

0 commit comments

Comments
 (0)