mirror of
https://github.imc.re/void-land/hyprland-void-dots
synced 2025-04-27 01:03:43 +02:00
feat: dynamic wallpaper daemon
This commit is contained in:
parent
78458fcab4
commit
aed62dd72e
9 changed files with 95 additions and 15 deletions
|
@ -6,7 +6,8 @@ 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"
|
||||
|
||||
# swww env :
|
||||
# wallpaper configs :
|
||||
export WALLPAPERS_DIR="$HOME/Wallpapers"
|
||||
export WALLPAPER_DAEMON="swaybg" # swaybg or swww
|
||||
export SWWW_FPS=144
|
||||
export SWWW_DURATION=2
|
||||
|
|
|
@ -11,8 +11,7 @@ exec-once = sleep 1 && /usr/bin/wireplumber &
|
|||
exec-once = wl-paste --watch cliphist store &
|
||||
|
||||
# wallpaper :
|
||||
exec-once = swaybg -i ~/Wallpapers/dark-blue-windows-3840x2160-14391.png &
|
||||
# exec-once = ~/.config/hypr/scripts/swww-launch.sh &
|
||||
exec-once = ~/.config/hypr/scripts/wallpaper-daemon.sh &
|
||||
|
||||
# status bar :
|
||||
exec-once = ~/.config/hypr/scripts/waybar-launch.sh &
|
||||
|
|
|
@ -12,7 +12,7 @@ $terminal = alacritty -o "window.opacity=0"
|
|||
$fileManager = thunar
|
||||
$network_manager = $scr_path/nmtui-launch.sh
|
||||
$screenshot = $scr_path/hyprshot.sh
|
||||
$swww_random = $scr_path/swww-random.sh
|
||||
$random_wallpaper = $scr_path/wallpaper-daemon.sh
|
||||
$waybar_toggle = $scr_path/waybar-toggle.sh
|
||||
$volume_control = $scr_path/volume-control.sh
|
||||
$rofi_menu = $scr_path/rofi-launch.sh d
|
||||
|
|
|
@ -33,7 +33,7 @@ bind = $mainMod, PRINT, exec, $screenshot -m window
|
|||
bind = , PRINT, exec, $screenshot -m output
|
||||
|
||||
# Wallpaper
|
||||
bind = $mainMod, Y, exec, $swww_random
|
||||
bind = $mainMod, Y, exec, $random_wallpaper
|
||||
|
||||
# Audio control
|
||||
binde=,XF86AudioRaiseVolume,exec, $volume_control u
|
||||
|
|
30
hyprland/.config/hypr/scripts/swaybg-random.sh
Executable file
30
hyprland/.config/hypr/scripts/swaybg-random.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
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}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
image_files=()
|
||||
for file in "${files[@]}"; do
|
||||
if file -b --mime-type "$file" | grep -q "^image/"; then
|
||||
image_files+=("$file")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#image_files[@]} -eq 0 ]; then
|
||||
echo "No image files found in the directory: ${WALLPAPERS_DIR}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
random_pic=${image_files[$RANDOM % ${#image_files[@]}]}
|
||||
|
||||
if [[ $(pidof swaybg) ]]; then
|
||||
pkill swaybg
|
||||
fi
|
||||
|
||||
swaybg -i "$random_pic"
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $(pidof swaybg) ]]; then
|
||||
pkill swaybg
|
||||
fi
|
||||
|
||||
swww query || swww init
|
||||
|
||||
exec $HOME/.config/hypr/scripts/swww-random.sh
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
source $HOME/.config/environments/env.sh
|
||||
|
||||
if [[ ! $(pidof swww-daemon) ]]; then
|
||||
swww init
|
||||
fi
|
||||
|
||||
files=($(find "${WALLPAPERS_DIR}" -type f))
|
||||
|
||||
if [ ${#files[@]} -eq 0 ]; then
|
||||
|
|
27
hyprland/.config/hypr/scripts/wallpaper-daemon.sh
Executable file
27
hyprland/.config/hypr/scripts/wallpaper-daemon.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source $HOME/.config/environments/env.sh
|
||||
|
||||
if [ -z "$WALLPAPER_DAEMON" ]; then
|
||||
echo "WALLPAPER_DAEMON is not set in the environment."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $WALLPAPER_DAEMON in
|
||||
"swaybg")
|
||||
if [[ $(pidof swww-daemon) ]]; then
|
||||
pkill swww-daemon
|
||||
fi
|
||||
exec $HOME/.config/hypr/scripts/swaybg-random.sh
|
||||
;;
|
||||
"swww")
|
||||
if [[ $(pidof swaybg) ]]; then
|
||||
pkill swaybg
|
||||
fi
|
||||
exec $HOME/.config/hypr/scripts/swww-random.sh
|
||||
;;
|
||||
*)
|
||||
echo "Unknown value for WALLPAPER_DAEMON: $WALLPAPER_DAEMON"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -18,7 +18,35 @@ show_image_preview() {
|
|||
set_wallpaper() {
|
||||
local wallpaper="$WALLPAPERS_DIR/$1"
|
||||
if [ -f "$wallpaper" ]; then
|
||||
swww img "$wallpaper" --transition-fps "$SWWW_FPS" --transition-type any --transition-duration "$SWWW_DURATION"
|
||||
|
||||
case $WALLPAPER_DAEMON in
|
||||
"swaybg")
|
||||
if [[ $(pidof swww-daemon) ]]; then
|
||||
pkill swww-daemon
|
||||
fi
|
||||
|
||||
if [[ $(pidof swaybg) ]]; then
|
||||
pkill swaybg
|
||||
fi
|
||||
|
||||
swaybg -i "$wallpaper"
|
||||
;;
|
||||
"swww")
|
||||
if [[ ! $(pidof swww-daemon) ]]; then
|
||||
swww init
|
||||
fi
|
||||
|
||||
if [[ $(pidof swaybg) ]]; then
|
||||
pkill swaybg
|
||||
fi
|
||||
|
||||
swww img "$wallpaper" --transition-fps "$SWWW_FPS" --transition-type any --transition-duration "$SWWW_DURATION"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown value for WALLPAPER_DAEMON: $WALLPAPER_DAEMON"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo "Wallpaper set to: $wallpaper"
|
||||
else
|
||||
echo "Error: Wallpaper file not found: $wallpaper"
|
||||
|
|
Loading…
Add table
Reference in a new issue