blob: b520fec9b98177530f5497ce2f9d3c2e4242e7fa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/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
/^[^;]*;</d
/Compatibility/d
/Variation Selector/d
s/[^;]*/\\u&/
s/^\\u([^;]{5})/\\U000\1/
'# >$DATA
}
if 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 i `{
tee >{cut -d';' -f1 | read -d\n runes} <$DATA
| cut -d';' -f2 $DATA
| osel -i
}
set rune `printf $runes[$i]
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
|