2022-09-22 13:53:21 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
fn="/tmp/fontnames.txt"
|
|
|
|
|
|
|
|
contains_dash() {
|
|
|
|
[[ "$1" =~ - ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
update() {
|
|
|
|
echo "" > "$fn"
|
|
|
|
|
|
|
|
font_list=$(fc-list -f "%{fullname}\n")
|
|
|
|
|
2022-09-22 20:42:26 +02:00
|
|
|
echo "$font_list" | while read -r line ; do
|
2022-09-22 13:53:21 +02:00
|
|
|
first="$(echo "$line" | cut -d',' -f1)"
|
|
|
|
last="$(echo "$line" | cut -d',' -f2)"
|
|
|
|
|
2022-09-22 20:42:26 +02:00
|
|
|
if "$(contains_dash "$first")"; then
|
2022-09-22 13:53:21 +02:00
|
|
|
echo "$last" >> "$fn"
|
|
|
|
else
|
|
|
|
echo "$first" >> "$fn"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
--update) update;;
|
2022-09-22 20:42:26 +02:00
|
|
|
*) sort "$fn" | uniq | awk 'NF' | fzf;;
|
2022-09-22 13:53:21 +02:00
|
|
|
esac
|