1

So I've got a program called "Display Fusion" installed on my Windows drive, and I love it for literally only one feature:

I can set it up to that each of my 3 monitors randomly changes the wallpaper every X minutes. I can point it at a folder I have of 500+ wallpapers, and each monitor will individually randomly pick one (so they hardly ever have the same wallpaper on each two screens).


I'm running Debian Jessie, with Gnome Shell 3.14.4, and so far I've tried the follow apps, and had the follow issues:

Nitrogen: Doesn't work at all. Can't set "Have File Manager handle Desktop" to "OFF" since Gnome Tweak Tool doesn't list that option anywhere.

Syncwall: Doesn't actually have any way to set different wallpapers for each monitor, but has the random cycling feature done perfectly.


Is there any other potential software I'm missing that can do what I'm trying to do?

Am I missing something obviously with the software I've already tried?


Update 1:

Tried out the second code-block in Gilles' answer:

#!/bin/sh
wallpaper_directory= MY WALLPAPER FOLDER
interval=300 # in seconds
IFS='
'; set -ef
while true; do
  set $(find "$wallpaper_directory" -type f | shuf -r -n 3)
  xloadimage -onroot -at 0,0 "$1" -at 1920,0 "$2" -at 3840,0 "$3"
  sleep "$interval"
done

added it to /etc/init.d/

and ran chmod 755 wallpaper_script.sh

and update-rc.d wallpaper_script.sh defaults

So now, I've got my Tweak Tools settings set to the following:

Gnome3 Tweak-Tools Desktop settings

And my background on all 3 monitors is now a solid blue.

BUT, when I reboot (ans presumably after the Gnome Shell stops running) I can see 3 of my wallpapers flash right before the reboot happens.

So the script appears to be working, but Gnome is conflicting, and after digging around in gsettings and dconf-editor I still cant seem to find a setting that does what Tweak-Tools did back in Gnome2.

  • 1
    KDE does it out of the box, if you're willing to switch away from Gnome Shell. – drewbenn Apr 9 '16 at 0:29
  • 1
    @drewbenn I've heard. But I'm too much of a Gnome-lover. – WorseDoughnut Apr 9 '16 at 0:30
1

If Gnome doesn't have anything built in, you can write a script to do it. The following loads random wallpapers from ~/wallpapers on three monitors, assumed to be arranged left-to-right with each monitor being 1680 pixels wide. It uses xloadimage (see Multiple images on root window with ImageMagick). Adjust the monitor sizes and the wallpaper locations as suitable. If you want the wallpapers to be distinct, remove the -r option to shuf. For more monitors, increase the parameter of shuf -n.

#!/bin/sh
IFS='
'; set -f
set $(find ~/wallpapers -type f | shuf -r -n 3)
xloadimage -onroot -at 0,0 "$1" -at 1680,0 "$2" -at 3360,0 "$3"

To change the wallpaper every N minutes, add the following script to your session startup applications.

#!/bin/sh
wallpaper_directory=~/wallpapers
interval=300 # in seconds
IFS='
'; set -ef
while true; do
  set $(find "$wallpaper_directory" -type f | shuf -r -n 3)
  xloadimage -onroot -at 0,0 "$1" -at 1680,0 "$2" -at 3360,0 "$3"
  sleep "$interval"
done

Here's a more complex script that calls xrandr to get the monitor sizes and positions. This variant assumes that the wallpapers are in a subdirectory named after the monitor sizes, e.g. ~/wallpapers/1680x1050.

#!/bin/sh
wallpaper_directory=~/wallpapers
interval=300 # in seconds

random_wallpaper () {
  find ~/wallpapers/$1 -type f | shuf -n 1
}
command="xloadimage -onroot"
i=1
for m in $(xrandr | sed -n 's/^.* connected.*[^0-9]\([0-9]*x[0-9]*\)+\([0-9]*\)+\([0-9]*\).*$/\1,\2,\3/p'); do
  size="${m%%,*}" position="${m#*,}"
  command="$command -at $position \"\$(random_wallpaper $size)\""
  i=$((i+1))
done

if ! eval "$command"; then
  echo >&2 "Unable to load initial wallpapers, aborting."
  exit 2
fi
while sleep "$interval"; do
  eval "$command"
done

(Warning: all code in this answer is untested.)

Alternatively, there may be a way to get Nitrogen to work by setting the the right value with gsettings (mimicking what the Tweak Tool did in Gnome 2), but I don't know what key needs to be changed.

  • So for 3 monitors @ 1920 wide each, I would just change this line xloadimage -onroot -at 0,0 "$1" -at 1680,0 "$2" to xloadimage -onroot -at 0,0 "$1" -at 1920,0 "$2" -at 3840,0 "$3"? – WorseDoughnut Apr 11 '16 at 12:42
  • @WorseDoughnut Yes, and change shuf -n 2 to shuf -n 3. I've also added a script that detects the monitor positions and sizes automatically (again, untested). – Gilles Apr 11 '16 at 15:12
  • Awesome, I'll test this out when I get home. I'm actually glad there's a scripting solution to this, a much easier than trying to find software for my specific needs (hence why I'm using Debian in the first place). – WorseDoughnut Apr 11 '16 at 17:30
  • Tried your second code-block / script out, please see my edit to the main question. – WorseDoughnut Apr 12 '16 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.