aboutsummaryrefslogtreecommitdiff
path: root/config/polybar/grayblocks/scripts/pywal.sh
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@gmx.com>2023-07-25 23:46:05 +0200
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@gmx.com>2023-07-25 23:46:05 +0200
commitc57e8ab185623510e527400a34d729b313daffc4 (patch)
tree7b67d44894255ce4810d8074d68fce88f66d37d0 /config/polybar/grayblocks/scripts/pywal.sh
parent9f004955033387eebf3f58aec2501fba5020f307 (diff)
feat(polybar): update polybar style
Diffstat (limited to 'config/polybar/grayblocks/scripts/pywal.sh')
-rwxr-xr-xconfig/polybar/grayblocks/scripts/pywal.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/config/polybar/grayblocks/scripts/pywal.sh b/config/polybar/grayblocks/scripts/pywal.sh
new file mode 100755
index 0000000..a915c67
--- /dev/null
+++ b/config/polybar/grayblocks/scripts/pywal.sh
@@ -0,0 +1,65 @@
+#!/usr/bin/env bash
+
+# Color files
+PFILE="$HOME/.config/polybar/grayblocks/colors.ini"
+RFILE="$HOME/.config/polybar/grayblocks/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/background-alt = #.*/background-alt = $BGA/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/primary = #.*/primary = $AC/g" $PFILE
+ sed -i -e 's/red = #.*/red = #B71C1C/g' $PFILE
+ sed -i -e 's/yellow = #.*/yellow = #F57F17/g' $PFILE
+
+ # rofi
+ cat > $RFILE <<- EOF
+ /* colors */
+
+ * {
+ al: #00000000;
+ bg: ${BG}FF;
+ bga: ${BGA}FF;
+ fga: ${FGA}FF;
+ fg: ${FG}FF;
+ ac: ${AC}FF;
+ }
+ EOF
+}
+
+# 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" "$background"`
+ BGA=`printf "%s\n" "$color7"`
+ FGA=`printf "%s\n" "$color7"`
+ 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