aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/UserScripts
diff options
context:
space:
mode:
authorJaKooLit <jimmielovejay@gmail.com>2024-08-10 17:53:41 +0900
committerJaKooLit <jimmielovejay@gmail.com>2024-08-10 17:53:41 +0900
commitd08a0b34245866e06e5c83e5c6f1d0e898e93984 (patch)
treec23be56fc82c138256d603af214e57a04e1cd62d /config/hypr/UserScripts
parent66cfe8e38194b6c8fcaf1d74aa31b264c79751bc (diff)
fix for issue 397 (https://github.com/JaKooLit/Hyprland-Dots/issues/397)
Diffstat (limited to 'config/hypr/UserScripts')
-rwxr-xr-xconfig/hypr/UserScripts/WallpaperSelect.sh34
1 files changed, 23 insertions, 11 deletions
diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh
index 23c02805..25ef30e9 100755
--- a/config/hypr/UserScripts/WallpaperSelect.sh
+++ b/config/hypr/UserScripts/WallpaperSelect.sh
@@ -4,11 +4,10 @@
# WALLPAPERS PATH
wallDIR="$HOME/Pictures/wallpapers"
+SCRIPTSDIR="$HOME/.config/hypr/scripts"
# variables
-SCRIPTSDIR="$HOME/.config/hypr/scripts"
focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}')
-
# swww transition config
FPS=60
TYPE="any"
@@ -40,8 +39,9 @@ menu() {
for pic_path in "${sorted_options[@]}"; do
pic_name=$(basename "$pic_path")
+
# Displaying .gif to indicate animated images
- if [[ -z $(echo "$pic_name" | grep -i "\.gif$") ]]; then
+ if [[ ! "$pic_name" =~ \.gif$ ]]; then
printf "%s\x00icon\x1f%s\n" "$(echo "$pic_name" | cut -d. -f1)" "$pic_path"
else
printf "%s\n" "$pic_name"
@@ -54,15 +54,25 @@ swww query || swww-daemon --format xrgb
# Choice of wallpapers
main() {
- choice=$(menu | ${rofi_command})
+ choice=$(menu | $rofi_command)
+
+ # Trim any potential whitespace or hidden characters
+ choice=$(echo "$choice" | xargs)
+ RANDOM_PIC_NAME=$(echo "$RANDOM_PIC_NAME" | xargs)
+
# No choice case
- if [[ -z $choice ]]; then
+ if [[ -z "$choice" ]]; then
+ echo "No choice selected. Exiting."
exit 0
fi
# Random choice case
- if [ "$choice" = "$RANDOM_PIC_NAME" ]; then
- swww img -o $focused_monitor "${RANDOM_PIC}" $SWWW_PARAMS
+ if [[ "$choice" == "$RANDOM_PIC_NAME" ]]; then
+ swww img -o "$focused_monitor" "$RANDOM_PIC" $SWWW_PARAMS;
+ sleep 0.5
+ "$SCRIPTSDIR/WallustSwww.sh"
+ sleep 0.2
+ "$SCRIPTSDIR/Refresh.sh"
exit 0
fi
@@ -77,7 +87,7 @@ main() {
done
if [[ $pic_index -ne -1 ]]; then
- swww img -o $focused_monitor "${PICS[$pic_index]}" $SWWW_PARAMS
+ swww img -o "$focused_monitor" "${PICS[$pic_index]}" $SWWW_PARAMS
else
echo "Image not found."
exit 1
@@ -87,12 +97,14 @@ main() {
# Check if rofi is already running
if pidof rofi > /dev/null; then
pkill rofi
- exit 0
+ sleep 1 # Allow some time for rofi to close
fi
main
sleep 0.5
-${SCRIPTSDIR}/WallustSwww.sh
+"$SCRIPTSDIR/WallustSwww.sh"
+
sleep 0.2
-${SCRIPTSDIR}/Refresh.sh
+"$SCRIPTSDIR/Refresh.sh"
+
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage