From 88296d593b0375b0737f17b16c13369aa1d3009b Mon Sep 17 00:00:00 2001 From: hesam-init Date: Wed, 14 Feb 2024 21:49:38 +0330 Subject: [PATCH] feat: random wallpaper on startup --- hyprland/.config/hypr/scripts/swww-launch.sh | 4 +--- hyprland/.config/hypr/scripts/swww-random.sh | 7 ------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/hyprland/.config/hypr/scripts/swww-launch.sh b/hyprland/.config/hypr/scripts/swww-launch.sh index 3051697..07a666b 100755 --- a/hyprland/.config/hypr/scripts/swww-launch.sh +++ b/hyprland/.config/hypr/scripts/swww-launch.sh @@ -1,11 +1,9 @@ #!/usr/bin/env bash -source $HOME/.config/hypr/scripts/env.sh - if [[ $(pidof swaybg) ]]; then pkill swaybg fi swww query || swww init -swww img $wallpapers_dir/macos.jpg --transition-fps $swww_fps --transition-type any --transition-duration $swww_duration +exec $HOME/.config/hypr/scripts/swww-random.sh diff --git a/hyprland/.config/hypr/scripts/swww-random.sh b/hyprland/.config/hypr/scripts/swww-random.sh index 9bb0918..573a436 100755 --- a/hyprland/.config/hypr/scripts/swww-random.sh +++ b/hyprland/.config/hypr/scripts/swww-random.sh @@ -2,16 +2,13 @@ source $HOME/.config/hypr/scripts/env.sh -# Get only files from the directory files=($(find "${wallpapers_dir}" -type f)) -# Check if there are any files if [ ${#files[@]} -eq 0 ]; then echo "No files found in the directory: ${wallpapers_dir}" exit 1 fi -# Filter files to include only those identified as images by the 'file' command image_files=() for file in "${files[@]}"; do if file -b --mime-type "$file" | grep -q "^image/"; then @@ -19,15 +16,11 @@ for file in "${files[@]}"; do fi done -# Check if there are any image files if [ ${#image_files[@]} -eq 0 ]; then echo "No image files found in the directory: ${wallpapers_dir}" exit 1 fi -# Get a random image from the array random_pic=${image_files[$RANDOM % ${#image_files[@]}]} -echo $random_pic - swww img "$random_pic" --transition-fps $swww_fps --transition-type any --transition-duration $swww_duration