From b28a98c4e41a59e84a9613e91f8fcc450155a945 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 5 Sep 2019 19:38:56 +0200 Subject: [PATCH] Add rofi-nerdfont icon picker mode --- .config/rofi/modes/nerdfont | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 .config/rofi/modes/nerdfont diff --git a/.config/rofi/modes/nerdfont b/.config/rofi/modes/nerdfont new file mode 100755 index 0000000..2345988 --- /dev/null +++ b/.config/rofi/modes/nerdfont @@ -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