IPC Control¶
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:
Sending 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.sock
Available Commands¶
help¶
List all available IPC commands.
Response: List of all supported commands with brief descriptions.
pause¶
Pause video playback.
Response: OK
resume¶
Resume paused playback.
Response: OK
query¶
Get current state and wallpaper path.
Response: STATUS: playing image /path/to/wallpaper.jpg or STATUS: paused video /path/to/video.mp4
change <path>¶
Switch to a different wallpaper.
Response: OK: transition started (if transitions enabled) or OK
stop¶
Stop gSlapper.
Response: OK (gSlapper exits)
set-transition <type>¶
Set transition effect type. Options: none, fade.
echo "set-transition fade" | nc -U /tmp/gslapper.sock
echo "set-transition none" | nc -U /tmp/gslapper.sock
Response: OK or ERROR: <message>
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).
Response: OK or ERROR: <message>
get-transition¶
Query current transition settings.
Response: TRANSITION: <type> <enabled|disabled> <duration>
Example: TRANSITION: fade enabled 1.50
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>- 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"
;;
*)
echo "Usage: $0 {pause|resume|next|status|transition}"
exit 1
;;
esac
Cache Management Commands¶
These commands require --cache-size to be enabled.
cache-list¶
List all cached images with dimensions and sizes.
Response: List of cached images, one per line:
The [*] marker indicates currently displayed image.
cache-stats¶
Show cache usage statistics.
Response: 45.70/256.00 MB (2 images) or Cache disabled
unload <target>¶
Remove images from cache. Target can be:
- unused - Remove all images not currently displayed
- all - 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.sock
Response: OK: Unloaded N image(s) or ERROR: <message>
listactive¶
Show currently displayed wallpaper(s) and output(s).
Response: ACTIVE: <output> <type> <path>
Example: ACTIVE: DP-1 image /home/user/wallpaper.jpg