Dotfiles for different machines on different branches.
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.

20 lines
564 B

  1. #!/bin/sh
  2. # Gives a dmenu prompt to search DuckDuckGo.
  3. # Without input, will open DuckDuckGo.com.
  4. # URLs will be directly handed to the browser.
  5. # Anything else, it search it.
  6. browser=${BROWSER:-firefox}
  7. pgrep -x dmenu && exit
  8. choice=$(echo "G" | dmenu -i -p "Search Google:") || exit 1
  9. if [ "$choice" = "G" ]; then
  10. $RTV_BROWSER "https://google.com"
  11. else
  12. if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then
  13. $RTV_BROWSER "$choice"
  14. else
  15. $RTV_BROWSER "https://google.com/search?q=$choice"
  16. fi
  17. fi