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.

85 lines
1.9 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. # Change colors
  6. change_color() {
  7. # polybar
  8. sed -i -e "s/background = #.*/background = $BG/g" $PFILE
  9. sed -i -e "s/foreground = #.*/foreground = $FG/g" $PFILE
  10. sed -i -e "s/foreground-alt = #.*/foreground-alt = $FGA/g" $PFILE
  11. sed -i -e "s/shade1 = #.*/shade1 = $SH1/g" $PFILE
  12. sed -i -e "s/shade2 = #.*/shade2 = $SH2/g" $PFILE
  13. sed -i -e "s/shade3 = #.*/shade3 = $SH3/g" $PFILE
  14. sed -i -e "s/shade4 = #.*/shade4 = $SH4/g" $PFILE
  15. sed -i -e "s/shade5 = #.*/shade5 = $SH5/g" $PFILE
  16. sed -i -e "s/shade6 = #.*/shade6 = $SH6/g" $PFILE
  17. sed -i -e "s/shade7 = #.*/shade7 = $SH7/g" $PFILE
  18. sed -i -e "s/shade8 = #.*/shade8 = $SH8/g" $PFILE
  19. # rofi
  20. cat > $RFILE <<- EOF
  21. /* colors */
  22. * {
  23. al: #00000000;
  24. bg: ${BG}FF;
  25. bg1: ${SH2}FF;
  26. bg2: ${SH3}FF;
  27. bg3: ${SH4}FF;
  28. bg4: ${SH5}FF;
  29. fg: ${FG}FF;
  30. }
  31. EOF
  32. polybar-msg cmd restart
  33. }
  34. get_random_number() {
  35. RNUM=$(( ($RANDOM % $1) + 1 ))
  36. }
  37. get_random_color() {
  38. RCOLOR="#"
  39. for i in 1 2 3 4 5 6
  40. do
  41. get_random_number "16"
  42. case $RNUM in
  43. "1") NEXTDIGIT="1";;
  44. "2") NEXTDIGIT="2";;
  45. "3") NEXTDIGIT="3";;
  46. "4") NEXTDIGIT="4";;
  47. "5") NEXTDIGIT="5";;
  48. "6") NEXTDIGIT="6";;
  49. "7") NEXTDIGIT="7";;
  50. "8") NEXTDIGIT="8";;
  51. "9") NEXTDIGIT="9";;
  52. "10") NEXTDIGIT="A";;
  53. "11") NEXTDIGIT="B";;
  54. "12") NEXTDIGIT="C";;
  55. "13") NEXTDIGIT="D";;
  56. "14") NEXTDIGIT="E";;
  57. "15") NEXTDIGIT="F";;
  58. "16") NEXTDIGIT="0";;
  59. esac
  60. RCOLOR="$RCOLOR$NEXTDIGIT"
  61. done
  62. echo $RCOLOR
  63. }
  64. # Main
  65. BG='#1f1f1f' # change to light bg
  66. FG='#FFFFFF' # change to dark fg
  67. FGA='#656565' # change to gray fg
  68. SH1=`get_random_color`
  69. SH2=`get_random_color`
  70. SH3=`get_random_color`
  71. SH4=`get_random_color`
  72. SH5=`get_random_color`
  73. SH6=`get_random_color`
  74. SH7=`get_random_color`
  75. SH8=`get_random_color`
  76. change_color