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