Swaybience
Creation date:
Tags
Ever since I switched to Linux I am in the process of making my Desktop as comfy as technical possible. I remember when I still used Windows I had the Wallpaper Engine running and for most of the time I had a picture of a rainy window along side a cozy rain audio loop.
I currently have sway as my window manager which is easily hackable. I do not need heavy programms running in the background a bash script is more than enough. To replicate the same wallpaper I had when using Windows I first installed awww which is able to display gifs as a desktop background, sadly there is no prebuilt binary for debian, but building it from scratch was easy enough.
For the audio loop I wrote a small script which you can run in the background you can see it below.
As well as sway you also need socat,mpv and jq installed on your system.
#!/bin/bash
mpv --volume=0 --no-video --quiet --loop --input-ipc-server=/tmp/mpv-socket $1 &
swaymsg -t subscribe -m '["workspace"]' | while read -r line; do
app_id=$(swaymsg -t get_tree | jq -r '.. | select(.focused? == true) | .app_id')
volume=$(echo '{ "command": ["get_property", "volume"] }' | socat - /tmp/mpv-socket | jq -r '.data')
if [[ "$app_id" == "null" ]]; then
if [[ "$volume" == "0.000000" ]]; then
for vol in $(seq 0 1 50); do
echo "{ \"command\": [\"set_property\", \"volume\", $vol] }" | socat - /tmp/mpv-socket
sleep 0.05
done
fi
else
if [[ "$volume" == "50.000000" ]]; then
for vol in $(seq 50 -1 0); do
echo "{ \"command\": [\"set_property\", \"volume\", $vol] }" | socat - /tmp/mpv-socket
sleep 0.05
done
fi
fi
done