25 febrero 2018

Script Bash Wallpapers Dinamicos Linux


#!/bin/bash
Dir="/home/$USER/.config/awesome/wallpaper/"
if [ ! -d "$Dir" ]; then
echo "Not Exist $Dir"
exit 1
fi
SetBG () {
TotalFiles=$( ls -1 "$Dir" | wc -l )
RandomNumber=$(( $RANDOM % $TotalFiles ))
test ! $RandomNumber = 0 || RandomNumber=1
RandomFile="$( ls -1 $Dir | head -n $RandomNumber | tail -n 1)"
#echo "Selected File: $RandomFile"
feh --bg-fill "${Dir%/}/${RandomFile}"
}
while true; do
SetBG
sleep 10m
done

05 febrero 2018

Script Resize dependiente de notify_mocp

#!/bin/bash LAST=$(echo "/`mocp -i|grep File:|cut -d '/' -f 2-5`") cd "$LAST" I=$(find . -name '*.jpg' -or -name '*.jpeg' -or -name '*.png') if [ -f "$I" ]; then IMG0=$(find . -name '*.jpg' -or -name '*.jpeg' -or -name '*.png'|shuf -n1|xargs -0) else IMG0=$(find . -name '*.jpg' -or -name '*.jpeg' -or -name '*.png'|cut -c2-|shuf -n1|xargs -0) fi IMG=$(echo "$LAST/$IMG0") X=$(mat --display "$IMG"|grep "Exif Image Width:"|cut -d ' ' -f 4) Y=$(mat --display "$IMG"|grep "Exif Image Height:"|cut -d ' ' -f 4) GEOMETRY=$(echo "$X"x"$Y") i="100x100" if [ "$i" != "$GEOMETRY" ]; then mogrify -adaptive-resize 100x100! "$IMG" fi