diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
| commit | 28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch) | |
| tree | 85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/emojiupdate | |
| parent | 8470ff001befcfd0f626dea69a9e76d43aee0511 (diff) | |
updates
Diffstat (limited to 'debian/.local/bin/emojiupdate')
| -rwxr-xr-x | debian/.local/bin/emojiupdate | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/debian/.local/bin/emojiupdate b/debian/.local/bin/emojiupdate new file mode 100755 index 0000000..7185a4d --- /dev/null +++ b/debian/.local/bin/emojiupdate @@ -0,0 +1,65 @@ +#!/bin/sh + +# Define input and output files +url="https://unicode.org/Public/emoji/latest/emoji-test.txt" +input_file="${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}/global/.local/share/thesiah/chars/emoji_raw" +temp_file="${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}/global/.local/share/thesiah/chars/emoji_temp" +output_file="${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}/global/.local/share/thesiah/chars/emoji" + +# Create the directory for output files if it doesn't exist +mkdir -p "$(dirname "$input_file")" + +# Download the emoji file +echo "Downloading emoji-test.txt from Unicode..." +if curl -o "$input_file" -L "$url"; then + echo "Download complete! File saved to: $input_file" +else + echo "Failed to download emoji" + exit 1 +fi + +awk ' + # Skip empty lines and comments + /^[[:space:]]*$/ || /^#/ { next } + + # Keep only fully-qualified lines + !/(fully-qualified|component)/ { next } + + # Skip lines containing 200D (zero-width joiner) + /200D/ { next } + + # Skip lines containing components + $2 ~ /1F3F[BCDEF]/ { next } + + # Print valid lines + { print } +' "$input_file" >"$temp_file" + +# Second stage: Extract emoji and description +awk -F'#' ' + { + if (NF >= 2) { + full_data = $2 # Extract the emoji and description (after #) + gsub(/^[[:space:]]+|[[:space:]]+$/, "", full_data) # Trim spaces around the entire field + + split(full_data, parts, " ") # Split into parts by spaces + emoji = parts[1] # First part is the emoji + + # Reconstruct description from parts[3] onward + description = "" + for (i = 3; i <= length(parts); i++) { + description = description parts[i] " " + } + + # Remove excessive internal spaces and trim description + gsub(/[[:space:]]+/, " ", description) + gsub(/^[[:space:]]+|[[:space:]]+$/, "", description) + + # Print emoji and description + print emoji, description + } + } +' "$temp_file" >"$output_file" + +rm -rf "$input_file" "$temp_file" +echo "Processing complete! File saved to: $output_file" |
