This repository has no description
3.5 kB
117 lines
1{
2 lib,
3 runCommand,
4 fetchurl,
5 writeText,
6 writers,
7 coreutils,
8 dmenu,
9 gnused,
10 libnotify,
11 xclip,
12 xdotool,
13}:
14let
15 unicode-file = runCommand "unicode.txt" { } ''
16 ${
17 writers.writePython3 "generate.py"
18 {
19 flakeIgnore = [
20 "E501"
21 "E722"
22 ];
23 }
24 ''
25 import csv
26
27 with open("${
28 fetchurl {
29 url = "https://unicode.org/Public/UCD/latest/ucd/UnicodeData.txt";
30 sha256 = "sha256-NgGOaGV/3LNIX2NmMP/oyFMuAcl3cD0oA/W4nWxf6vs=";
31 }
32 }", "r") as unicode_data:
33 reader = csv.reader(unicode_data, delimiter=";")
34 next(reader) # skip first row containing \0
35 for row in reader:
36 codepoint = row[0]
37 name = row[1]
38 alternate_name = row[10]
39 try:
40 print(chr(int(codepoint, 16)), codepoint, name, alternate_name, sep=" ")
41 except:
42 continue
43 ''
44 } > $out
45 '';
46 kaomoji-file = writeText "kaomoji.txt" ''
47 ¯\(°_o)/¯ dunno lol shrug dlol
48 ¯\_(ツ)_/¯ dunno lol shrug dlol
49 ( ͡° ͜ʖ ͡°) lenny
50 ¯\_( ͡° ͜ʖ ͡°)_/¯ lenny shrug dlol
51 ( ゚д゚) aaah sad noo
52 ヽ(^o^)丿 hi yay hello
53 (^o^: ups hehe
54 (^∇^) yay
55 ┗(`皿´)┛ angry argh
56 ヾ(^_^) byebye!! bye
57 <(^.^<) <(^.^)> (>^.^)> (7^.^)7 (>^.^<) dance
58 (-.-)Zzz... sleep
59 (∩╹□╹∩) oh noes woot
60 (╯°□°)╯ ┻━┻ table flip
61 (」゜ロ゜)」 why woot
62 (_゜_゜_) gloom I see you
63 ༼ ༎ຶ ෴ ༎ຶ༽ sad
64 (\/) (°,,,,°) (\/) krebs
65 ┳━┳ ヽ(ಠل͜ಠ)ノ putting table back
66 ┻━┻︵ \(°□°)/ ︵ ┻━┻ flip all dem tablez
67 (`・ω・´) bear look
68 ᕦ(ຈل͜ຈ)ᕤ strong flex muscle bicep
69 ᕦ(ò_óˇ)ᕤ strong flex muscle bicep
70 (๑>ᴗ<๑) excite
71 (∩ ` -´)⊃━━☆゚.*・。゚ wizard spell magic
72 ╰( ͡° ͜ʖ ͡° )つ──☆*:・゚ wizard spell magic
73 ◕ ◡ ◕ puss in boots big eye
74 ≋≋≋≋≋̯̫⌧̯̫(ˆ•̮ ̮•ˆ) nyan cat
75 ʕ•ᴥ•ʔ bear
76 (ԾɷԾ) adventure time
77 (⁀ᗢ⁀) happy yay
78 (≧◡≦) happy yay
79 \(º □ º )/ panic
80 𓂺 penis
81 𓂸 penis
82 __〆( ̄ー ̄ ) write down
83 __〆(º □ º) write down
84 __〆(^_^) write down
85 C= C= C= C= C=┌(;・ω・)┘ running fast here
86 ▓▒░(°◡°)░▒▓ dont care
87 (๑ᵔ⤙ᵔ๑) nom food eating
88 (·•᷄ࡇ •᷅ ) ohoh sad
89 ᕕ( ᐛ )ᕗ hehe lol letsgo
90 (^_~) wink
91 '';
92in
93# ref https://github.com/LukeSmithxyz/voidrice/blob/9fe6802122f6e0392c7fe20eefd30437771d7f8e/.local/bin/dmenuunicode
94writers.writeDashBin "unimenu" ''
95 history_file=$HOME/.cache/unimenu
96 PATH=${
97 lib.makeBinPath [
98 coreutils
99 dmenu
100 gnused
101 libnotify
102 xclip
103 xdotool
104 ]
105 }
106 chosen=$(cat "$history_file" ${kaomoji-file} ${unicode-file} | dmenu -p unicode -i -l 10 | tee --append "$history_file" | sed "s/ .*//")
107
108 [ "$chosen" != "" ] || exit
109
110 echo "$chosen" | tr -d '\n' | xclip -selection clipboard
111
112 if [ -n "$1" ]; then
113 xdotool key Shift+Insert
114 else
115 notify-send --app-name="$(basename "$0")" "'$chosen' copied to clipboard." &
116 fi
117''