30

Can anyone help me out with how to make Bing Picture to my Desktop Wallpaper?

  • So it works by downloading the highest quality of todays picture.
  • Then storing it ex in the Picture folder of your account.
  • After that automatically changing the picture itself.
  • It should continue the same everyday without hassle in the background.
  • Probably something I have to add in the Startup Applications.
  • Any differences between Ubuntu versions?

-Do I have to write a script? This would be appreciated by many others too! Thank You in Advance :)

3
  • even i would love to use this,but I believe its not possible..
    – Sukupa91
    Nov 19, 2013 at 14:44
  • thejandroman.github.io/bing-wallpaper does this solve? I personally didn't use this.
    – nitishch
    Nov 19, 2013 at 14:47
  • I have tried the above link previously with its instructions, from github, @nitish. But it did not work, so i am trying to find other solutions. I got an error about connection failure to GitHubs server(s). The instructions where not easy to follow earther. OMGUbuntu have also an HowTo, but even that one also failed... Nov 19, 2013 at 15:12

8 Answers 8

24

Probably the easiest thing to do would be to install variety. It is a wall-paper manager that really does an excellent job to change your wallpaper at the frequency you want.

Here are some of its settings:

  • the frequency of the download
  • the frequency of changing the image (once a day, at every reboot, every minute,...)
  • where you want to download your images from
  • where you want to store them on your computer
  • quotes (either automatically or from a source)
  • a nice clock.

There is also a setting to run it at login. If you enable that and then add your bing image of the day url (http://www.bing.com/images/search?q=picture+of+the+day&qpvt=picture+of+the+day&FORM=IGRE?), you are all set.

It can be found in the software center and it has a 5* rating!

Here are some screenshots:

enter image description here enter image description here enter image description here

4
  • 1
    Variety does not exist on 14.04. Sep 4, 2014 at 11:03
  • found these instructions for installing Variety on 14.04 peterlevi.com/variety/how-to-install
    – Doug T.
    Jan 9, 2016 at 17:25
  • Is available on 16.04, made with GTK works great with KDE though. Aug 9, 2016 at 12:52
  • Variety now has an inbuilt option to select Bing Photo of the Day as well.
    – Sandeep C
    Oct 24, 2017 at 10:33
16

I wrote a little node script that does exactly that : https://github.com/dorian-marchal/bing-daily-wallpaper

To install it, you'll need nodejs :

sudo apt-get install nodejs npm

Installation :

In the command line, run :

sudo npm install -g bing-daily-wallpaper

Usage :

To change the wallpaper, do (you can add this command to your startup apps) :

bing-daily-wallpaper
3
  • Nice, that's an easy solution that works for me on Ubuntu 15 May 12, 2016 at 16:53
  • I followed the above steps but gets an error at usage paper96@localhost:~$ bing-daily-wallpaper /usr/bin/env: ‘node’: No such file or directory @Dorian can you tell me whats wrong Dec 18, 2016 at 12:45
  • @PankajGautam its because in newer ubuntu versions when you do apt-get install nodejs the node executable is actually nodejs not node so if you edit the script sudo vim /usr/local/bin/bing-daily-wallpaper you can replace first line node with nodejs and it works fine.
    – squareborg
    May 25, 2017 at 20:54
8

Some time ago I found the following script (I don't remember exactly where in this moment, but when I will find, I will add the source also) which one I changed a little and which is working great for what you asked if is set as a cron job (see here how to do this):

#!/bin/bash

# export DBUS_SESSION_BUS_ADDRESS environment variable useful when the script is set as a cron job
PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)


# $bing is needed to form the fully qualified URL for
# the Bing pic of the day
bing="www.bing.com"

# $xmlURL is needed to get the xml data from which
# the relative URL for the Bing pic of the day is extracted
#
# The mkt parameter determines which Bing market you would like to
# obtain your images from.
# Valid values are: en-US, zh-CN, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA.
#
# The idx parameter determines where to start from. 0 is the current day,
# 1 the previous day, etc.
xmlURL="http://www.bing.com/HPImageArchive.aspx?format=xml&idx=1&n=1&mkt=en-US"

# $saveDir is used to set the location where Bing pics of the day
# are stored.  $HOME holds the path of the current user's home directory
saveDir="$HOME/Pictures/BingDesktopImages/"

# Create saveDir if it does not already exist
mkdir -p $saveDir

# Set picture options
# Valid options are: none,wallpaper,centered,scaled,stretched,zoom,spanned
picOpts="zoom"

# The desired Bing picture resolution to download
# Valid options: "_1024x768" "_1280x720" "_1366x768" "_1920x1200"
desiredPicRes="_1366x768"

# The file extension for the Bing pic
picExt=".jpg"

# Extract the relative URL of the Bing pic of the day from
# the XML data retrieved from xmlURL, form the fully qualified
# URL for the pic of the day, and store it in $picURL

# Form the URL for the desired pic resolution
desiredPicURL=$bing$(echo $(curl -s $xmlURL) | grep -oP "<urlBase>(.*)</urlBase>" | cut -d ">" -f 2 | cut -d "<" -f 1)$desiredPicRes$picExt

# Form the URL for the default pic resolution
defaultPicURL=$bing$(echo $(curl -s $xmlURL) | grep -oP "<url>(.*)</url>" | cut -d ">" -f 2 | cut -d "<" -f 1)

# $picName contains the filename of the Bing pic of the day

# Attempt to download the desired image resolution. If it doesn't
# exist then download the default image resolution
if wget --quiet --spider "$desiredPicURL"
then

    # Set picName to the desired picName
    picName=${desiredPicURL##*/}
    # Download the Bing pic of the day at desired resolution
    curl -s -o $saveDir$picName $desiredPicURL
else
    # Set picName to the default picName
    picName=${defaultPicURL##*/}
    # Download the Bing pic of the day at default resolution
    curl -s -o $saveDir$picName $defaultPicURL
fi

# Set the GNOME3 wallpaper
gsettings set org.gnome.desktop.background picture-uri "file://$saveDir$picName"

# Set the GNOME 3 wallpaper picture options
gsettings set org.gnome.desktop.background picture-options $picOpts

# Remove pictures older than 30 days
#find $saveDir -atime 30 -delete

# Exit the script
exit
3
  • where to add that link of the picture of the day?
    – speedox
    Aug 23, 2014 at 11:46
  • @speedox I can't understand your question... Aug 23, 2014 at 11:53
  • I think that url fetching line can be simplified to desiredPicURL=$bing$(curl -s $xmlURL | grep -oP "(?<=<urlBase>)(.*?)(?=</urlBase>)")$desiredPicRes$picExt
    – Jason
    Apr 23, 2020 at 14:48
3

A nice script is listed here which still works nicely on Ubuntu 14.04 (needs curl installed):

http://ubuntuforums.org/showthread.php?t=2074098

and I will copy the latest version here:

#!/bin/bash

# $bing is needed to form the fully qualified URL for
# the Bing pic of the day
bing="www.bing.com"

# $xmlURL is needed to get the xml data from which
# the relative URL for the Bing pic of the day is extracted
#
# The mkt parameter determines which Bing market you would like to
# obtain your images from.
# Valid values are: en-US, zh-CN, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA.
#
# The idx parameter determines where to start from. 0 is the current day,
# 1 the previous day, etc.
xmlURL="http://www.bing.com/HPImageArchive.aspx?format=xml&idx=0&n=1&mkt=en-US"

# $saveDir is used to set the location where Bing pics of the day
# are stored.  $HOME holds the path of the current user's home directory
saveDir=$HOME'/Pictures/BingDesktopImages/'

# Create saveDir if it does not already exist
mkdir -p $saveDir

# Set picture options
# Valid options are: none,wallpaper,centered,scaled,stretched,zoom,spanned
picOpts="zoom"

# The desired Bing picture resolution to download
# Valid options: "_1024x768" "_1280x720" "_1366x768" "_1920x1200"
desiredPicRes="_1920x1200"

# The file extension for the Bing pic
picExt=".jpg"

# Extract the relative URL of the Bing pic of the day from
# the XML data retrieved from xmlURL, form the fully qualified
# URL for the pic of the day, and store it in $picURL

# Form the URL for the desired pic resolution
desiredPicURL=$bing$(echo $(curl -s $xmlURL) | grep -oP "<urlBase>(.*)</urlBase>" | cut -d ">" -f 2 | cut -d "<" -f 1)$desiredPicRes$picExt

# Form the URL for the default pic resolution
defaultPicURL=$bing$(echo $(curl -s $xmlURL) | grep -oP "<url>(.*)</url>" | cut -d ">" -f 2 | cut -d "<" -f 1)

# $picName contains the filename of the Bing pic of the day

# Attempt to download the desired image resolution. If it doesn't
# exist then download the default image resolution
if wget --quiet --spider "$desiredPicURL"
then

    # Set picName to the desired picName
    picName=${desiredPicURL##*/}
    # Download the Bing pic of the day at desired resolution
    curl -s -o $saveDir$picName $desiredPicURL
else
    # Set picName to the default picName
    picName=${defaultPicURL##*/}
    # Download the Bing pic of the day at default resolution
    curl -s -o $saveDir$picName $defaultPicURL
fi

# Set the GNOME3 wallpaper
DISPLAY=:0 GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture-uri '"file://'$saveDir$picName'"'

# Set the GNOME 3 wallpaper picture options
DISPLAY=:0 GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture-options $picOpts

# Exit the script
exit
2

I checked this for a while and seems to be working.

#!/bin/bash
cd 
rm ./dodo.html
wget --no-proxy --output-document=dodo.html http://www.bing.com
rm ./dwallpaper.jpg
wget --no-proxy --output-document=dwallpaper `sed -n "s/^.*g_img *= *{ *url:'\([^']*\)'.*$/\1/p" < dodo.html | sed 's/^&quot;\(.*\)&quot;$/\1/' | sed 's/^\/\(.*\)/http:\/\/www.bing.com\/\1/'`
rm ./dodo.html
gsettings set org.gnome.desktop.background picture-uri 'file:///home/YourName/dwallpaper'

If you work under proxy, remove --no-proxy from line 4 and 6, and in place of YourName, put the name of your home folder.

Save this as some some script, make it executable and then execute it whenever you want the wallpaper to be updated.

I don't know how to execute this safely at startup. Adding this to rc.local is not safe as I understand from this.

Please comment if anything goes wrong.

4
  • If the script is working (not tested), you can execute it once a day (or whenever you want) using a cron job. Look for example at askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job
    – Rmano
    Dec 7, 2013 at 7:08
  • I think it would be unnecessary to execute it more than once a day. Further, in a day, it is to be executed only once when an internet connection is established. Can cron jobs do that? Can we know when a connection is made?
    – nitishch
    Dec 7, 2013 at 13:49
  • all the works of checking internet connection, downloading the image, setting the desktop background and creating a log to indicate whether the job for the day is pending or complete should be handled by your script; while cron will handle calling the script as per your need..
    – rusty
    Jan 6, 2014 at 17:43
  • For better portability replace last line (gsettings set org.gnome.desktop.background picture-uri 'file:///home/YourName/dwallpaper') with gsettings set org.gnome.desktop.background picture-uri ` echo "'file:///home/$USER/dwallpaper'" `
    – totti
    Jan 8, 2014 at 8:56
2

Here my my tool to download newest wallpapapers from Bing and set it as your desktop wallpaper. You can check it out https://github.com/bachvtuan/Bing-Linux-Wallpaper

2
  • PLease include at least installation and usage instructions in the answer.
    – muru
    Apr 5, 2015 at 9:44
  • @ParanoidPanda That's the link to the source page. If it dies, then this answer would be void anyway.
    – Sparhawk
    Mar 1, 2016 at 5:38
1

you can use bing-wall, works like bing wallpaper for windows.

you can install it with 'sudo snap install bing-wall'

source code is at

https://github.com/keshavbhatt/BingWall

1
  • BingWall changes wallpaper only after system restart. Is there a way to change everyday without restarting?
    – spharish
    Nov 29, 2021 at 5:27
0

I searched for answer but didn't found so I wrote a script to set bing wallpaper. Here's the script...

#!/bin/sh

ping -q -c5 bing.com

if [ $? -eq 0 ]

then

wget "http://www.bing.com/HPImageArchive.aspx?format=rss&idx=0&n=1&mkt=en-US" -O  bing.txt
img_result=$(grep -o 'src="[^"]*"' bing.txt | grep -o '/.*.jpg')
wget "http://www.bing.com"$img_result
img_name=$(grep -o 'src="[^"]*"' bing.txt | grep -o '[^/]*.jpg')
pwdPath=$(pwd)
picPath="/home/YOUR USERNAME/Pictures/Wallpapers"
cp $pwdPath"/"$img_name $picPath
gsettings set org.gnome.desktop.background picture-uri "file://"$picPath"/"$img_name

sleep 10
rm $img_name
rm bing.txt 
fi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .