reve/chores/mode/swww_single.sh
Yigid BALABAN 0602eb1bf7
update background logic
backgrounds saved for light/dark modes are now stored as the absolute
path, so config keys chore.bg_dark and chore.bg_light now contain the
string of absolute path to image files.

in addition to this update, swww_single chore now copies the current
background image to the location of chore.current_bg, which can be used
to directly access the image of the current background.
2024-10-22 16:58:40 +03:00

31 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# reve desktop environment framework
# Yigid BALABAN <fyb@fybx.dev> 2024
# chore script
# type mode
# name swww_single.sh
# desc changes the background depending on the desktop_mode
# vars bg_dark, bg_light
# reload asus_kbd_light.sh
if ! command -v swww &>/dev/null; then
echo "swww is not installed. Please install it and try again."
exit 1
fi
# shellcheck source=../../_reve.sh
source "$(reve where)/_reve"
types=("left" "right" "top" "bottom" "wipe" "wave" "grow" "outer")
ltypes=${#types[@]}
rindex=$((RANDOM % ltypes))
rtype=${types[rindex]}
bg="$(util_read_config chore."bg_$RV_CURRENT_MODE")"
swww img --transition-type "$rtype" --transition-pos 1,1 --transition-step 90 "$bg"
notify-send --urgency=low --expire-time=1450 --icon="$bg" --app-name="reve: swww_single" "Wallpaper changed" "Wallpaper changed and saved on $RV_CURRENT_MODE mode."
cp "$bg" "$(util_where_config chore.current_bg)"
reload misc/asus_kbd_light.sh