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.

72 lines
1.7 KiB

  1. #!/usr/bin/env bash
  2. # Color files
  3. PFILE="$HOME/.config/polybar/shades/colors.ini"
  4. RFILE="$HOME/.config/polybar/shades/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. bg4: ${SH5}FF;
  33. fg: ${FG}FF;
  34. }
  35. EOF
  36. polybar-msg cmd restart
  37. }
  38. # Main
  39. if [[ -f "/usr/bin/wal" ]]; then
  40. if [[ "$1" ]]; then
  41. pywal_get "$1"
  42. # Source the pywal color file
  43. . "$HOME/.cache/wal/colors.sh"
  44. BG=`printf "%s\n" "$background"`
  45. FG=`printf "%s\n" "$foreground"`
  46. FGA=`printf "%s\n" "$color8"`
  47. SH1=`printf "%s\n" "$color1"`
  48. SH2=`printf "%s\n" "$color2"`
  49. SH3=`printf "%s\n" "$color1"`
  50. SH4=`printf "%s\n" "$color2"`
  51. SH5=`printf "%s\n" "$color1"`
  52. SH6=`printf "%s\n" "$color2"`
  53. SH7=`printf "%s\n" "$color1"`
  54. SH8=`printf "%s\n" "$color7"`
  55. change_color
  56. else
  57. echo -e "[!] Please enter the path to wallpaper. \n"
  58. echo "Usage : ./pywal.sh path/to/image"
  59. fi
  60. else
  61. echo "[!] 'pywal' is not installed."
  62. fi