diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-11-18 21:12:18 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-11-18 21:15:53 +0100 |
commit | bedf1d32932bd6753d3e443e9eae5ddd89b9f9a5 (patch) | |
tree | 7e9eec65baa30982ba7bd2764b1fa17c711816c9 /.local/bin/uni | |
parent | 953aec8d97fd86055504995be9a3a412d6e954bf (diff) |
Prepend codepoints with ‘\u’
Diffstat (limited to '.local/bin/uni')
-rwxr-xr-x | .local/bin/uni | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/.local/bin/uni b/.local/bin/uni index 3ed7ec4..73c6e1c 100755 --- a/.local/bin/uni +++ b/.local/bin/uni @@ -13,18 +13,15 @@ setup() -e 's/\<(.)([A-Z]*)/\1\L\2/2g' \ -e '/^[^;]*;</d' \ -e '/Compatibility/d' \ - -e '/Variation Selector/d' + -e '/Variation Selector/d' \ + -e 's/[^;]*/\\\\u&/' } readonly DATA="${XDG_DATA_HOME:-$HOME/.local/share}/unicode-data" [ -f "$DATA" ] || setup opt="$(cut -d';' -f2 "$DATA" | osel)" -rune="$( - awk -vopt="$opt" -F';' \ - '$2 == opt { printf "\\\\u%s\\\\n", $1; exit }' "$DATA" \ - | xargs printf -)" +rune="$(awk -vopt="$opt" -F';' '$2 == opt { print $1 }' "$DATA" | xargs printf)" wl-copy -n "$rune" \ && notify 'Rune Copied' "The rune ‘$rune’ was copied to the clipboard" |