32 lines
918 B
Bash
Executable File
32 lines
918 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [ -z "$1" ]; then
|
|
image=$(zenity --file-selection --title="Open File" --file-filter="*.jpg *.jpeg *.png *.webp *.bmp *.jfif *.tiff *.avif *.heic *.heif")
|
|
else
|
|
image="$1"
|
|
fi
|
|
|
|
[ -z "$image" ] && exit 1
|
|
|
|
ext=${image##*.}
|
|
current_dir="$HOME/.config/wallpaper_chooser/current"
|
|
image_copied="$current_dir/wallpaper.$ext"
|
|
|
|
temp_img=$(mktemp --suffix=.$ext) || exit 1
|
|
cp "$image" "$temp_img" || exit 1
|
|
rm -f "$current_dir"/wallpaper.*
|
|
cp -f "$temp_img" "$image_copied" || (
|
|
rm -f "$temp_img"
|
|
exit 1
|
|
)
|
|
rm -f "$temp_img"
|
|
|
|
hyprctl hyprpaper reload ,"$image_copied" || exit 1
|
|
echo "preload = $image_copied" >"$HOME/.config/hypr/hyprpaper.conf"
|
|
echo "wallpaper = , $image_copied" >>"$HOME/.config/hypr/hyprpaper.conf"
|
|
|
|
notify-send "Wallpaper Changed" "$image"
|
|
|
|
notify-send "Extracting colors from wallpaper" "This may take a few seconds..."
|
|
change-colortheme.py -i "$image_copied" || exit 1
|