darkrc/bin/unicode

18 lines
632 B
Text
Raw Permalink Normal View History

2020-01-30 14:46:47 +00:00
#!/bin/sh
2020-07-21 18:02:17 +00:00
alias dmenu="$HOME/darkrc/bin/dmenu-themed"
2020-01-30 14:46:47 +00:00
namelist=$HOME/.local/unicode/NamesList.txt
if [ ! -f "$namelist" ]
then
echo $namelist not found, downloading...
mkdir -p $(dirname "$namelist")
touch "$namelist"
2020-01-31 10:08:50 +00:00
curl 'https://www.unicode.org/Public/UCD/latest/ucd/NamesList.txt' \
| sed -n -e '/<.*>/d' -e '/^[0-9A-F]\+/p' \
| cp2utf8 > "$namelist" || exit
2020-01-30 14:46:47 +00:00
fi
2020-02-03 16:28:44 +00:00
codepoint=$(cat "$namelist" | sed -e 's/\t/ /g' | dmenu -p "Unicode: " -i -l 20 | awk '{print $1}' | grep '^[0-9A-F]\+')
2020-01-30 14:46:47 +00:00
if [ -z "$codepoint" ];
then echo No codepoint selected >&2; exit
fi
printf '\\\\U%8s\n' $codepoint | sed 's/ /0/g' | xargs printf