#!/bin/bash
if [ -f ~/.xlock ]; then exit; fi

if [ -f ~/bg/monitor_scc ]; then
    DISPLAY=:0 nitrogen --set-auto ~/bg/3840x1200/"$(ls ~/bg/3840x1200/ | shuf -n 1)"
    exit
else
    comb=~/bg/combined_3og
    first=~/bg/1920x1200
    sec=~/bg/1600x900
fi

pic1="$(ls $first/ | shuf -n 1)"
pic2="$(ls $sec/ | shuf -n 1)"

pic=$comb/"${pic1/.jpg}$pic2"

if [ ! -f "$pic" ]; then
    while [ $(ls $comb | wc -l) -gt 299 ]; do
        picr="$(ls $comb | shuf -n 1)"
        rm -f $comb/"$picr"
    done
    convert $first/"$pic1" $sec/"$pic2" +append "$pic"
fi

DISPLAY=:0 nitrogen --set-auto "$pic"

Add a code snippet to your website: www.paste.org