Add rofi-fontawesome icon picker mode

This commit is contained in:
Marty Oehme 2019-09-05 19:21:55 +02:00
parent ff6ca7e684
commit c6c4161d77
2 changed files with 47 additions and 1 deletions

47
.config/rofi/modes/fontawesome Executable file
View file

@ -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 '&#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

View file

@ -67,7 +67,6 @@ if [ -z "$*" ]; then
printf "\x00prompt\x1fPower> \n" printf "\x00prompt\x1fPower> \n"
# we can use pango markup to hide text which we can then search. Neat! # we can use pango markup to hide text which we can then search. Neat!
printf "\0markup-rows\x1ftrue\n" printf "\0markup-rows\x1ftrue\n"
printf "\0filter\x1fshutdown\n"
printf "<!-- Shutdown Poweroff --> %s\n" "$power_off_btn" printf "<!-- Shutdown Poweroff --> %s\n" "$power_off_btn"
printf "<!-- Reboot Restart --> %s\n" "$reboot_btn" printf "<!-- Reboot Restart --> %s\n" "$reboot_btn"