Archlinux basic installation configuration scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

  1. #!/usr/bin/env bash
  2. # Color files
  3. PFILE="$HOME/.config/polybar/grayblocks/colors.ini"
  4. RFILE="$HOME/.config/polybar/grayblocks/scripts/rofi/colors.rasi"
  5. # Get colors
  6. pywal_get() {
  7. wal -i "$1" -q -t
  8. }
  9. # Change colors
  10. change_color() {
  11. # polybar
  12. sed -i -e "s/background = #.*/background = $BG/g" $PFILE
  13. sed -i -e "s/background-alt = #.*/background-alt = $BGA/g" $PFILE
  14. sed -i -e "s/foreground = #.*/foreground = $FG/g" $PFILE
  15. sed -i -e "s/foreground-alt = #.*/foreground-alt = $FGA/g" $PFILE
  16. sed -i -e "s/primary = #.*/primary = $AC/g" $PFILE
  17. sed -i -e 's/red = #.*/red = #B71C1C/g' $PFILE
  18. sed -i -e 's/yellow = #.*/yellow = #F57F17/g' $PFILE
  19. # rofi
  20. cat > $RFILE <<- EOF
  21. /* colors */
  22. * {
  23. al: #00000000;
  24. bg: ${BG}FF;
  25. bga: ${BGA}FF;
  26. fga: ${FGA}FF;
  27. fg: ${FG}FF;
  28. ac: ${AC}FF;
  29. }
  30. EOF
  31. }
  32. # Main
  33. if [[ -f "/usr/bin/wal" ]]; then
  34. if [[ "$1" ]]; then
  35. pywal_get "$1"
  36. # Source the pywal color file
  37. . "$HOME/.cache/wal/colors.sh"
  38. BG=`printf "%s\n" "$background"`
  39. FG=`printf "%s\n" "$background"`
  40. BGA=`printf "%s\n" "$color7"`
  41. FGA=`printf "%s\n" "$color7"`
  42. AC=`printf "%s\n" "$color1"`
  43. change_color
  44. else
  45. echo -e "[!] Please enter the path to wallpaper. \n"
  46. echo "Usage : ./pywal.sh path/to/image"
  47. fi
  48. else
  49. echo "[!] 'pywal' is not installed."
  50. fi