Add rofi-nerdfont icon picker mode

This commit is contained in:
Marty Oehme 2019-09-05 19:38:56 +02:00
parent c6c4161d77
commit b28a98c4e4

37
.config/rofi/modes/nerdfont Executable file
View file

@ -0,0 +1,37 @@
#!/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