bemenu-run-or-search.sh 511 B

123456789101112131415
  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 command -v "${result%% *}" &>/dev/null; then
  7. exec $result
  8. else
  9. query=$(python3 -c "import urllib.parse, sys; print(urllib.parse.quote_plus(sys.argv[1]))" "$result")
  10. xdg-open "https://duckduckgo.com/?q=$query" &
  11. sleep 0.5
  12. swaymsg '[app_id="google-chrome"] focus'
  13. fi