diff --git a/share/dotfiles/.config/hypr/conf/autostart.conf b/share/dotfiles/.config/hypr/conf/autostart.conf index ee079c920..1435c5463 100644 --- a/share/dotfiles/.config/hypr/conf/autostart.conf +++ b/share/dotfiles/.config/hypr/conf/autostart.conf @@ -10,6 +10,9 @@ exec-once = ~/.config/hypr/scripts/xdg.sh # Load Wallpaper exec-once = ~/.config/hypr/scripts/wallpaper-restore.sh +# Listen wallpaper changes +exec=once = nohup sh ~/.config/hypr/conf/autostart.conf & + # Start Polkit exec-once=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 diff --git a/share/dotfiles/.config/hypr/conf/monitors/1600x900.conf b/share/dotfiles/.config/hypr/conf/monitors/1600x900.conf new file mode 100644 index 000000000..ef2ba49b2 --- /dev/null +++ b/share/dotfiles/.config/hypr/conf/monitors/1600x900.conf @@ -0,0 +1,6 @@ +# ----------------------------------------------------- +# Monitor Setup +# name: "1600x900" +# ----------------------------------------------------- + +monitor=,1600x900,auto,1 diff --git a/share/dotfiles/.config/ml4w/scripts/listen_wallpaper_change.sh b/share/dotfiles/.config/ml4w/scripts/listen_wallpaper_change.sh new file mode 100755 index 000000000..c13d099ea --- /dev/null +++ b/share/dotfiles/.config/ml4w/scripts/listen_wallpaper_change.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +CURRENT_WALLPAPER_PATH=$HOME/hyprland-setup/dotfiles/dot_config/ml4w/cache/current_wallpaper +CONFIG_FILE=$HOME/hyprland-setup/dotfiles/dot_config/waypaper/config.ini +LAST_WALLPAPER="" + +get_current_wallpaper() { + grep -oP '^wallpaper\s*=\s*\K.*' "$CONFIG_FILE" +} + +LAST_WALLPAPER=$(get_current_wallpaper) + +inotifywait -m -e modify "$CONFIG_FILE" | while read -r path event file; do + CURRENT_WALLPAPER=$(get_current_wallpaper) + + if [[ "$CURRENT_WALLPAPER" != "$LAST_WALLPAPER" ]]; then + LAST_WALLPAPER=$CURRENT_WALLPAPER + echo "El wallpaper ha cambiado: $CURRENT_WALLPAPER" + rm $CURRENT_WALLPAPER_PATH || true + touch $CURRENT_WALLPAPER_PATH || true + echo "$LAST_WALLPAPER" >> $CURRENT_WALLPAPER_PATH + sed -i "s|~|$HOME|g" "$CURRENT_WALLPAPER_PATH" + fi + sleep 0.01 +done