#!/usr/bin/env bash
#
#   Use rofi to pick emoji because that's what this
#   century is about apparently...
#
#   Requirements:
#     rofi, xsel, xdotool, curl, xmllint
#
#   Notes:
#     * You'll need a emoji font like "Noto Emoji" or "EmojiOne".
#

# Where to save the emojis file.
UNICODE_FILE="$(dirname "$0")/unicode.txt"


function notify() {
	if [ "$(command -v notify-send)" ]; then
		notify-send "$1" "$2"
	fi
}


function display() {
	emoji=$(cat "$UNICODE_FILE" | grep -v '^[[:space:]]*$')
	line=$(echo "$emoji" | rofi -dmenu -i -p Unicode)
	exit_code=$?

	line=($line)

	echo -n "${line[0]}" | /usr/bin/xclip -i -selection clipboard
}



# display displays :)
display