#!/usr/local/bin/andy set -e NOTIFY_LONG unicode set -e NOTIFY_SHORT uni func setup { curl 'https://www.unicode.org/Public/UNIDATA/UnicodeData.txt' | sed -E r#' s/;[^;]*//2g s/\<(.)([A-Z]*)/\1\L\2/2g /^[^;]*;$DATA } test $#XDG_DATA_HOME -eq 0 && set XDG_DATA_HOME $HOME/.local/share set DATA $XDG_DATA_HOME/unicode-data test -f $DATA || setup set idx `{ tee >{cut -d';' -f1 | read -d\n runes} <$DATA | cut -d';' -f2 $DATA | osel -i } set rune `printf $runes[$idx] if test -t 2 { wl-copy -n "$rune" | notify 'Rune Copied' "The rune ‘$rune’ was copied to the clipboard" } else { wtype -- $rune } # vi: ft=sh