Massive Updates
This commit is contained in:
1 parent
007c2f8edb
commit
5f37d6c0ec
109 files changed
+7670
-3972
No files matched your search
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
# This script for selecting wallpapers (SUPER W)
|
||||
|
||||
SCRIPTSDIR="$HOME/.config/hypr/scripts"
|
||||
|
||||
# WALLPAPERS PATH
|
||||
DIR="$HOME/Pictures/wallpapers"
|
||||
|
||||
# Transition config
|
||||
FPS=30
|
||||
TYPE="wipe"
|
||||
DURATION=1
|
||||
BEZIER=".43,1.19,1,.4"
|
||||
SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION"
|
||||
|
||||
# Check if swaybg is running
|
||||
if pidof swaybg > /dev/null; then
|
||||
pkill swaybg
|
||||
fi
|
||||
|
||||
# Retrieve image files
|
||||
PICS=($(ls "${DIR}" | grep -E ".jpg$|.jpeg$|.png$|.gif$"))
|
||||
RANDOM_PIC="${PICS[$((RANDOM % ${#PICS[@]}))]}"
|
||||
RANDOM_PIC_NAME="${#PICS[@]}. random"
|
||||
|
||||
# Rofi command
|
||||
rofi_command="rofi -show -dmenu -config ~/.config/rofi/config-wallpaper.rasi"
|
||||
|
||||
menu() {
|
||||
for i in "${!PICS[@]}"; do
|
||||
# Displaying .gif to indicate animated images
|
||||
if [[ -z $(echo "${PICS[$i]}" | grep .gif$) ]]; then
|
||||
printf "$(echo "${PICS[$i]}" | cut -d. -f1)\x00icon\x1f${DIR}/${PICS[$i]}\n"
|
||||
else
|
||||
printf "${PICS[$i]}\n"
|
||||
fi
|
||||
done
|
||||
|
||||
printf "$RANDOM_PIC_NAME\n"
|
||||
}
|
||||
|
||||
swww query || swww init
|
||||
|
||||
main() {
|
||||
choice=$(menu | ${rofi_command})
|
||||
|
||||
# No choice case
|
||||
if [[ -z $choice ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Random choice case
|
||||
if [ "$choice" = "$RANDOM_PIC_NAME" ]; then
|
||||
swww img "${DIR}/${RANDOM_PIC}" $SWWW_PARAMS
|
||||
|
||||
# Create symbolic link
|
||||
ln -sf "${DIR}/${RANDOM_PIC}" "$HOME/.config/hypr/.current_wallpaper"
|
||||
|
||||
notify-send "Wallpaper Changed" -i "${DIR}/${RANDOM_PIC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find the index of the selected file
|
||||
pic_index=-1
|
||||
for i in "${!PICS[@]}"; do
|
||||
filename=$(basename "${PICS[$i]}")
|
||||
if [[ "$filename" == "$choice"* ]]; then
|
||||
pic_index=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $pic_index -ne -1 ]]; then
|
||||
swww img "${DIR}/${PICS[$pic_index]}" $SWWW_PARAMS
|
||||
|
||||
# Create symbolic link
|
||||
ln -sf "${DIR}/${PICS[$pic_index]}" "$HOME/.config/hypr/.current_wallpaper"
|
||||
|
||||
notify-send "Wallpaper Changed" -i "${DIR}/${PICS[$pic_index]}"
|
||||
else
|
||||
notify-send "Wallpaper Changed" -i "Image not found."
|
||||
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
||||
Reference in new issue
Block a user