dm-transcription.sh 992 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. # Colors:
  3. # Materia Manjaro
  4. nf='#09dbc9'
  5. nb='#222b2e'
  6. sf='#dbdcd5'
  7. sb='#009185'
  8. fn='Ubuntu-16:normal'
  9. # Gruvbox
  10. # nf='#fea63c'
  11. # nb='#282828'
  12. # # sf='#dbdcd5'
  13. # sb='#d79921'
  14. # fn='Sarasa Mono SC Nerd-17:normal'
  15. DMENU="dmenu -i -l 10 -nf ${nf} -nb ${nb} -sf ${sf} -sb ${sb} -fn ${fn} -p"
  16. # Get user selection via dmenu from emoji file.
  17. # chosen=$(cut -d ';' -f1 ~/.myScripts/dmscripts/transcription.txt | dmenu -l 20 -nf ${nf} -nb ${nb} -sf ${sf} -sb ${sb} -fn ${fn} -p 'Choose a symbol:' | awk '{print $1}')
  18. chosen=$(cut -d ';' -f1 ~/.myScripts/dmscripts/transcription.txt | ${DMENU} 'Choose a symbol:' | awk '{print $1}')
  19. # Exit if none chosen.
  20. [ -z "$chosen" ] && exit
  21. # If you run this command with an argument, it will automatically insert the
  22. # character. Otherwise, show a message that the emoji has been copied.
  23. if [ -n "$1" ]; then
  24. xdotool type "$chosen"
  25. else
  26. printf "$chosen" | xclip -selection clipboard
  27. notify-send "'$chosen' copied to clipboard." &
  28. fi