From db8c10313dbdeb57a8e1758846ab5e8b610b5148 Mon Sep 17 00:00:00 2001 From: TiynGER Date: Fri, 27 Mar 2020 17:31:53 +0100 Subject: [PATCH] changing back to lukes setbg --- .local/bin/tools/setbg | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.local/bin/tools/setbg b/.local/bin/tools/setbg index 5c5e8a3..be4adfd 100755 --- a/.local/bin/tools/setbg +++ b/.local/bin/tools/setbg @@ -1,5 +1,22 @@ #!/bin/sh -# Sets the background. -wallDir=~/.config/wallpaper/$(date | awk '{print $1}') -currWall=$wallDir/$(ls $wallDir | shuf -n 1) -xwallpaper --zoom $currWall + +# In LARBS, ~/.config/wall.png is the location of the system wallpaper. This +# script, if given an argument, moves it there. This script without an +# argument sets ~/.config/wall.png as the wallpaper, which is required on login +# if you don't want a black screen. +# +# You may also give a directory name to select a random image from that +# directory as a wallpaper. Be careful that the directory only has images. + +[ -f "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed." + +[ -d "$1" ] && cp "$(find "$1" -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -type f | shuf -n 1)" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Random Wallpaper chosen." + +# If pywal is installed, use it. +type wal >/dev/null 2>&1 && { wal -c + wal -s -i ~/.config/wall.png -o ~/.config/wal/postrun + xsetroot -name "fsignal:xrdb" + killall dwmblocks + setsid dwmblocks >/dev/null & } >/dev/null 2>&1 + +xwallpaper --zoom ~/.config/wall.png