From c6c4161d77a70454b3a346cb1003bbab90ed4ba5 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 5 Sep 2019 19:21:55 +0200 Subject: [PATCH] Add rofi-fontawesome icon picker mode --- .config/rofi/modes/fontawesome | 47 ++++++++++++++++++++++++++++++++++ .config/rofi/modes/powermenu | 1 - 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100755 .config/rofi/modes/fontawesome diff --git a/.config/rofi/modes/fontawesome b/.config/rofi/modes/fontawesome new file mode 100755 index 0000000..9674bc5 --- /dev/null +++ b/.config/rofi/modes/fontawesome @@ -0,0 +1,47 @@ +#!/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 '...;' | + 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 '...;' | + 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 diff --git a/.config/rofi/modes/powermenu b/.config/rofi/modes/powermenu index 9d53439..a3a076a 100755 --- a/.config/rofi/modes/powermenu +++ b/.config/rofi/modes/powermenu @@ -67,7 +67,6 @@ if [ -z "$*" ]; then printf "\x00prompt\x1fPower> \n" # we can use pango markup to hide text which we can then search. Neat! printf "\0markup-rows\x1ftrue\n" - printf "\0filter\x1fshutdown\n" printf " %s\n" "$power_off_btn" printf " %s\n" "$reboot_btn"