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.

67 lines
1.2 KiB

  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. # Change colors
  6. change_color() {
  7. # polybar
  8. sed -i -e "s/bg = #.*/bg = ${BG}/g" $PFILE
  9. sed -i -e "s/fg = #.*/fg = ${BG}/g" $PFILE
  10. sed -i -e "s/fga = #.*/fga = ${RFG}/g" $PFILE
  11. sed -i -e "s/ac = #.*/ac = ${AC}/g" $PFILE
  12. # rofi
  13. cat > $RFILE <<- EOF
  14. /* colors */
  15. * {
  16. al: #00000000;
  17. bg: ${BG}FF;
  18. fg: ${RFG}FF;
  19. ac: ${AC}FF;
  20. }
  21. EOF
  22. polybar-msg cmd restart
  23. }
  24. get_random_number() {
  25. RNUM=$(( ($RANDOM % $1) + 1 ))
  26. }
  27. get_random_color() {
  28. RCOLOR="#"
  29. for i in 1 2 3 4 5 6
  30. do
  31. get_random_number "16"
  32. case $RNUM in
  33. "1") NEXTDIGIT="1";;
  34. "2") NEXTDIGIT="2";;
  35. "3") NEXTDIGIT="3";;
  36. "4") NEXTDIGIT="4";;
  37. "5") NEXTDIGIT="5";;
  38. "6") NEXTDIGIT="6";;
  39. "7") NEXTDIGIT="7";;
  40. "8") NEXTDIGIT="8";;
  41. "9") NEXTDIGIT="9";;
  42. "10") NEXTDIGIT="A";;
  43. "11") NEXTDIGIT="B";;
  44. "12") NEXTDIGIT="C";;
  45. "13") NEXTDIGIT="D";;
  46. "14") NEXTDIGIT="E";;
  47. "15") NEXTDIGIT="F";;
  48. "16") NEXTDIGIT="0";;
  49. esac
  50. RCOLOR="$RCOLOR$NEXTDIGIT"
  51. done
  52. echo $RCOLOR
  53. }
  54. # Main
  55. BG=`get_random_color`
  56. RFG=`get_random_color`
  57. AC=`get_random_color`
  58. change_color