FOND d'écran: adaptation pour Sway

This commit is contained in:
Olivier DOSSMANN 2021-06-26 01:15:49 +02:00
parent d4233d6440
commit 18021a3eb5
2 changed files with 18 additions and 3 deletions

View File

@ -3,3 +3,6 @@ exec wlsunset -l 48.5680685 -L 7.7709942
# Notifications de bureau # Notifications de bureau
exec dunst exec dunst
# Fond d'écran aléatoire
exec_always "kill -9 `ps aux | grep random_wallpaper |grep -v 'grep'| awk '{print $2}'`; random_wallpaper &"

View File

@ -6,11 +6,19 @@
directory="$HOME/wallpapers" directory="$HOME/wallpapers"
minutes=15 minutes=15
PROGRAM=`which feh`
# Some tests # Some tests
if [ -z "`which feh`" ]; then if [[ "$XDG_SESSION_TYPE" -eq "wayland" ]]; then
PROGRAM=`which swaymsg`
if [ -z "${PROGRAM}" ]; then
echo "This script needs the swaymsg program."
exit 1
fi
wayland=1
elif [ -z "${PROGRAM}" ]; then
echo "This script needs the feh program. Install it." echo "This script needs the feh program. Install it."
i exit 1 exit 1
fi fi
if [ -d '$directory' ]; then if [ -d '$directory' ]; then
@ -40,7 +48,11 @@ while true; do
# Change background # Change background
file="${array_files["$NUMBER"]}" file="${array_files["$NUMBER"]}"
feh --bg-fill "$directory/$file" if [[ -n wayland ]]; then
$PROGRAM output "*" bg "$directory/$file" fill
else
feh --bg-fill "$directory/$file"
fi
# Wait some times # Wait some times
sleep $seconds sleep $seconds