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.

73 lines
1.5 KiB

  1. #!/usr/bin/env bash
  2. # Color files
  3. PFILE="$HOME/.config/polybar/grayblocks/colors.ini"
  4. RFILE="$HOME/.config/polybar/grayblocks/scripts/rofi/colors.rasi"
  5. # Change colors
  6. change_color() {
  7. # polybar
  8. sed -i -e "s/background = #.*/background = $BG/g" $PFILE
  9. sed -i -e "s/background-alt = #.*/background-alt = $BGA/g" $PFILE
  10. sed -i -e "s/foreground = #.*/foreground = $FG/g" $PFILE
  11. sed -i -e "s/foreground-alt = #.*/foreground-alt = $FG/g" $PFILE
  12. sed -i -e "s/primary = #.*/primary = $AC/g" $PFILE
  13. sed -i -e 's/red = #.*/red = #EF5350/g' $PFILE
  14. sed -i -e 's/yellow = #.*/yellow = #FFEE58/g' $PFILE
  15. # rofi
  16. cat > $RFILE <<- EOF
  17. /* colors */
  18. * {
  19. al: #00000000;
  20. bg: ${BG}FF;
  21. bga: ${BGA}FF;
  22. fga: ${FG}FF;
  23. fg: ${FG}FF;
  24. ac: ${AC}FF;
  25. }
  26. EOF
  27. polybar-msg cmd restart
  28. }
  29. get_random_number() {
  30. RNUM=$(( ($RANDOM % $1) + 1 ))
  31. }
  32. get_random_color() {
  33. RCOLOR="#"
  34. for i in 1 2 3 4 5 6
  35. do
  36. get_random_number "16"
  37. case $RNUM in
  38. "1") NEXTDIGIT="1";;
  39. "2") NEXTDIGIT="2";;
  40. "3") NEXTDIGIT="3";;
  41. "4") NEXTDIGIT="4";;
  42. "5") NEXTDIGIT="5";;
  43. "6") NEXTDIGIT="6";;
  44. "7") NEXTDIGIT="7";;
  45. "8") NEXTDIGIT="8";;
  46. "9") NEXTDIGIT="9";;
  47. "10") NEXTDIGIT="A";;
  48. "11") NEXTDIGIT="B";;
  49. "12") NEXTDIGIT="C";;
  50. "13") NEXTDIGIT="D";;
  51. "14") NEXTDIGIT="E";;
  52. "15") NEXTDIGIT="F";;
  53. "16") NEXTDIGIT="0";;
  54. esac
  55. RCOLOR="$RCOLOR$NEXTDIGIT"
  56. done
  57. echo $RCOLOR
  58. }
  59. # Main
  60. BG='#272727' # change to light bg
  61. FG='#CACACA' # change to dark fg
  62. BGA='#383838'
  63. AC=`get_random_color`
  64. change_color