dotfiles/.config/rofi/modes/nerdfont

38 lines
1 KiB
Bash
Executable file

#!/usr/bin/env sh
# Nerdfont csv from: https://github.com/shanedabes/rofi-nerdfonts
# a file to read from, will be preferred over url
# ROFI_NERDFONT_LIST_FILE="point/to/nerdfont-chars.csv"
# a url to pull list from
# ROFI_NERDFONT_LIST_URL="https://point-me-to/a/nerd-icon-list.csv"
# icon|name, icon is default
# ROFI_NERDFONT_OUTPUT="icon"
if [ -n "$*" ]; then
output="${ROFI_NERDFONT_OUTPUT}"
case "$output" in
name)
printf "%s" "$*" |
cut -d',' -f2 |
xclip -selection clipboard >/dev/null 2>/dev/null &
;;
icon | *)
printf "%s" "$*" |
cut -d',' -f1 |
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_NERDFONT_LIST_URL:-"https://raw.githubusercontent.com/shanedabes/rofi-nerdfonts/master/chars.csv"}
if [ -n "${ROFI_NERDFONT_LIST_FILE}" ]; then
cat "$ROFI_NERDFONT_LIST_FILE"
elif [ -n "${url}" ]; then
curl -s "${url}"
fi
fi