launch.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/usr/bin/env bash
  2. dir="$HOME/.config/polybar"
  3. themes=(`ls --hide="launch.sh" $dir`)
  4. launch_bar() {
  5. # Terminate already running bar instances
  6. killall -q polybar
  7. # Wait until the processes have been shut down
  8. while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
  9. # Launch the bar
  10. if [[ "$style" == "hack" || "$style" == "cuts" ]]; then
  11. polybar -q top -c "$dir/$style/config.ini" &
  12. polybar -q bottom -c "$dir/$style/config.ini" &
  13. elif [[ "$style" == "pwidgets" ]]; then
  14. bash "$dir"/pwidgets/launch.sh --main
  15. else
  16. polybar -q main -c "$dir/$style/config.ini" &
  17. fi
  18. }
  19. if [[ "$1" == "--material" ]]; then
  20. style="material"
  21. launch_bar
  22. elif [[ "$1" == "--shades" ]]; then
  23. style="shades"
  24. launch_bar
  25. elif [[ "$1" == "--hack" ]]; then
  26. style="hack"
  27. launch_bar
  28. elif [[ "$1" == "--docky" ]]; then
  29. style="docky"
  30. launch_bar
  31. elif [[ "$1" == "--cuts" ]]; then
  32. style="cuts"
  33. launch_bar
  34. elif [[ "$1" == "--shapes" ]]; then
  35. style="shapes"
  36. launch_bar
  37. elif [[ "$1" == "--grayblocks" ]]; then
  38. style="grayblocks"
  39. launch_bar
  40. elif [[ "$1" == "--blocks" ]]; then
  41. style="blocks"
  42. launch_bar
  43. elif [[ "$1" == "--colorblocks" ]]; then
  44. style="colorblocks"
  45. launch_bar
  46. elif [[ "$1" == "--forest" ]]; then
  47. style="forest"
  48. launch_bar
  49. else
  50. cat <<- EOF
  51. Usage : launch.sh --theme
  52. Available Themes :
  53. --blocks --colorblocks --cuts --docky
  54. --forest --grayblocks --hack --material
  55. --shades --shapes
  56. EOF
  57. fi