aboutsummaryrefslogtreecommitdiff
path: root/config/polybar/material/scripts/pywal.sh
diff options
context:
space:
mode:
authorWilliam Hergès <william@herges.fr>2025-08-12 15:19:57 +0200
committerWilliam Hergès <william@herges.fr>2025-08-12 15:19:57 +0200
commit4a21ae6fcdfcd0051a2e6fee641cd344c01dac83 (patch)
treea3741ca7f848d0f5213915d82f78fd0039a874f9 /config/polybar/material/scripts/pywal.sh
parentfed5ed81fbf64942dab81e7afd1eac5651290631 (diff)
Reset everything
Diffstat (limited to 'config/polybar/material/scripts/pywal.sh')
-rwxr-xr-xconfig/polybar/material/scripts/pywal.sh87
1 files changed, 0 insertions, 87 deletions
diff --git a/config/polybar/material/scripts/pywal.sh b/config/polybar/material/scripts/pywal.sh
deleted file mode 100755
index 4602458..0000000
--- a/config/polybar/material/scripts/pywal.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env bash
-
-# Color files
-PFILE="$HOME/.config/polybar/material/colors.ini"
-RFILE="$HOME/.config/polybar/material/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/module-fg = #.*/module-fg = $MF/g" $PFILE
- sed -i -e "s/primary = #.*/primary = $AC/g" $PFILE
- sed -i -e "s/secondary = #.*/secondary = $SC/g" $PFILE
- sed -i -e "s/alternate = #.*/alternate = $AL/g" $PFILE
-
- # rofi
- cat > $RFILE <<- EOF
- /* colors */
-
- * {
- al: #00000000;
- bg: ${BG}FF;
- bga: ${AC}33;
- bar: ${MF}FF;
- fg: ${FG}FF;
- ac: ${AC}FF;
- }
- EOF
-}
-
-hex_to_rgb() {
- # Convert a hex value WITHOUT the hashtag (#)
- R=$(printf "%d" 0x${1:0:2})
- G=$(printf "%d" 0x${1:2:2})
- B=$(printf "%d" 0x${1:4:2})
-}
-
-get_fg_color(){
- INTENSITY=$(calc "$R*0.299 + $G*0.587 + $B*0.114")
-
- if [ $(echo "$INTENSITY>186" | bc) -eq 1 ]; then
- MF="#202020"
- else
- MF="#F5F5F5"
- fi
-}
-
-# 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" "$foreground"`
- FGA=`printf "%s\n" "$color8"`
- AC=`printf "%s\n" "$color1"`
- SC=`printf "%s\n" "$color2"`
- AL=`printf "%s\n" "$color3"`
-
- HEX=${AC:1}
-
- hex_to_rgb $HEX
- get_fg_color
- 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