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.

54 lines
1005 B

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