dotfiles/dot_config/polybar/scripts/executable_pywal.sh
punkfairie 90ca5ee74b
Update .config/packages/archgirlie
Add .config/polybar/colors.ini
Add .config/polybar/config.ini
Add .config/polybar/launch.sh
Add .config/polybar/scripts/backlight.sh
Add .config/polybar/scripts/launcher.sh
Add .config/polybar/scripts/player.sh
Add .config/polybar/scripts/powermenu.sh
Add .config/polybar/scripts/pywal.sh
Add .config/polybar/scripts/songname.sh
Add .config/polybar/scripts/wifi-menu.sh
Add .config/polybar/scripts/rofi/colors.rasi
Add .config/polybar/scripts/rofi/colors.rasi.backup
Add .config/polybar/scripts/rofi/confirm.rasi
Add .config/polybar/scripts/rofi/launcher.rasi
Add .config/polybar/scripts/rofi/message.rasi
Add .config/polybar/scripts/rofi/networkmenu.rasi
Add .config/polybar/scripts/rofi/powermenu.rasi
Add .config/polybar/scripts/rofi/styles.rasi
Add .config/polybar/scripts/scripts/checkupdates
Add .config/polybar/scripts/scripts/color-switch.sh
Add .config/polybar/scripts/scripts/colors-dark.sh
Add .config/polybar/scripts/scripts/colors-light.sh
Add .config/polybar/scripts/scripts/launcher.sh
Add .config/polybar/scripts/scripts/powermenu.sh
Add .config/polybar/scripts/scripts/pywal.sh
Add .config/polybar/scripts/scripts/random.sh
Add .config/polybar/scripts/scripts/updates.sh
Add .config/polybar/scripts/scripts/rofi/colors.rasi
Add .config/polybar/scripts/scripts/rofi/confirm.rasi
Add .config/polybar/scripts/scripts/rofi/launcher.rasi
Add .config/polybar/scripts/scripts/rofi/message.rasi
Add .config/polybar/scripts/scripts/rofi/networkmenu.rasi
Add .config/polybar/scripts/scripts/rofi/powermenu.rasi
Add .config/polybar/scripts/scripts/rofi/styles.rasi
2024-07-28 17:37:13 -07:00

77 lines
1.8 KiB
Bash

#!/usr/bin/env bash
# Color files
PFILE="$HOME/.config/polybar/colorblocks/colors.ini"
RFILE="$HOME/.config/polybar/colorblocks/scripts/rofi/colors.rasi"
WFILE="$HOME/.cache/wal/colors.sh"
# Get colors
pywal_get() {
wal -i "$1" -q -t
}
# Change colors
change_color() {
# polybar
sed -i -e "s/background = #.*/background = $BG/g" $PFILE
sed -i -e "s/foreground = #.*/foreground = $FG/g" $PFILE
sed -i -e "s/foreground-alt = #.*/foreground-alt = $FGA/g" $PFILE
sed -i -e "s/shade1 = #.*/shade1 = $SH1/g" $PFILE
sed -i -e "s/shade2 = #.*/shade2 = $SH2/g" $PFILE
sed -i -e "s/shade3 = #.*/shade3 = $SH3/g" $PFILE
sed -i -e "s/shade4 = #.*/shade4 = $SH4/g" $PFILE
sed -i -e "s/shade5 = #.*/shade5 = $SH5/g" $PFILE
sed -i -e "s/shade6 = #.*/shade6 = $SH6/g" $PFILE
sed -i -e "s/shade7 = #.*/shade7 = $SH7/g" $PFILE
sed -i -e "s/shade8 = #.*/shade8 = $SH8/g" $PFILE
# rofi
cat > $RFILE <<- EOF
/* colors */
* {
al: #00000000;
bg: ${BG}FF;
bg1: ${SH8}FF;
bg2: ${SH7}FF;
bg3: ${SH6}FF;
fg: ${FGA}FF;
}
EOF
polybar-msg cmd restart
}
# Main
if [[ -x "`which wal`" ]]; then
if [[ "$1" ]]; then
pywal_get "$1"
# Source the pywal color file
if [[ -e "$WFILE" ]]; then
. "$WFILE"
else
echo 'Color file does not exist, exiting...'
exit 1
fi
BG=`printf "%s\n" "$background"`
FG=`printf "%s\n" "$color0"`
FGA=`printf "%s\n" "$color7"`
SH1=`printf "%s\n" "$color1"`
SH2=`printf "%s\n" "$color2"`
SH3=`printf "%s\n" "$color1"`
SH4=`printf "%s\n" "$color2"`
SH5=`printf "%s\n" "$color1"`
SH6=`printf "%s\n" "$color2"`
SH7=`printf "%s\n" "$color1"`
SH8=`printf "%s\n" "$color2"`
change_color
else
echo -e "[!] Please enter the path to wallpaper. \n"
echo "Usage : ./pywal.sh path/to/image"
fi
else
echo "[!] 'pywal' is not installed."
fi