💾 Archived View for beta.lyk.so › systems › emoji-input captured on 2023-06-14 at 13:55:36. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
Updated 2021-09-16
I wanted a utility I could invoke from my Wayland compositor to lookup and copy emoji into the clipboard. I'm sure other people have written similar things, but I couldn't find anything in ten minutes of searching that matched what I had in mind, so I wrote my own. It's quite simple. It just uses fuzzel to provide a searchable menu from a TSV of names and emoji characters and then copies whichever one I choose into my clipboard.
To get my TSV, I ran this code in the browser console on https://unicode.org/emoji/charts/full-emoji-list.html:
var list=""; var elems = document.getElementsByTagName("tr"); for (var i=3; i<elems.length; i++) { if (!elems[i].getElementsByClassName("name").length) continue; list += elems[i].getElementsByClassName("name")[0].innerText + ";;;;" + elems[i].getElementsByClassName("chars")[0].innerText + "\n"; }
Expanded the output and copied it into a file I named emoji.tsv. Ran sed to replace the ';;;;'s with tabs. (Tabs don't appear to get copied from the Firefox console on my box and vim appears to mangle some of the Unicode characters with its built-in search and replace, which is why I've done it this way.)
sed -i 's/;;;;/\t/g' emoji.tsv
This is the result of all that:
Wrote a script to search and copy from the file:
#!/usr/bin/env sh # Dependencies: # wl-clipboard # fuzzel # A list of tab-separated emoji names and characters EMOJI_LIST="${EMOJI_LIST:-$HOME/intramuros/documents/emoji.tsv}" FUZZEL_CMD="${FUZZEL_CMD:-$HOME/scripts/sway-menu}" cat "$EMOJI_LIST" | $FUZZEL_CMD --dmenu | cut -f2 | wl-copy -n
sway-menu is just a wrapper script I wrote for fuzzel to allow keeping a uniform look across the scripts that use it:
#!/usr/bin/env sh fuzzel -r0 -b111111e6 -tccccccff -mdd5001ff -s000000e6 -I -y20 -f'Jost*:style=Regular:size=8' $@
Finally I added this to my sway/config, which invokes the script when I hit Meta+m.
# emoji menu bindsym $mod+m exec emoji-lookup
Relevant links: