Fix symlink issue completely

This commit is contained in:
Asocia 2021-08-22 11:28:28 +03:00
parent 36c26436ec
commit 877c16ddb6

View File

@ -22,12 +22,21 @@ else
fi fi
path="$wallpaper_set/$num.$format" path="$wallpaper_set/$num.$format"
echo "path: $path" echo "path: $path"
if [[ (-L "$path") ]]; then
actual_file=$(readlink -f $path)
else
actual_file=$path
fi
# if the file is not a symlink, set the new wallpaper set_wallpaper() {
if [[ ! -L "$path" ]]; wal -st -i $1 --backend=haishoku
then
wal -st -i $path --backend=haishoku
python3 ~/scripts/misc/adjust_terminal_colors.py rgb 0.5 python3 ~/scripts/misc/adjust_terminal_colors.py rgb 0.5
~/scripts/misc/restart_dunst.sh ~/scripts/misc/restart_dunst.sh
xrdb ~/.Xresources xrdb ~/.Xresources
}
# if the current wallpaper is different than the previous one, set it
if [[ $(< ~/.last_wallpaper_path) != "$actual_file" ]]; then
set_wallpaper $path
fi fi
echo "$actual_file" > ~/.last_wallpaper_path