reve/chores/mode/hyprpaper_single.sh

36 lines
1.0 KiB
Bash

#!/usr/bin/env bash
# reve desktop environment framework
# Yigid BALABAN <fyb@fybx.dev> 2024
# chore script
# type mode
# name hyprpaper_single.sh
# desc changes the background depending on the desktop_mode
# vars bg_dark, bg_light
# reload none
if ! command -v hyprpaper &>/dev/null; then
echo "hyprpaper is not installed. Please install it and try again."
exit 1
fi
# shellcheck source=../../_reve.sh
source "$(reve where)/_reve"
bg="$(util_read_config chore."bg_$RV_CURRENT_MODE")"
current_bg="$(util_where_config chore.current_bg)"
# Only change if different from current
if [ "$bg" != "$(readlink -f "$current_bg")" ]; then
hyprctl hyprpaper preload "$bg"
hyprctl hyprpaper wallpaper ",${bg}"
hyprctl hyprpaper unload unused
cp "$bg" "$current_bg"
notify-send --urgency=low --expire-time=1450 --icon="$bg" \
--app-name="reve: hyprpaper_single" \
"Wallpaper changed" \
"Wallpaper changed and saved on $RV_CURRENT_MODE mode."
fi