Wallpaper changer in mate

michelsaey
  11 years ago
  13

You can change your wallpaper automatically in mate by writing a bash script.

I marked the ones in red where to put your variables.

-open your editor (ex. pluma)

- copy and paste the following and edit your variables (one variable for the seconds between wallpapers to change and the other one is the location where the wallpapers located at. Note: the .jpg files may not have spaces in the filename.

 

# Script to randomly set Background from files in a directory
while true;do
# specify how long to wait in seconds between changes
sleep 3600
# Directory Containing Pictures
DIR="/home/michel/Wallpapers"

# Command to Select a random jpg file from directory
# Delete the *.jpg to select any file but it may return a folder
PIC=$(ls $DIR/*.jpg | shuf -n1)

# Command to set Background Image
mateconftool-2 -t string -s /desktop/mate/background/picture_filename $PIC
done

 

-save the file and name it in a way that it means something to you with .sh extension for example wallpaper_changer.sh

-open a terminal and go to the file's dir

-make the file executable by typing: chmod 700 wallpaper_changer.sh

-then type: sh wallpaper_changer.sh &

 

-You may want to add the command 'sh /home/username/wallpaper_changer.sh &' to your startup applications

Comments
mfc0609 6 years ago

Just wanted to say thank you. Was getting frustrated trying to get this seemingly simple task done for Mint 18 (Sarah) 64bit Mate found this page and Trapper333's "slightly altered script" worked like a charm.


michelsaey 8 years ago

I stopped using Mate a long time ago in favor of Xfce so my apologies for not be able to updating this script here in the comments.

Many thanks for those who had updated this script when something changes in Mate. The users of Mate are thankful for that. ;-)


Trapper333 9 years ago

I tried momist's suggestion of "Variety" in LM17 64bit MATE and it worked well for me. Lots of options too.

I also tried this slightly altered script and it worked as a basic wallpaper changer in LM17 with MATE:

# Script to randomly set Background from files in a directory

while true;do

# Directory Containing Pictures
DIR="/home/me/mypics"

# Make sure spaces do not break our script.
IFS='
'

# Command to Select a random jpg file from directory
# Delete the *.jpg to select any file but it may return a folder
PIC=$(ls $DIR/*.jpg | shuf -n1)

# Command to set Background Image
gsettings set org.mate.background picture-filename $PIC

# specify how long to wait in seconds between changes
sleep 600

done

#Save the script above as a script. I simply named it wallpaper_changer.sh

#-make the file executable by typing: chmod 700 /home/me/where-it-is/wallpaper_changer.sh

#-then type: sh /home/me/where-it-is/wallpaper_changer.sh &

#-You may want to add the command '/home/me/where-it-is/wallpaper_changer.sh &' to your startup applications

I much prefer 'Variety'.


Ikem 10 years ago

To change the wallpaper on the shell I use this command:

gsettings set org.mate.background picture-filename "$PICTURE"


momist 10 years ago

OK, for those looking here hoping for a solution. Linux Mint 15 Olivia with MATE desktop. The program "Variety" works for me. http://peterlevi.com/variety/how-to-install/


momist 10 years ago

Hmm, Can anyone please suggest how this can be adapted for Mint 15 Olivia MATE? The scripts given don't work for me, and I suspect that this is down to changes in the way the desktop background is set in MATE.


@ dark-sun, Your script gives me this in the terminal:
wallpaper_changer.sh: 16: wallpaper_changer.sh: mateconftool-2: not found
wallpaper_changer.sh: 17: wallpaper_changer.sh: mateconftool-2: not found

@ triplemaya, yours gives this:
~ $ Usage:
gsettings [--schemadir SCHEMADIR] set SCHEMA[:PATH] KEY VALUE

Set the value of KEY to VALUE

Arguments:
SCHEMADIR A directory to search for additional schemas
SCHEMA The name of the schema
PATH The path, for relocatable schemas
KEY The key within the schema
VALUE The value to set


herbie643 11 years ago

Perfect, just what I was looking for.


yves910 11 years ago

Thanks !