updated wally script to accept custom colorschemes, use wal-steam to generate a matching steam theme and also create a backup of all linked files before changing anything

Former-commit-id: 72e9980f02
Former-commit-id: adcf74baf70bdb757c3da50ed79bd4de39412f38
Former-commit-id: 2dba07848f7167b745c4982d8d844dbf3ed8ce9a
This commit is contained in:
elena 2017-11-27 06:12:58 +02:00
parent 78fde6078f
commit be5af01250

View file

@ -7,6 +7,7 @@
# wally ~/Pictures/Wallpapers
# wally .
# wally ~/Pictures/Wallpapers/pape.jpg
# wally -f ~/path/to/color/file ~/path/to/wallpaper
# Arguments checking
if [ $# == 0 ]; then
@ -14,6 +15,12 @@ if [ $# == 0 ]; then
exit 0;
fi
# Create backup of linked files
echo "> Backing up linked files"
TIMESTAMP="$(date +%F-%H:%M:%S)"
cp -r -L ~/.wally/links ~/.wally/wally_backup-$TIMESTAMP
cp ~/.wally/path_to_wallpaper ~/.wally/wally_backup-$TIMESTAMP
# Declare arrays
declare -a color
declare -a XCOLOR_OLD
@ -26,10 +33,19 @@ for (( i = 0; i < 8; i++ )); do
done
# Call wal to generate new colors
ARG=$1
echo "> Calling wal at $ARG... toot toot..."
wal -i $ARG
echo "> New colorscheme generated!"
if [[ "$1" = "-f" ]]; then
COLORS_PATH=$2
echo "> Applying custom terminal colorscheme from $COLORS_PATH..."
wal -f $COLORS_PATH
PAPE_PATH=$3
echo "> Setting $PAPE_PATH as wallpaper..."
feh --bg-fill $3
else
ARG=$1
echo "> Calling wal at $ARG... toot toot..."
wal -i $ARG
echo "> New colorscheme generated!"
fi
# Apply new colors to Xresources
echo "> Setting .Xresources..."
@ -58,8 +74,18 @@ echo "> tint2 has restarted!"
openbox --reconfigure
echo "> Openbox is reconfigured!"
# Create steam theme
cp ~/.cache/wal/colors ~/.cache/wal/colors.steam
python3 ~/Programs/wal_steam/mywalsteam.py -w
echo "> Generated steam theme!"
# Copy new wallpaper path to wally's directory
cp ~/.cache/wal/wal ~/.wally/path_to_wallpaper
if [[ "$1" = "-f" ]]; then
CUSTOMPAPEPATH="$(readlink -f $3)"
echo $CUSTOMPAPEPATH > ~/.wally/path_to_wallpaper
else
cp ~/.cache/wal/wal ~/.wally/path_to_wallpaper
fi
WALLPAPER="$(cat ~/.wally/path_to_wallpaper)"
# Display new colors with a color script