feat: random wallpaper on startup
This commit is contained in:
parent
b3fecd0ba7
commit
88296d593b
2 changed files with 1 additions and 10 deletions
|
@ -1,11 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
source $HOME/.config/hypr/scripts/env.sh
|
|
||||||
|
|
||||||
if [[ $(pidof swaybg) ]]; then
|
if [[ $(pidof swaybg) ]]; then
|
||||||
pkill swaybg
|
pkill swaybg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
swww query || swww init
|
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
|
||||||
|
|
|
@ -2,16 +2,13 @@
|
||||||
|
|
||||||
source $HOME/.config/hypr/scripts/env.sh
|
source $HOME/.config/hypr/scripts/env.sh
|
||||||
|
|
||||||
# Get only files from the directory
|
|
||||||
files=($(find "${wallpapers_dir}" -type f))
|
files=($(find "${wallpapers_dir}" -type f))
|
||||||
|
|
||||||
# Check if there are any files
|
|
||||||
if [ ${#files[@]} -eq 0 ]; then
|
if [ ${#files[@]} -eq 0 ]; then
|
||||||
echo "No files found in the directory: ${wallpapers_dir}"
|
echo "No files found in the directory: ${wallpapers_dir}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Filter files to include only those identified as images by the 'file' command
|
|
||||||
image_files=()
|
image_files=()
|
||||||
for file in "${files[@]}"; do
|
for file in "${files[@]}"; do
|
||||||
if file -b --mime-type "$file" | grep -q "^image/"; then
|
if file -b --mime-type "$file" | grep -q "^image/"; then
|
||||||
|
@ -19,15 +16,11 @@ for file in "${files[@]}"; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check if there are any image files
|
|
||||||
if [ ${#image_files[@]} -eq 0 ]; then
|
if [ ${#image_files[@]} -eq 0 ]; then
|
||||||
echo "No image files found in the directory: ${wallpapers_dir}"
|
echo "No image files found in the directory: ${wallpapers_dir}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get a random image from the array
|
|
||||||
random_pic=${image_files[$RANDOM % ${#image_files[@]}]}
|
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
|
swww img "$random_pic" --transition-fps $swww_fps --transition-type any --transition-duration $swww_duration
|
||||||
|
|
Loading…
Add table
Reference in a new issue