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.

71 lines
1.7 KiB

  1. #!/usr/bin/env bash
  2. # Color files
  3. PFILE="$HOME/.config/polybar/shapes/colors.ini"
  4. RFILE="$HOME/.config/polybar/shapes/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/foreground = #.*/foreground = $FG/g" $PFILE
  14. sed -i -e "s/foreground-alt = #.*/foreground-alt = $FGA/g" $PFILE
  15. sed -i -e "s/shade1 = #.*/shade1 = $SH1/g" $PFILE
  16. sed -i -e "s/shade2 = #.*/shade2 = $SH2/g" $PFILE
  17. sed -i -e "s/shade3 = #.*/shade3 = $SH3/g" $PFILE
  18. sed -i -e "s/shade4 = #.*/shade4 = $SH4/g" $PFILE
  19. sed -i -e "s/shade5 = #.*/shade5 = $SH5/g" $PFILE
  20. sed -i -e "s/shade6 = #.*/shade6 = $SH6/g" $PFILE
  21. sed -i -e "s/shade7 = #.*/shade7 = $SH7/g" $PFILE
  22. sed -i -e "s/shade8 = #.*/shade8 = $SH8/g" $PFILE
  23. # rofi
  24. cat > $RFILE <<- EOF
  25. /* colors */
  26. * {
  27. al: #00000000;
  28. bg: ${BG}FF;
  29. bg1: ${SH2}FF;
  30. bg2: ${SH3}FF;
  31. bg3: ${SH4}FF;
  32. fg: ${FG}FF;
  33. }
  34. EOF
  35. polybar-msg cmd restart
  36. }
  37. # Main
  38. if [[ -f "/usr/bin/wal" ]]; then
  39. if [[ "$1" ]]; then
  40. pywal_get "$1"
  41. # Source the pywal color file
  42. . "$HOME/.cache/wal/colors.sh"
  43. BG=`printf "%s\n" "$background"`
  44. FG=`printf "%s\n" "$foreground"`
  45. FGA=`printf "%s\n" "$foreground"`
  46. SH1=`printf "%s\n" "$color1"`
  47. SH2=`printf "%s\n" "$color2"`
  48. SH3=`printf "%s\n" "$color1"`
  49. SH4=`printf "%s\n" "$color2"`
  50. SH5=`printf "%s\n" "$color1"`
  51. SH6=`printf "%s\n" "$color2"`
  52. SH7=`printf "%s\n" "$color1"`
  53. SH8=`printf "%s\n" "$color7"`
  54. change_color
  55. else
  56. echo -e "[!] Please enter the path to wallpaper. \n"
  57. echo "Usage : ./pywal.sh path/to/image"
  58. fi
  59. else
  60. echo "[!] 'pywal' is not installed."
  61. fi