feat: mpv wallpaper daemon and throw notif if file not found
This commit is contained in:
parent
d52b472627
commit
dfb73d4194
6 changed files with 48 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
30
hyprland/.config/hypr/scripts/mpvpaper-random.sh
Executable file
30
hyprland/.config/hypr/scripts/mpvpaper-random.sh
Executable file
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue