setbg (734B) - raw


      1 #!/bin/sh
      2 
      3 # This script does the following:
      4 #	Run by itself, set the wallpaper (at X start).
      5 #	If given a file, set that as the new wallpaper.
      6 #	If given a directory, choose random file in it.
      7 
      8 # Location of link to wallpaper link.
      9 bgloc="${XDG_CACHE_HOME:-$HOME/.cache/}wall.png"
     10 
     11 [ -f "$1" ] && ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..."
     12 
     13 [ -d "$1" ] && ln -sf "$(find "$(readlink -f "$1")" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen."
     14 
     15 # # If pywal is installed, use it.
     16 # wal -s -i "$(readlink -f "$bgloc")" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1
     17 
     18 xwallpaper --zoom "$bgloc" &
     19