diff --git a/README.md b/README.md index be22605..cb09b2b 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ The following packages are required for the proper functioning of Hyprland on Vo - Waybar - swaybg - - playerctl - - [swww](https://github.com/LGFae/swww) : path /usr/local/bin - mpvpaper + - [swww](https://github.com/LGFae/swww) : path /usr/local/bin + - playerctl - swaylock or [swaylock-effects](https://github.com/mortie/swaylock-effects) - grim - slurp diff --git a/hyprland/.config/environments/env.sh b/hyprland/.config/environments/env.sh index ca93801..90b4847 100755 --- a/hyprland/.config/environments/env.sh +++ b/hyprland/.config/environments/env.sh @@ -7,8 +7,9 @@ export WAYBAR_DIR="$HOME/.config/waybar/$WAYBAR_THEME" export WAYBAR_LAUNCHER="waybar -c $WAYBAR_DIR/config.jsonc -s $WAYBAR_DIR/style.css" export WAYBAR_INOTIFY_EVENTS="-e close_write,move,create" -# wallpaper configs : +# wallpaper configs - swaybg, swww, mpvpaper : +export WALLPAPER_DAEMON="mpvpaper" export WALLPAPERS_DIR="$HOME/Wallpapers" -export WALLPAPER_DAEMON="swaybg" # swaybg or swww +export LIVE_WALLPAPERS_DIR="$HOME/Wallpapers/Live" export SWWW_FPS=144 export SWWW_DURATION=2 diff --git a/hyprland/.config/hypr/scripts/mpvpaper-random.sh b/hyprland/.config/hypr/scripts/mpvpaper-random.sh new file mode 100755 index 0000000..f3838ce --- /dev/null +++ b/hyprland/.config/hypr/scripts/mpvpaper-random.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +source $HOME/.config/environments/env.sh + +files=($(find "${LIVE_WALLPAPERS_DIR}" -type f)) + +if [ ${#files[@]} -eq 0 ]; then + dunstify "No files found in the directory: ${LIVE_WALLPAPERS_DIR}" + exit 1 +fi + +video_files=() +for file in "${files[@]}"; do + if file -b --mime-type "$file" | grep -q "^video/"; then + video_files+=("$file") + fi +done + +if [ ${#video_files[@]} -eq 0 ]; then + echo "No video files found in the directory: ${WALLPAPERS_DIR}" + exit 1 +fi + +random_video=${video_files[$RANDOM % ${#video_files[@]}]} + +if [[ $(pidof mpvpaper) ]]; then + pkill mpvpaper +fi + +mpvpaper -o "loop-file" "*" $random_video diff --git a/hyprland/.config/hypr/scripts/swaybg-random.sh b/hyprland/.config/hypr/scripts/swaybg-random.sh index 79093a3..e8d2b99 100755 --- a/hyprland/.config/hypr/scripts/swaybg-random.sh +++ b/hyprland/.config/hypr/scripts/swaybg-random.sh @@ -5,7 +5,7 @@ source $HOME/.config/environments/env.sh files=($(find "${WALLPAPERS_DIR}" -type f)) if [ ${#files[@]} -eq 0 ]; then - echo "No files found in the directory: ${WALLPAPERS_DIR}" + dunstify "No files found in the directory: ${WALLPAPERS_DIR}" exit 1 fi @@ -17,7 +17,7 @@ for file in "${files[@]}"; do done if [ ${#image_files[@]} -eq 0 ]; then - echo "No image files found in the directory: ${WALLPAPERS_DIR}" + dunstify "No image files found in the directory: ${WALLPAPERS_DIR}" exit 1 fi diff --git a/hyprland/.config/hypr/scripts/swww-random.sh b/hyprland/.config/hypr/scripts/swww-random.sh index 3ca023d..9f1d845 100755 --- a/hyprland/.config/hypr/scripts/swww-random.sh +++ b/hyprland/.config/hypr/scripts/swww-random.sh @@ -9,7 +9,7 @@ fi files=($(find "${WALLPAPERS_DIR}" -type f)) if [ ${#files[@]} -eq 0 ]; then - echo "No files found in the directory: ${WALLPAPERS_DIR}" + dunstify "No files found in the directory: ${WALLPAPERS_DIR}" exit 1 fi @@ -21,7 +21,7 @@ for file in "${files[@]}"; do done if [ ${#image_files[@]} -eq 0 ]; then - echo "No image files found in the directory: ${WALLPAPERS_DIR}" + dunstify "No image files found in the directory: ${WALLPAPERS_DIR}" exit 1 fi diff --git a/hyprland/.config/hypr/scripts/wallpaper-daemon.sh b/hyprland/.config/hypr/scripts/wallpaper-daemon.sh index 2a1f9cb..ee4418b 100755 --- a/hyprland/.config/hypr/scripts/wallpaper-daemon.sh +++ b/hyprland/.config/hypr/scripts/wallpaper-daemon.sh @@ -9,17 +9,20 @@ fi case $WALLPAPER_DAEMON in "swaybg") - if [[ $(pidof swww-daemon) ]]; then - pkill swww-daemon - fi + pkill -f swww-daemon + pkill -f mpvpaper exec $HOME/.config/hypr/scripts/swaybg-random.sh ;; "swww") - if [[ $(pidof swaybg) ]]; then - pkill swaybg - fi + pkill -f swaybg + pkill -f mpvpaper exec $HOME/.config/hypr/scripts/swww-random.sh ;; +"mpvpaper") + pkill -f swaybg + pkill -f swww-daemon + exec $HOME/.config/hypr/scripts/mpvpaper-random.sh + ;; *) echo "Unknown value for WALLPAPER_DAEMON: $WALLPAPER_DAEMON" exit 1