Order Randomly Wallpapers

Share your own howto's etc. Not for support questions!

Order Randomly Wallpapers

Postby bester69 » 2016-07-04 23:33

You have hundreds or thousands of Wallpapers and you'd like to enjoy most of them, without having to repeat them.

To achieve this, We link all of them to a target folder, where we'll rename all of them every time in while..

WALL=/home/user/Imágenes/WALLPAPERS/
cd /media/sda4/Imágenes/WALLRANDOM/
rm *

find $WALL -type f -name "*.jpg" -exec ln -s {} \;
find $WALL -type f -name "*.png" -exec ln -s {} \;
for i in *.jpg; do mv "$i" $RANDOM$RANDOM.jpg;done
for i in *.png; do mv "$i" $RANDOM$RANDOM.png;done

bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1485
Joined: 2015-04-02 13:15

Re: Order Randomly Wallpapers

Postby Head_on_a_Stick » 2016-07-05 19:30

bester69 wrote:You have hundreds or thousands of Wallpapers and you'd like to enjoy most of them, without having to repeat them.

I use this line in my startup script to change to a different random wallpaper every 5 minutes (I get bored easily):
Code: Select all
while true;do feh --randomize --bg-fill $HOME/Pictures/Wallpapers;sleep 300;done &

https://packages.debian.org/jessie/feh

:)
Don't break DebianHow to report bugs

SharpBang GNU/Linux — a pre-configured Openbox/Tint2 desktop running on Debian stable
User avatar
Head_on_a_Stick
 
Posts: 10600
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Order Randomly Wallpapers

Postby bester69 » 2016-07-26 12:28

Mate Desktop

Code: Select all
# Script to randomly set Background from files in a directory

while true;do

# Directory Containing Pictures
DIR="/home/user/Imágenes/WALLPAPERS"

# 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 30000

done

bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1485
Joined: 2015-04-02 13:15

Re: Order Randomly Wallpapers

Postby tezzeret » 2016-07-26 14:08

Using the window manager Awesome, I run this after setting the background so that next time awesome starts I have a new background. I wrote it in Lua to stay with Awesome's lua "theme" and because I am already familiar with that and not at all with bash.
The first bit gets a json response with all the url's of pictures in the "epic" gallery from that site. I then convert the json into a table. Its a POST request rather then a GET as I noticed that the AJAX call on that site is also a POST. It probably doesn't matter though if it was a GET or POST.
After that it selects 2 pictures to be downloaded. I download 2 because I have 2 monitors. I probably should change the paths it uses one day so it stays in ~/.config/awesome and maybe I will make it change the wallpaper automatically as well.
Code: Select all
function getBackground()
   local JSON = assert(loadfile "/home/lenscas/.config/awesome/default/extraLua/JSON.lua")() -- one-time load of the routines
   
   local f = assert (io.popen ('curl --data "" http://chillstep.info/jsonLoadGal.php?gal=gal-epic'))
   local rawText="";
   for line in f:lines() do
      rawText=rawText..line
   end -- for loop

   f:close()
   local inJson = JSON:decode(rawText)
   math.randomseed(os.time())
   local key=math.random(1,#inJson)
   --print(table.concat(inJson))
   os.execute('wget http://chillstep.info'..inJson[key]..' -O /home/lenscas/backgrounds/awesome/background1')
   local key=math.random(1,#inJson)
   os.execute('wget http://chillstep.info'..inJson[key]..' -O /home/lenscas/backgrounds/awesome/background2')
end
getBackground()
tezzeret
 
Posts: 12
Joined: 2015-06-24 08:19


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable