dotfiles/.config/rofi/modes/fontawesome

48 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env sh
# Original wrapper script from: https://github.com/wstam88/rofi-fontawesome
# more fa icon lists can be obtained there as well
# a file to read from, will be preferred over url
# ROFI_FONTAWESOME_LIST_FILE="some-fa5-icon-list.txt"
# a url to pull list from
# ROFI_FONTAWESOME_LIST_URL="https://point-me-to/a/fa-icon-list.txt"
# icon|name|unicode, icon is default
# ROFI_FONTAWESOME_OUTPUT="icon"
if [ -n "$*" ]; then
output="${ROFI_FONTAWESOME_OUTPUT}"
case "$output" in
unicode)
printf "%s" "$*" |
grep -o -e '&#xf...;' |
sed 's/^&#x//' |
sed 's/;$//' |
xclip -selection clipboard >/dev/null 2>/dev/null &
;;
name)
printf "%s" "$*" |
cut -d\' -f2 |
xclip -selection clipboard >/dev/null 2>/dev/null &
;;
icon | *)
printf "%s" "$*" |
grep -o -e '&#xf...;' |
sed 's/^&#x/\\u/' |
sed 's/;$//' |
xclip -selection clipboard >/dev/null 2>/dev/null &
;;
esac
exit 0
elif [ -z "$*" ]; then
printf "\x00prompt\x1fIcon> \n"
printf "\x00markup-rows\x1ftrue\n"
url=${ROFI_FONTAWESOME_LIST_URL:-"https://raw.githubusercontent.com/wstam88/rofi-fontawesome/master/fa5-icon-list.txt"}
if [ -n "${ROFI_FONTAWESOME_LIST_FILE}" ]; then
cat "$ROFI_FONTAWESOME_LIST_FILE"
elif [ -n "${url}" ]; then
curl -s "${url}"
fi
fi