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.2 KiB

  1. #!/usr/bin/env bash
  2. # Color files
  3. PFILE="$HOME/.config/polybar/cuts/colors.ini"
  4. RFILE="$HOME/.config/polybar/cuts/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 = #8C${BG}/g" $PFILE
  14. sed -i -e "s/foreground = #.*/foreground = #${FG}/g" $PFILE
  15. sed -i -e "s/foreground-alt = #.*/foreground-alt = #33${FG}/g" $PFILE
  16. sed -i -e "s/primary = #.*/primary = $AC/g" $PFILE
  17. # rofi
  18. cat > $RFILE <<- EOF
  19. /* colors */
  20. * {
  21. al: #00000000;
  22. bg: #${BG}BF;
  23. bga: #${BG}FF;
  24. fg: #${FG}FF;
  25. ac: ${AC}FF;
  26. se: ${AC}1A;
  27. }
  28. EOF
  29. polybar-msg cmd restart
  30. }
  31. # Main
  32. if [[ -f "/usr/bin/wal" ]]; then
  33. if [[ "$1" ]]; then
  34. pywal_get "$1"
  35. # Source the pywal color file
  36. . "$HOME/.cache/wal/colors.sh"
  37. BGC=`printf "%s\n" "$background"`
  38. BG=${BGC:1}
  39. FGC=`printf "%s\n" "$foreground"`
  40. FG=${FGC:1}
  41. AC=`printf "%s\n" "$color1"`
  42. change_color
  43. else
  44. echo -e "[!] Please enter the path to wallpaper. \n"
  45. echo "Usage : ./pywal.sh path/to/image"
  46. fi
  47. else
  48. echo "[!] 'pywal' is not installed."
  49. fi