~scripts
55 itemsDownload ./*

55 itemsDownload ./*

..
dzen2
tiling
vosh
4cdl
4trips
alarm
ambient
ana-wall.sh
battery-monitor
brightness.sh
checkit
cleverbot.py
clock
color-gen
colors-hex
colorscheme.sh
compton
dailywall
dmenu
ffthumb
grid
gridmacro
gridmacro.kde
help
importw
indexer
install-all.sh
install-twily.sh
installng
keep-on
mp3ogg
orage
pipes
pipes.x
pipewire_bt.sh
ports
rain
randwall
rotate.sh
scan.sh
screen-dim
screencast
screencast2
scrot
scrotw
search
skull
slocker
starwars
streamit
sumnum
tty-colorize
usrmount
ytp
ytplay


scriptsdailywall
1 860•  6 years ago•  DownloadRawClose
6 years ago•  1 860

{}
#!/bin/bash
#
# Author:      Twily                                                      2017
# Description: Grab random wallpaper from http://wallpaperswide.com once a day
# Usage:       $ nohup ./dailywall > /dev/null 2>&1 &
# Requires:    xwininfo, awk, wget
#

lock() {
    exec 200>/var/lock/.dailywall.exclusivelock
    flock -n 200 && return 0 || return 1
}
lock || exit 1

# (RES eg.: 1920x1080)
RES=$( xwininfo -root | grep geometry | awk -F" " '{print $2}' | awk -F"+" '{print $1}' )

DIR=/tmp/
LST=$DIR"list.html"
ITM=$DIR"item.html"

SET="21:37"

wallpaper() {
    RND=$( shuf -i 1-5 -n 1 )

    wget http://wallpaperswide.com/top_wallpapers/page/$RND -O $LST
    #wget http://wallpaperswide.com/artistic-desktop-wallpapers/page/$RND -O $LST

    sed -i '/-wallpapers\.html/!d' $LST
    sed -i '/     /!d' $LST
    sed -i 's/^.*href="\///' $LST
    sed -i 's/" title=.*$//' $LST
    sed -i '/_/!d' $LST

    IMG=$( shuf -n 1 $LST )
    NAM=$( echo $IMG | awk -F"-" '{print $1}' )

    wget http://wallpaperswide.com/$IMG -O $ITM

    sed -i "/$NAM/!d" $ITM
    sed -i "/$RES/!d" $ITM
    sed -i 's/^.*href="\///' $ITM
    sed -i 's/" title=.*$//' $ITM

    IMG=$( cat $ITM )
    EXT=$( echo $IMG | awk -F"." '{print $2}' )
    PIC=$DIR"$NAM.$EXT"

    wget http://wallpaperswide.com/$IMG -O $PIC

    # Chose software to set $PIC as wallpaper (!system specific!)
    #pcmanfm --set-wallpaper $PIC
    feh --bg-fill $PIC
}

while :; do
    TIM=$( date +"%H:%M" )

    if [ "$SET" == "$TIM" ]; then
        wallpaper

        sleep 50
    fi

    sleep 10
done

Top
©twily.info 2013 - 2024
twily at twily dot info



2 033 759 visits
... ^ v