added scripts dir

This commit is contained in:
Niklas 2020-06-15 16:51:47 +02:00
parent 763748c252
commit 7697ba34fe
5 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
$SCRIPTPATH/set-bg.sh $(shuf -n1 -e ~/pictures/wallpapers/*)

View File

@ -0,0 +1,9 @@
#!/usr/bin/env sh
# required packages:
# - wget
# - jq
set -e
#wget -O - http://www.reddit.com/r/wallpapers.rss 2> /dev/null | grep -Eo "https://?[^&]+(jpg|png)" | grep -v "thumbs" | head -1
wget -O - "http://www.reddit.com/r/wallpapers/top/.json?t=day" 2> /dev/null | jq -r ".data.children[0].data.url"

View File

@ -0,0 +1,10 @@
#!/usr/bin/env sh
# required packages:
# - sxiv
SELECT=$(sxiv -N "floatme" -t -o ~/pictures/wallpapers | tail -n1 )
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
$SCRIPTPATH/set-bg.sh "$SELECT"

15
.local/share/scripts/set-bg.sh Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env sh
# required packages:
# - feh
set -e
[ -z "$@" ] && exit 0
LAST_BG_LOCATION="$XDG_CACHE_HOME/.last-bg"
feh --bg-scale $1
rm -f "$LAST_BG_LOCATION"
ln -s $1 $(realpath "$LAST_BG_LOCATION")

View File

@ -0,0 +1,11 @@
#!/usr/bin/env sh
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
URL=$($SCRIPTPATH/reddit-wp.sh)
NAME=$(basename "$URL")
FILENAME=~/pictures/wallpapers/"$NAME"
wget "$URL" -nc -O "$FILENAME"
sleep 1
$SCRIPTPATH/set-bg.sh $FILENAME