aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/UserScripts/WallpaperSelect.sh
diff options
context:
space:
mode:
authorJaKooLit <jimmielovejay.com>2024-01-01 15:13:32 +0900
committerJaKooLit <jimmielovejay.com>2024-01-01 15:13:32 +0900
commit16621bef0e8e3419f82389ba841b97db40a555b1 (patch)
tree01d154902acde99d3e110072259a9d72f1eee4af /config/hypr/UserScripts/WallpaperSelect.sh
parent978cb01c7794ca6aabc613810b23698f94fad298 (diff)
- Breaking Changes.
- Quick Edit script moved to user scripts - I understand some users wants to use other editor - RofiBeats moved to user scripts - This is because users wants their own stations :) - RofiBeats keybinds changed to SUPER SHIFT M keybind - Keybinds to change layout SUPER ALT L - Wlogout Script adjusted with 4K. - Wallpaper Scripts are moved to UserScripts. This is because if users has a different location of wallpapers and also wants a different animations
Diffstat (limited to 'config/hypr/UserScripts/WallpaperSelect.sh')
-rwxr-xr-xconfig/hypr/UserScripts/WallpaperSelect.sh86
1 files changed, 86 insertions, 0 deletions
diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh
new file mode 100755
index 00000000..5c3f2b94
--- /dev/null
+++ b/config/hypr/UserScripts/WallpaperSelect.sh
@@ -0,0 +1,86 @@
+#!/bin/bash
+
+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
+ 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
+ else
+ echo "Image not found."
+ exit 1
+ fi
+}
+
+# Check if rofi is already running
+if pidof rofi > /dev/null; then
+ pkill rofi
+ exit 0
+fi
+
+main
+
+sleep 0.5
+${SCRIPTSDIR}/PywalSwww.sh
+sleep 0.2
+${SCRIPTSDIR}/Refresh.sh
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage