aboutsummaryrefslogblamecommitdiff
path: root/bin/executable_swaybg-random
blob: 6184e334a73bb7c61dd388e8bd6e24d4f65b1895 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11





                                   




                                   



                                                           
#!/bin/sh
# Usage: swaybg-random directory

DIR=$1
PIDFILE=$XDG_RUNTIME_DIR/swaybg.pid

if test -z "$DIR"; then
    echo "Usage: swaybg-random dir"
    exit 1
fi

swaybg -i $(find $DIR/. -type f | shuf -n1) -m fill -o \* &
NEWPID=$!
pkill -F $PIDFILE
echo $NEWPID > $PIDFILE