From a8301442e82b612e9894b14be8057fa4a40ebf49 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Thu, 30 Jan 2020 15:46:47 +0100 Subject: [PATCH] Add unicode script --- bashrc | 1 + bin/unicode | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100755 bin/unicode diff --git a/bashrc b/bashrc index 20b8659..b525b98 100644 --- a/bashrc +++ b/bashrc @@ -21,6 +21,7 @@ alias ranger='source ranger' alias ta='tmux a -t' alias co='checkout' alias qed='[ $RANDOM -ge $((32767 / 100 * 10)) ] && echo Quod Erat Demonstrandum || echo Quo Errat Demonstrator' +alias u='unicode' stty -ixon diff --git a/bin/unicode b/bin/unicode new file mode 100755 index 0000000..d26309d --- /dev/null +++ b/bin/unicode @@ -0,0 +1,15 @@ +#!/bin/sh +namelist=$HOME/.local/unicode/NamesList.txt +if [ ! -f "$namelist" ] +then + echo $namelist not found, downloading... + mkdir -p $(dirname "$namelist") + touch "$namelist" + wget 'https://www.unicode.org/Public/UCD/latest/ucd/NamesList.txt' \ + -O "$namelist" || exit +fi +codepoint=$(grep -i '^[0-9A-F]\+' "$namelist" | sed -e '/<.*>/d' -e 's/\t/ /g' | dmenu -i -l 20 -b | awk '{print $1}' | grep '^[0-9A-F]\+') +if [ -z "$codepoint" ]; +then echo No codepoint selected >&2; exit +fi +printf '\\\\U%8s\n' $codepoint | sed 's/ /0/g' | xargs printf