| Written by: | michelsaey |
Score: 8 votes: 11 Format: Article |
Wallpaper changer in mate
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
Tags: wallpaper changer mate
Created: 10 months ago.
Last edited: 10 months ago.
Reviewed: 10 months ago.
Read 0 times.
| Comments | |||
| 1 week ago |
triplemaya |
To make either this script, or my adapted script below, work even if there are spaces in the filename add the following lines before calling the command PIC=$(ls $DIR/*.jpg | shuf -n1) # Internal Field Separator set to newline, so file names with # spaces do not break our script. IFS=' ' |
|
| 1 week ago |
triplemaya |
I am running MATE 1.6 and there is no mateconftool (or gconftool or dconftool). Instead there is gsettings which works on the dconf database. Below is the new version of the script I got running after a bit of trial and error. Many thanks to Michel for the original. This should work on all newer versions as the dconf/gsettings is the new way. (Yes to one of the comments, the old scripts run OK, but the script is changing the settings in the gconf database not the dconf database, and it is the dconf database which controls the background wallpaper in newer versions.) # Script to randomly set Background from files in a directory while true;do # 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 gsettings set org.mate.background picture-filename $PIC # specify how long to wait in seconds between changes sleep 600 done I put the sleep at the end so you can tell at once if it is working when you fire it up! |
|
| 1 month ago |
tt_brv |
Thank You for that, it worked well on my Xubuntu with Mate-Desktop. But after upadting From Mate 1.4 to 1.6 something must have changed it does not make this job anymore. Is it possible to change the script so that it suits to the new Mate 1.6 ? Best wishes from Uwe |
|
| 2 months ago |
mintymouse |
It's a good script but to get it to work on my mint 13 MATE 64 install it needed a some cleaning up. This one works much better. I put all the wallpapers I want to be included in the random image selection together in a separate directory so if I want a wallpaper to be added or removed from the list of possibilities I simply copy it to or remove it from that directory. I also made two separate script files, the one you see below and an identical one that's had the "while true;do", "sleep" and "done" lines removed. The first was added to my start up programs list. For the second one I added a launcher for it to the panel so now I can just click it any time I want a new wallpaper to be picked instantly instead of waiting for the timed version to do it. # Script to randomly set Background from files in a directory while true;do # Directory Containing Pictures DIR="/home/user/path/" # 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 | shuf -n1) # Command to set Background Image, !!The reason it wasn't working here was because the path to the image had to be included too. Note that "picture_filename" and "picture-filename" are both separate and valid entries. mateconftool-2 -t string -s /desktop/mate/background/picture_filename $DIR$PIC mateconftool-2 -t string -s /desktop/mate/background/picture-filename $DIR$PIC # specify how long to wait in seconds between changes sleep 300 #300 is 5 minutes, 600 is 10 minutes, 900 is 15, etc done |
|
| 2 months ago |
surferbob644 |
Since I couldn't get any wallpaper changer to work in Mate, they all said they were running but the desktop pic is stuck on the default Linux Mint wallpaper, I thought I'd try running your shell script. Same result. I know the script is active. I guess I'll have to post in the forum. Thanks though. I'm going to get this to work. | |
| 4 months ago |
herbie643 |
Perfect, just what I was looking for. | |
| 10 months ago |
yves910 |
Thanks ! | |
Other tutorials from michelsaey
- Shutdown/Restart - Get rid of authentication during shutdown/restart
- Check HP printer or multifunctional ink level
- Connect to a wireless network as standard user without administrator authentication
- Reduce swappines
- Use 'Windows-key' for opening main menu instead of 'Alt-F1' in Mate
- Change ugly fonts in Firefox (KDE)
- Run pulseaudio systemwide
- Change file permissions with chmod
- Change Font Type and Color of Panel Clock in Mate
Ideas
Tutorials
Hardware
Software
Countries
Users
Moderation
Chat room
ISO Images