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.

138 lines
2.9 KiB

  1. #!/usr/bin/env bash
  2. ## Author : Aditya Shakya
  3. ## Mail : adi1090x@gmail.com
  4. ## Github : @adi1090x
  5. ## Twitter : @adi1090x
  6. DIR="$HOME/.config/polybar/panels/menu"
  7. uptime=$(uptime -p | sed -e 's/up //g')
  8. if [[ "$1" = "--budgie" ]]; then
  9. theme="budgie"
  10. elif [[ "$1" = "--deepin" ]]; then
  11. theme="deepin"
  12. elif [[ "$1" = "--elight" ]]; then
  13. theme="elementary"
  14. elif [[ "$1" = "--edark" ]]; then
  15. theme="elementary_dark"
  16. elif [[ "$1" = "--gnome" ]]; then
  17. theme="gnome"
  18. elif [[ "$1" = "--klight" ]]; then
  19. theme="kde"
  20. elif [[ "$1" = "--kdark" ]]; then
  21. theme="kde_dark"
  22. elif [[ "$1" = "--liri" ]]; then
  23. theme="liri"
  24. elif [[ "$1" = "--mint" ]]; then
  25. theme="mint"
  26. elif [[ "$1" = "--ugnome" ]]; then
  27. theme="ubuntu_gnome"
  28. elif [[ "$1" = "--unity" ]]; then
  29. theme="ubuntu_unity"
  30. elif [[ "$1" = "--xubuntu" ]]; then
  31. theme="xubuntu"
  32. elif [[ "$1" = "--zorin" ]]; then
  33. theme="zorin"
  34. else
  35. rofi -e "No theme specified."
  36. exit 1
  37. fi
  38. rofi_command="rofi -theme $DIR/$theme/powermenu.rasi"
  39. # Options
  40. shutdown=" Shutdown"
  41. reboot=" Restart"
  42. lock=" Lock"
  43. suspend=" Sleep"
  44. logout=" Logout"
  45. # Confirmation
  46. confirm_exit() {
  47. rofi -dmenu\
  48. -i\
  49. -no-fixed-num-lines\
  50. -p "Are You Sure? : "\
  51. -theme $DIR/$theme/confirm.rasi
  52. }
  53. # Message
  54. msg() {
  55. rofi -theme "$DIR/$theme/message.rasi" -e "Available Options - yes / y / no / n"
  56. }
  57. # Variable passed to rofi
  58. options="$lock\n$suspend\n$logout\n$reboot\n$shutdown"
  59. chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)"
  60. case $chosen in
  61. $shutdown)
  62. ans=$(confirm_exit &)
  63. if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
  64. systemctl poweroff
  65. elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
  66. exit 0
  67. else
  68. msg
  69. fi
  70. ;;
  71. $reboot)
  72. ans=$(confirm_exit &)
  73. if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
  74. systemctl reboot
  75. elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
  76. exit 0
  77. else
  78. msg
  79. fi
  80. ;;
  81. $lock)
  82. if [[ -f /usr/bin/i3lock ]]; then
  83. i3lock
  84. elif [[ -f /usr/bin/betterlockscreen ]]; then
  85. betterlockscreen -l
  86. fi
  87. ;;
  88. $suspend)
  89. ans=$(confirm_exit &)
  90. if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
  91. mpc -q pause
  92. amixer set Master mute
  93. systemctl suspend
  94. elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
  95. exit 0
  96. else
  97. msg
  98. fi
  99. ;;
  100. $logout)
  101. ans=$(confirm_exit &)
  102. if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then
  103. if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then
  104. openbox --exit
  105. elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then
  106. bspc quit
  107. elif [[ "$DESKTOP_SESSION" == "i3" ]]; then
  108. i3-msg exit
  109. fi
  110. elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then
  111. exit 0
  112. else
  113. msg
  114. fi
  115. ;;
  116. esac