You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
52 lines
1.1 KiB
#!/usr/bin/env bash |
|
# |
|
# Use rofi to pick emoji because that's what this |
|
# century is about apparently... |
|
# |
|
# Requirements: |
|
# rofi, xsel, xdotool, curl, xmllint |
|
# |
|
# Usage: |
|
# 1. Download all emoji |
|
# $ rofi-emoji --download |
|
# |
|
# 2. Run it! |
|
# $ rofi-emoji |
|
# |
|
# Notes: |
|
# * You'll need a emoji font like "Noto Emoji" or "EmojiOne". |
|
# * Confirming an item will automatically paste it WITHOUT |
|
# writing it to your clipboard. |
|
# * Ctrl+C will copy it to your clipboard WITHOUT pasting it. |
|
# |
|
|
|
# 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" | dmenu -i -p Unicode -kb-custom-1 Ctrl+c $@) |
|
exit_code=$? |
|
|
|
line=($line) |
|
|
|
if [ $exit_code == 0 ]; then |
|
xdotool type --clearmodifiers "${line[0]}" |
|
elif [ $exit_code == 10 ]; then |
|
echo -n "${line[0]}" | /usr/bin/xclip -i -selection clipboard |
|
|
|
fi |
|
} |
|
|
|
|
|
|
|
# display displays :) |
|
display
|
|
|