Wednesday, May 15, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 4181  / 2 Years ago, tue, january 25, 2022, 5:08:40

I have found a guide for that but doesn't sure if it will work or it is safe to use.
The guide: http://www.linuxandubuntu.com/home/how-to-automatically-change-gnome-background-in-intervals-using-bash


I am asking if is these introductions safe and will work? If not, is there any other solutions for that?


I am using Ubuntu 20.04 LTS


Thank you.


More From » wallpaper

 Answers
7

The script worked when I tested in GNOME SHELL 3.36.6


[admin@ADMIN ~]$ gnome-shell --version
GNOME Shell 3.36.6
[admin@ADMIN ~]$

Here is the modified content under my $HOME/.profile file.


# start my custom script for setting random background wallpapers
if [ -f "$HOME/wp.sh" ] ; then
bash $HOME/wp.sh &
fi

Here is the modified content under my $HOME/wp.sh file.


#!/bin/bash
# script to set random background wallpapers on my GNOME desktop
# set base path
export wallpaper_path=/home/admin/Pictures
shopt -s nullglob
# store all the image file names in wallpapers array
wallpapers=(
"$wallpaper_path"/*.jpg
"$wallpaper_path"/*.jpeg
"$wallpaper_path"/*.png
"$wallpaper_path"/*.bmp
"$wallpaper_path"/*.svg
)
# get array size
wallpapers_size=${#wallpapers[*]}

# set wallpapers in incremental order
index=0
while [ $index -lt $wallpapers_size ]
do
gsettings set org.gnome.desktop.background picture-uri "${wallpapers[$index]}"
# index is maxing out, so reset it
if [ $(($index+1)) -eq $wallpapers_size ]
then
index=0
else
index=$(($index + 1))
fi
# keep the wallpaper for the specified time
sleep 1m
done

Wallpapers changed at 1m interval as expected.


[#2634] Wednesday, January 26, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
motivengry

Total Points: 459
Total Questions: 112
Total Answers: 108

Location: Bonaire
Member since Sat, May 1, 2021
3 Years ago
motivengry questions
Tue, Oct 4, 22, 10:02, 2 Years ago
Wed, May 31, 23, 14:33, 1 Year ago
;