aboutsummaryrefslogtreecommitdiff
path: root/env/.local/bin/system/kaomoji-picker.sh
blob: ac8e6b850c6a379d3f9672a9524f350bb5923a96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

# set up to work with https://github.com/Aptivi-Analytics/KaomojiList.git

KAO_FILE="$HOME/stuff/manual-programs/KaomojiList/kaomojis.json"

choices=$(jq '.[]|.categories|.[]|.name' "$KAO_FILE" | sed 's/"//g')

choice=$(echo "$choices" | sed /^$/d | rofi -dmenu)

emojlist=$(jq -r --arg sel "$choice" '..| select(.name==$sel)? | .emoticons | .[]' "$KAO_FILE")

emoj=$(echo "$emojlist" | sed /^$/d | rofi -dmenu)

if [ "$WAYLAND_DISPLAY" ]; then
    printf -- "%s" "$emoj" | wl-copy
else
    printf -- "%s" "$emoj" | xclip -sel clip
fi