awesomeconf/bin/wallpaper
File Type: text/x-shellscript
#!/bin/bash
PAPES=/home/sean/Images/backgrounds/4k/
WINTERPAPES=/home/sean/Images/backgrounds/4kw/
if [[ "$1" == "--random" || "$2" == "--random" ]]; then
if [ `date +%m` = 12 -o `date +%m` = 01 -o `date +%m` = 02 ]; then
BGDIR="$WINTERPAPES"
else
BGDIR="$PAPES"
fi
rm -f "$HOME/.config/nitrogen/bg-saved.cfg"
nitrogen --set-zoom-fill --random --save "$BGDIR"
elif [[ "$1" == "--from-wal" || "$2" == "--from-wal" ]]; then
nitrogen --set-zoom-fill --save "$(cat "$HOME/.cache/wal/wal")"
else
nitrogen --restore
fi
BGIMAGE="$(cat "$HOME/.config/nitrogen/bg-saved.cfg" | grep file= | head -1 | cut -d'=' -f 2)"
wal -i "$BGIMAGE" -n
#wal --backend colorz -i "$BGIMAGE" -n
COLORS=(`cat "$HOME/.cache/wal/colors" | tr -d '#"'`)
# 0 - GTX 2080
# 1 - Logitech G303
# 2 - MSI Motherboard
# 3 - Corsair CPU cooler
(
DEVICES=$( openrgb -l | grep '^[0-9]:' | wc -l )
for (( i = 0 ; i <= $(($DEVICES - 1)) ; i++)); do
openrgb -d $i -m direct -c ${COLORS[$(($i + 1))]}
done
) &
if [[ "$1" == "--restart-awesome" || "$2" == "--restart-awesome" ]]; then
ps x -u $USER -U $USER | grep -v grep | grep awesome > /dev/null && { echo 'awesome.restart()' | awesome-client ; }
fi