bemenu-run-or-search.sh 607 B

1234567891011121314151617
  1. #!/bin/bash
  2. result=$(compgen -c | sort -u | bemenu -l 10 -p "🔍" --counter always -c -W 0.4 -B 5 \
  3. --fixed-height -H 22 --fn 'B612 11' \
  4. --bdr "#323232" --tf "#FFFFFF" --hf "#FFFFFF")
  5. [ -z "$result" ] && exit 0
  6. if [[ "$result" == sp\ * ]]; then
  7. exec alacritty -e spotify_player search "${result#sp }"
  8. elif command -v "${result%% *}" &>/dev/null; then
  9. exec $result
  10. else
  11. query=$(python3 -c "import urllib.parse, sys; print(urllib.parse.quote_plus(sys.argv[1]))" "$result")
  12. xdg-open "https://duckduckgo.com/?q=$query" &
  13. sleep 0.5
  14. swaymsg '[app_id="google-chrome"] focus'
  15. fi