diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ccd024 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +emojis.txt diff --git a/dmenuunicode b/dmenuunicode new file mode 100755 index 0000000..08cc26d --- /dev/null +++ b/dmenuunicode @@ -0,0 +1,20 @@ +#!/bin/sh +# Give dmenu list of all unicode characters to copy. +# Shows the selected character in dunst if running. + +# Must have xclip installed to even show menu. +xclip -h >/dev/null || exit + +emojifile="/home/christian/.config/i3/scripts/emojis.txt" + +chosen=$(grep -v "#" $emojifile | dmenu -i -l 20 -fn 'Noto Color Emoji Mono-18') + +[ "$chosen" != "" ] || exit + +c=$(echo "$chosen" | sed "s/ .*//") +echo "$c" | tr -d '\n' | xclip -selection clipboard +notify-send "'$c' copied to clipboard." & + +s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}') +echo "$s" | tr -d '\n' | xclip +notify-send "'$s' copied to primary." & diff --git a/populate_emojis.sh b/populate_emojis.sh new file mode 100755 index 0000000..3b4542a --- /dev/null +++ b/populate_emojis.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Function to add an emoji and its description to the file +function add_emoji { + echo -e "$1 $2" >> emojis.txt + echo -n . +} + +# Create or clear the emojis.txt file +> emojis.txt + +EMOJI_VERSION="latest" +echo "Retrieving version: $EMOJI_VERSION" + +# Process the emojis and descriptions and call the add_emoji function +curl -s "https://unicode.org/Public/emoji/$EMOJI_VERSION/emoji-test.txt" | while read -r line; do + if [[ $line != "#"* ]]; then + if [[ $line == *"#"* ]]; then + unicode=$(echo "$line" | cut -d "#" -f 1 | awk '{$1=$1;print}'|sed 's/ ; fully-qualified//g'|tr '\n' ' '|sed 's/\b\([a-zA-Z0-9]\)/U+\1/g'); + emoji=$(echo "$line" | cut -d "#" -f 2 | awk '{$1=$1;print}'); + description=$(echo "$line" | cut -d "#" -f 3 | awk '{$1=$1;print}'); + add_emoji "$emoji" "$description" "$unicode" + fi + fi +done + +echo -e "\nEmojis file created successfully!" +