apps.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/usr/bin/env bash
  2. ## Author : Aditya Shakya
  3. ## Mail : adi1090x@gmail.com
  4. ## Github : @adi1090x
  5. ## Twitter : @adi1090x
  6. style="$($HOME/.config/rofi/applets/menu/style.sh)"
  7. dir="$HOME/.config/rofi/applets/menu/configs/$style"
  8. rofi_command="rofi -theme $dir/apps.rasi"
  9. # Links
  10. terminal=""
  11. files=""
  12. editor=""
  13. browser=""
  14. music=""
  15. settings=""
  16. # Error msg
  17. msg() {
  18. rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "$1"
  19. }
  20. # Variable passed to rofi
  21. options="$terminal\n$files\n$editor\n$browser\n$music\n$settings"
  22. chosen="$(echo -e "$options" | $rofi_command -p "Most Used" -dmenu -selected-row 0)"
  23. case $chosen in
  24. $terminal)
  25. if [[ -f /usr/bin/termite ]]; then
  26. termite &
  27. elif [[ -f /usr/bin/urxvt ]]; then
  28. urxvt &
  29. elif [[ -f /usr/bin/kitty ]]; then
  30. kitty &
  31. elif [[ -f /usr/bin/xterm ]]; then
  32. xterm &
  33. elif [[ -f /usr/bin/xfce4-terminal ]]; then
  34. xfce4-terminal &
  35. elif [[ -f /usr/bin/gnome-terminal ]]; then
  36. gnome-terminal &
  37. else
  38. msg "No suitable terminal found!"
  39. fi
  40. ;;
  41. $files)
  42. if [[ -f /usr/bin/thunar ]]; then
  43. thunar &
  44. elif [[ -f /usr/bin/pcmanfm ]]; then
  45. pcmanfm &
  46. else
  47. msg "No suitable file manager found!"
  48. fi
  49. ;;
  50. $editor)
  51. if [[ -f /usr/bin/geany ]]; then
  52. geany &
  53. elif [[ -f /usr/bin/leafpad ]]; then
  54. leafpad &
  55. elif [[ -f /usr/bin/mousepad ]]; then
  56. mousepad &
  57. elif [[ -f /usr/bin/code ]]; then
  58. code &
  59. else
  60. msg "No suitable text editor found!"
  61. fi
  62. ;;
  63. $browser)
  64. if [[ -f /usr/bin/firefox ]]; then
  65. firefox &
  66. elif [[ -f /usr/bin/chromium ]]; then
  67. chromium &
  68. elif [[ -f /usr/bin/midori ]]; then
  69. midori &
  70. else
  71. msg "No suitable web browser found!"
  72. fi
  73. ;;
  74. $music)
  75. if [[ -f /usr/bin/lxmusic ]]; then
  76. lxmusic &
  77. else
  78. msg "No suitable music player found!"
  79. fi
  80. ;;
  81. $settings)
  82. if [[ -f /usr/bin/xfce4-settings-manager ]]; then
  83. xfce4-settings-manager &
  84. else
  85. msg "No suitable settings manager found!"
  86. fi
  87. ;;
  88. esac