Configure the wallpaper

This commit is contained in:
Rodolphe Bréard 2023-10-21 16:27:26 +02:00
parent 2402a04c36
commit 8325e2d0f8
4 changed files with 15 additions and 13 deletions

View file

@ -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

View file

@ -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

3
.gitignore vendored
View file

@ -15,3 +15,6 @@ __pycache__/
# Emacs
.emacs.d/auto-save-list/
# Auto-generated hyprpaper configuration file
.config/hypr/hyprpaper.conf

View file

@ -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