aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/WallpaperRandom.sh
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2026-07-10 11:21:24 -0700
committerPinapelz <yukais@pinapelz.com>2026-07-10 11:21:24 -0700
commit24de2a31a52d17b6f7214197bdbfeab7428742dd (patch)
treef7736c4712d5a394525a3da2f2b4294e81ba9540 /config/hypr/scripts/WallpaperRandom.sh
parent861bf5be200bfcf2440fec4cda911d29ec18493f (diff)
parentbca86bbec4757cec1f6f5bdea2ed210542f10fae (diff)
Merge remote-tracking branch 'upstream'
Diffstat (limited to 'config/hypr/scripts/WallpaperRandom.sh')
-rwxr-xr-xconfig/hypr/scripts/WallpaperRandom.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/config/hypr/scripts/WallpaperRandom.sh b/config/hypr/scripts/WallpaperRandom.sh
new file mode 100755
index 00000000..8480295c
--- /dev/null
+++ b/config/hypr/scripts/WallpaperRandom.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+# ==================================================
+# KoolDots (2026)
+# Project URL: https://github.com/LinuxBeginnings
+# License: GNU GPLv3
+# SPDX-License-Identifier: GPL-3.0-or-later
+# ==================================================
+# Script for Random Wallpaper ( CTRL ALT W)
+
+PICTURES_DIR="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")"
+wallDIR="$PICTURES_DIR/wallpapers"
+SCRIPTSDIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts"
+# shellcheck source=/dev/null
+. "$SCRIPTSDIR/WallpaperCmd.sh"
+
+focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name')
+wallpaper_base="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/wallpaper_effects/.wallpaper_base_${focused_monitor}"
+
+PICS=($(find -L "${wallDIR}" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.pnm" -o -name "*.tga" -o -name "*.tiff" -o -name "*.webp" -o -name "*.bmp" -o -name "*.farbfeld" -o -name "*.gif" \)))
+RANDOMPICS=${PICS[ $RANDOM % ${#PICS[@]} ]}
+
+
+# Transition config (swww/awww)
+FPS=30
+TYPE="random"
+DURATION=1
+BEZIER=".43,1.19,1,.4"
+if [[ "$WWW_CMD" == "swww" || "$WWW_CMD" == "awww" ]]; then
+ SWWW_PARAMS=(--transition-fps "$FPS" --transition-type "$TYPE" --transition-duration "$DURATION" --transition-bezier "$BEZIER")
+else
+ SWWW_PARAMS=()
+fi
+if ! "$WWW_CMD" query >/dev/null 2>&1; then
+ "$WWW_DAEMON" "${WWW_DAEMON_ARGS[@]}" &
+fi
+resize_mode="$(wallpaper_resize_mode "$RANDOMPICS" "$focused_monitor")"
+"$WWW_CMD" img -o "$focused_monitor" --resize "$resize_mode" "$RANDOMPICS" "${SWWW_PARAMS[@]}"
+
+wait $!
+mkdir -p "$(dirname "$wallpaper_base")"
+cp -f "$RANDOMPICS" "$wallpaper_base" || true
+if ! "$SCRIPTSDIR/WallustSwww.sh" "$RANDOMPICS"; then
+ notify-send -u critical "Wallust failed" "Wallpaper theme not refreshed"
+ exit 1
+fi
+
+wait $!
+sleep 0.5
+"$SCRIPTSDIR/Refresh.sh"
+
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage