diff options
author | mono-b <monoblanco@DRAINERDOMAIN.localdomain> | 2022-12-26 04:08:53 -0300 |
---|---|---|
committer | mono-b <monoblanco@DRAINERDOMAIN.localdomain> | 2022-12-26 04:08:53 -0300 |
commit | 8dc8f2d52338fd87e7763995e6732f5a295300e8 (patch) | |
tree | 56ea8a124b9a81e42251ffa1be92ad6475d7bef3 /polybar/cuts/scripts/pywal.sh |
huh
Diffstat (limited to 'polybar/cuts/scripts/pywal.sh')
-rwxr-xr-x | polybar/cuts/scripts/pywal.sh | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/polybar/cuts/scripts/pywal.sh b/polybar/cuts/scripts/pywal.sh new file mode 100755 index 0000000..fac5fbc --- /dev/null +++ b/polybar/cuts/scripts/pywal.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Color files +PFILE="$HOME/.config/polybar/cuts/colors.ini" +RFILE="$HOME/.config/polybar/cuts/scripts/rofi/colors.rasi" + +# 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/background-alt = #.*/background-alt = #8C${BG}/g" $PFILE + sed -i -e "s/foreground = #.*/foreground = #${FG}/g" $PFILE + sed -i -e "s/foreground-alt = #.*/foreground-alt = #33${FG}/g" $PFILE + sed -i -e "s/primary = #.*/primary = $AC/g" $PFILE + + # rofi + cat > $RFILE <<- EOF + /* colors */ + + * { + al: #00000000; + bg: #${BG}BF; + bga: #${BG}FF; + fg: #${FG}FF; + ac: ${AC}FF; + se: ${AC}1A; + } + EOF + + polybar-msg cmd restart +} + +# Main +if [[ -f "/usr/bin/wal" ]]; then + if [[ "$1" ]]; then + pywal_get "$1" + + # Source the pywal color file + . "$HOME/.cache/wal/colors.sh" + + BGC=`printf "%s\n" "$background"` + BG=${BGC:1} + FGC=`printf "%s\n" "$foreground"` + FG=${FGC:1} + AC=`printf "%s\n" "$color1"` + + 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 |