#!/bin/sh [ -z "$WALLPAPER_DIR" ] || [ -z "$(ls -A $WALLPAPER_DIR)" ] && { printf "empty dir\n" swaybg -c '#000000' & # '#4A3700' & exit 0 } printf "setting random wallpaper\n" WALL=$(ls -d $WALLPAPER_DIR/*|shuf|head -n1) notify-send "WALL=$WALL" case $XDG_SESSION_TYPE in wayland) swaymsg output '*' background $WALL center ;; x11) xwallpaper --center $WALL ;; esac