scripts/copy_potd.sh

27 lines
760 B
Bash
Raw Normal View History

2021-06-25 07:38:56 +00:00
#!/bin/env bash
TODAY=$(date +%d_%m_%Y)
HOME="/home/$USER"
SOURCE="$HOME/.cache/plasma_engine_potd"
DESTINATION="$HOME/Pictures/wallpapers/"
TYPE=${1:-none}
if [[ $TYPE == "none" ]]
then
echo "No POTD type specified."
exit 1
fi
if [[ $TYPE == "unsplash" ]]; then
TYPE="unsplash:1065976"
fi
2021-06-25 07:38:56 +00:00
ORIGINAL="${SOURCE}/${TYPE}"
if [[ -e $ORIGINAL ]]; then
FILENAME="${TYPE}_${TODAY}.jpg"
echo "Copying '$TYPE' to '$DESTINATION' as '$FILENAME'."
cp "$ORIGINAL" "$DESTINATION/$FILENAME"
else
echo "$ORIGINAL does not exist."
exit 1
fi
2022-10-26 10:19:13 +00:00
# TODO: use below to create "copy all wallpapers" function
# for file in $HOME/.cache/plasma_engine_potd/*; do bfile=$(basename $file); cp "$file" "$HOME/Pictures/wallpapers/${bfile}_${TODAY}.jpg"; done