dm-run-scripts.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. # Colors:
  3. # # Materia Manjaro
  4. # nf='#09dbc9'
  5. # nb='#222b2e'
  6. # sf='#dbdcd5'
  7. # sb='#009185'
  8. # Everforest
  9. nf='#d3c6aa'
  10. nb='#2d353b'
  11. sf='#a7c080'
  12. sb='#475258'
  13. fn='Iosevka-18:normal'
  14. # fn='Ubuntu-16:normal'
  15. # Gruvbox
  16. # nf='#fea63c'
  17. # nb='#282828'
  18. # # sf='#dbdcd5'
  19. # sb='#d79921'
  20. # fn='Sarasa Mono SC Nerd-17:normal'
  21. # shopt -s nullglob globstar
  22. if [[ -n "$WAYLAND_DISPLAY" ]]; then
  23. DMENU=dmenu-wl
  24. xdotool="ydotool type --file -"
  25. elif [[ -n "$DISPLAY" ]]; then
  26. DMENU="dmenu -i -l 10 -nf ${nf} -nb ${nb} -sf ${sf} -sb ${sb} -fn ${fn} -p"
  27. xdotool="xdotool type --clearmodifiers --file -"
  28. else
  29. echo "Error: No Wayland or X11 display detected" >&2
  30. exit 1
  31. fi
  32. prefix=${SCRIPTS_STORE_DIR-~/.myScripts/dmscripts}
  33. script_files=( "$prefix"/*.sh )
  34. script_files=( "${script_files[@]#"$prefix"/}" )
  35. # script_files=( "${script_files[@]%.sh}" )
  36. # password=$(printf '%s\n' "${password_files[@]}" | "$dmenu" "$@")
  37. script_name=$(printf '%s\n' "${script_files[@]}" | ${DMENU} 'Run script:')
  38. # script_name=$(printf '%s\n' "${script_files[@]}" | "$dmenu" -i -l 10 -nf ${nf} -nb ${nb} -sf ${sf} -sb ${sb} -fn ${fn} -p 'Run script:')
  39. [[ -n "$script_name" ]] || exit
  40. # Run chosen script
  41. $prefix/$script_name