IPC Control
gSlapper supports runtime control via Unix domain sockets, allowing you to control playback from scripts or other applications.
gSlapper supports runtime control via Unix domain sockets, allowing you to control playback from scripts or other applications.
Enabling IPC
Start gSlapper with the -I or --ipc-socket option:
gslapper -I /tmp/gslapper.sock -o "loop" DP-1 video.mp4Sending Commands
Use nc (netcat) or socat to send commands:
# Using nc
echo "pause" | nc -U /tmp/gslapper.sock
# Using socat
echo "pause" | socat - UNIX-CONNECT:/tmp/gslapper.sockAvailable Commands
help
List all available IPC commands.
echo "help" | nc -U /tmp/gslapper.sockResponse: List of all supported commands with brief descriptions.
pause
Pause video playback.
echo "pause" | nc -U /tmp/gslapper.sockResponse: OK
pause is idempotent: repeating it on an already-paused instance answers OK and changes nothing. However many times you send pause, one resume restores playback.
resume
Resume playback that was paused through IPC.
echo "resume" | nc -U /tmp/gslapper.sockResponse: OK
resume is idempotent and releases only the pause set through IPC. If playback is paused by --auto-pause or the pauselist, resume answers OK without overriding that hold; playback continues once the hold clears.
Multi-monitor controllers
Front ends that drive one gSlapper instance per output can send the same pause or resume to every instance, including instances already in the requested state. Redundant commands are safe no-ops.
query
Get current state and wallpaper path.
echo "query" | nc -U /tmp/gslapper.sockResponse: STATUS: playing image /path/to/wallpaper.jpg or STATUS: paused video /path/to/video.mp4
The paused state reflects every pause source: IPC pause, --auto-pause, and the pauselist.
change <path>
Switch to a different wallpaper.
echo "change /path/to/new/video.mp4" | nc -U /tmp/gslapper.sockResponse: OK: transition started (if transitions enabled) or OK
layer <name>
Switch gSlapper to a different Wayland layer at runtime.
Supported layer names: background, bottom, top, overlay.
echo "layer top" | nc -U /tmp/gslapper.sock
echo "layer background" | nc -U /tmp/gslapper.sockResponse: OK or ERROR: <message>
Compositor support
Dynamic layer switching requires layer-shell protocol support for set_layer (v2+). On older compositors, this command returns an error.
stop / quit
Stop gSlapper.
echo "stop" | nc -U /tmp/gslapper.sock
echo "quit" | nc -U /tmp/gslapper.sockResponse: OK (gSlapper exits)
save-state
Save the current wallpaper state without stopping gSlapper.
echo "save-state" | nc -U /tmp/gslapper.sockResponse: OK: state saved
set-transition <type>
Set transition effect type: none, fade, left, right, top, bottom, wipe, wave, grow, center, outer, any or random. See Transitions for what each one does.
echo "set-transition fade" | nc -U /tmp/gslapper.sock
echo "set-transition wave" | nc -U /tmp/gslapper.sock
echo "set-transition none" | nc -U /tmp/gslapper.sockResponse: OK: fade transitions enabled, OK: <type> transitions enabled, OK: transitions disabled, or ERROR: unknown transition type
Transitions
Transitions only work between static images. Videos always use instant switch regardless of transition settings.
set-transition-duration <seconds>
Set transition duration in seconds (0.0-5.0).
echo "set-transition-duration 2.0" | nc -U /tmp/gslapper.sockResponse: OK or ERROR: <message>
set-transition-angle <degrees>
Set the direction the edge travels for wipe and wave: 0 moves left to right, 90 top to bottom. Values wrap into 0-360.
echo "set-transition-angle 135" | nc -U /tmp/gslapper.sockResponse: OK: angle set to 135 or ERROR: invalid angle
set-transition-pos <position>
Set the circle origin for grow and outer: x,y fractions from the top-left corner, or a name such as center, top-left or bottom-right.
echo "set-transition-pos 0.25,0.75" | nc -U /tmp/gslapper.sock
echo "set-transition-pos top-right" | nc -U /tmp/gslapper.sockResponse: OK: position set to 0.25,0.75 or ERROR: invalid position
get-transition
Query current transition settings.
echo "get-transition" | nc -U /tmp/gslapper.sockResponse: TRANSITION: <type> <enabled|disabled> <duration> angle=<degrees> pos=<x>,<y>
Example: TRANSITION: fade enabled 1.50 angle=45 pos=0.50,0.50
The first three fields have not changed since earlier releases, so scripts that read only those keep working.
Response Format
OK- Command succeededOK: <message>- Command succeeded with additional infoERROR: <message>- Command failed with error messageERROR: File not found: <path>- File access error with detailed reasonERROR: Permission denied: <path>- Permission error with system detailsERROR: Invalid input: <reason>- Input validation failedSTATUS: <state> <type> <path>- Query responseTRANSITION: <type> <enabled|disabled> <duration> angle=<degrees> pos=<x>,<y>- Transition query response
Error Messages
Recent improvements provide more detailed error messages:
- File not found:
ERROR: File not accessible: /path/to/file.mp4 (No such file or directory) - Permission denied:
ERROR: File not accessible: /path/to/file.mp4 (Permission denied) - Path too long:
ERROR: Path too long (max 4096 characters) - Invalid characters:
ERROR: Invalid input: contains control characters
Example Script
#!/bin/bash
SOCKET="/tmp/gslapper.sock"
case "$1" in
pause)
echo "pause" | nc -U "$SOCKET"
;;
resume)
echo "resume" | nc -U "$SOCKET"
;;
next)
echo "change /path/to/next/video.mp4" | nc -U "$SOCKET"
;;
status)
echo "query" | nc -U "$SOCKET"
;;
transition)
echo "set-transition fade" | nc -U "$SOCKET"
echo "set-transition-duration 2.0" | nc -U "$SOCKET"
;;
layer)
echo "layer ${2:-top}" | nc -U "$SOCKET"
;;
*)
echo "Usage: $0 {pause|resume|next|status|transition|layer [background|bottom|top|overlay]}"
exit 1
;;
esacCache Management Commands
These commands require --cache-size to be enabled.
cache-list
List all cached images with dimensions and sizes.
echo "cache-list" | nc -U /tmp/gslapper.sockResponse: List of cached images, one per line:
/path/to/image1.jpg 3840x2160 31.64 MB [*]
/path/to/image2.png 2560x1440 14.06 MBThe [*] marker indicates currently displayed image.
cache-stats
Show cache usage statistics.
echo "cache-stats" | nc -U /tmp/gslapper.sockResponse: 45.70/256.00 MB (2 images) or Cache disabled
preload <path>
Decode an image into the cache without showing it, so a later change to it is instant. Images are also cached automatically when displayed.
echo "preload /path/to/next.jpg" | nc -U /tmp/gslapper.sockResponse: OK: preloaded, OK: already cached, ERROR: cache disabled (with --cache-size 0), ERROR: image exceeds cache size, ERROR: failed to decode image, ERROR: file not accessible, or ERROR: not a valid image file
The decode runs in the main loop, so very large images briefly pause animation while they load.
unload <target>
Remove images from cache. Target can be:
unused- Remove all images not currently displayedall- Clear entire cache (including displayed image)<path>- Remove specific image by path
echo "unload unused" | nc -U /tmp/gslapper.sock
echo "unload all" | nc -U /tmp/gslapper.sock
echo "unload /path/to/image.jpg" | nc -U /tmp/gslapper.sockResponse: OK: Unloaded N image(s) or ERROR: <message>
listactive
Show currently displayed wallpaper(s) and output(s).
echo "listactive" | nc -U /tmp/gslapper.sockResponse: ACTIVE: <output> <type> <path>
Example: ACTIVE: DP-1 image /home/user/wallpaper.jpg
