#!/bin/sh
# https://github.com/arp242/uni
#
# Usage:
#
#   dmenu-uni all            All codepoints, won't include ZWJ emoji sequences.
#   dmenu-uni emoji          All emojis.
#   dmenu-uni emoji-common   Common emojis
#

dmenu="dmenu -i"                                   # Command to use
#dmenu="dmenu -x -i -l 20 -fn monospace:size=20"   # Adding some options
#dmenu="rofi -dmenu"                               # Use Rofi instead
#dmenu="fzf"                                       # Use fzf instead

# Command to copy to clipboard:
copy="xclip -rmlastnl -selection clipboard"

# Common emojis I use >99% of the time:
common="-or g:smileys g:hand-fingers-open g:hand-fingers-partial g:hand-single-finger g:hand-fingers-closed g:hands g:body-parts g:person-gesture"

# Display only the male variants:
#common="$common -gender male"

# Set skin tone:
#common="$common -tone mediumdark"

case "${1:-all}" in
	all)           uni -c p all     | $dmenu | grep -o "^'.'" | tr -d "'" | $copy ;;
	emoji)         uni -c e all     | $dmenu | cut -d ' ' -f1 | $copy ;;
	emoji-common)  uni -c e $common | $dmenu | cut -d ' ' -f1 | $copy ;;
	*)             uni -c e $@      | $dmenu | cut -d ' ' -f1 | $copy ;;
	#*)             echo >&2 "dmenu-uni: unknown '$1'" ;;
esac
