Files
opalfiles/.local/bin/emoji_insert
2024-08-23 11:21:55 -07:00

19 lines
543 B
Bash

#!/bin/sh
# Check dependencies
for cmd in bemenu wl-copy notify-send; do
command -v $cmd >/dev/null 2>&1 || { echo "$cmd is required but not installed. Aborting."; exit 1; }
done
# Get user selection via bemenu from emoji file.
chosen=$(awk '{print $1, $0}' ~/.local/share/chars/emojis* | bemenu -i -l 30 | awk '{print $1}')
# Exit if none chosen.
[ -z "$chosen" ] && exit
# Copy selected emoji to clipboard.
echo -n "$chosen" | wl-copy
# Send notification that the emoji has been copied.
notify-send "'$chosen' copied to clipboard."