#!/bin/bash # sources: https://framagit.org/3hg/isotop/-/blob/master/src/files/usr/local/share/isotop/bin/rdmwall # by prx #----------------------- #Set as wallpaper a random picture located in any DIRS path if [ -d "$1" ]; then DIRS="$1" else DIRS="/usr/share/backgrounds $HOME/pics/walls" fi getrdmwall() { for D in $DIRS; do find $D -maxdepth 1 \ -type f \ -iname "*.jpg" -o \ -iname "*.png" done | sort -R | head -n 1 } img="" while [ ! -f "${img}" ]; do img="$(getrdmwall)" done swaymsg output "*" bg "$img" fill & exit 0