quicklinks.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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/quicklinks.rasi"
  9. # Error msg
  10. msg() {
  11. rofi -theme "$HOME/.config/rofi/applets/styles/message.rasi" -e "$1"
  12. }
  13. # Browser
  14. if [[ -f /usr/bin/firefox ]]; then
  15. app="firefox"
  16. elif [[ -f /usr/bin/chromium ]]; then
  17. app="chromium"
  18. elif [[ -f /usr/bin/midori ]]; then
  19. app="midori"
  20. else
  21. msg "No suitable web browser found!"
  22. exit 1
  23. fi
  24. # Links
  25. google=""
  26. facebook=""
  27. twitter=""
  28. github=""
  29. mail=""
  30. youtube=""
  31. # Variable passed to rofi
  32. options="$google\n$facebook\n$twitter\n$github\n$mail\n$youtube"
  33. chosen="$(echo -e "$options" | $rofi_command -p "Open In : $app" -dmenu -selected-row 0)"
  34. case $chosen in
  35. $google)
  36. $app https://www.google.com &
  37. ;;
  38. $facebook)
  39. $app https://www.facebook.com &
  40. ;;
  41. $twitter)
  42. $app https://www.twitter.com &
  43. ;;
  44. $github)
  45. $app https://www.github.com &
  46. ;;
  47. $mail)
  48. $app https://www.gmail.com &
  49. ;;
  50. $youtube)
  51. $app https://www.youtube.com &
  52. ;;
  53. esac