diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index ee63a8c..cc12d76 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -12,6 +12,7 @@ monitor=eDP-1,1920x1080@60,0x0,1 # Execute your favorite apps at launch # exec-once = waybar & hyprpaper & firefox +exec-once = ~/.local/bin/set_wallpaper exec-once = hyprpaper exec-once = waybar diff --git a/.config/hypr/hyprpaper.conf b/.config/hypr/hyprpaper.conf deleted file mode 100644 index f58c33d..0000000 --- a/.config/hypr/hyprpaper.conf +++ /dev/null @@ -1,4 +0,0 @@ -preload = /home/rodolphe/pictures/wallpapers/2018-06-03_Komona-sunset_by-David-Revoy.jpg - -wallpaper = monitor1,/home/rodolphe/pictures/wallpapers/2018-06-03_Komona-sunset_by-David-Revoy.jpg -wallpaper = eDP-1,/home/rodolphe/pictures/wallpapers/2018-06-03_Komona-sunset_by-David-Revoy.jpg diff --git a/.gitignore b/.gitignore index 9230d78..300d96d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ __pycache__/ # Emacs .emacs.d/auto-save-list/ + +# Auto-generated hyprpaper configuration file +.config/hypr/hyprpaper.conf diff --git a/bin/set_wallpaper b/bin/set_wallpaper index 7502ece..687a1f8 100755 --- a/bin/set_wallpaper +++ b/bin/set_wallpaper @@ -4,13 +4,15 @@ set -euo pipefail IFS=$'\n\t' WALLPAPER_DIRECTORY="$HOME/pictures/wallpapers/enabled" -WALLPAPER_FILE="$(find "$WALLPAPER_DIRECTORY" -type l -print | shuf | head -n 1)" +HYPRPAPER_CNF="$HOME/.config/hypr/hyprpaper.conf" -case "$1" in - sway) - swaymsg --quiet output "*" bg "$WALLPAPER_FILE" fill - ;; - *) - hash feh 2>/dev/null && feh --bg-scale "$WALLPAPER_FILE" - ;; -esac +if [ -d "$WALLPAPER_DIRECTORY" ]; then + WALLPAPER_FILE="$(find "$WALLPAPER_DIRECTORY" -type l -print | shuf | head -n 1)" + if [ -L "$WALLPAPER_FILE" ]; then + WALLPAPER_FILE="$(readlink -f "$WALLPAPER_FILE")" + fi + cat >"$HYPRPAPER_CNF" << EOF +preload = $WALLPAPER_FILE +wallpaper = ,$WALLPAPER_FILE +EOF +fi