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.

53 lines
1007 B

  1. #!/usr/bin/env bash
  2. # Color files
  3. PFILE="$HOME/.config/polybar/pwidgets/colors.ini"
  4. RFILE="$HOME/.config/polybar/pwidgets/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/bg = #.*/bg = ${BG}/g" $PFILE
  13. sed -i -e "s/fg = #.*/fg = ${FG}/g" $PFILE
  14. sed -i -e "s/fga = #.*/fga = ${RFG}/g" $PFILE
  15. sed -i -e "s/ac = #.*/ac = ${AC}/g" $PFILE
  16. # rofi
  17. cat > $RFILE <<- EOF
  18. /* colors */
  19. * {
  20. al: #00000000;
  21. bg: ${BG}FF;
  22. fg: ${RFG}FF;
  23. ac: ${AC}FF;
  24. }
  25. EOF
  26. }
  27. # Main
  28. if [[ -f "/usr/bin/wal" ]]; then
  29. if [[ "$1" ]]; then
  30. pywal_get "$1"
  31. # Source the pywal color file
  32. . "$HOME/.cache/wal/colors.sh"
  33. BG=`printf "%s\n" "$background"`
  34. FG=`printf "%s\n" "$foreground"`
  35. RFG=`printf "%s\n" "$color8"`
  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