From cac2e1a74ec32e27dca703d1443b05be5961c370 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Tue, 25 Oct 2022 21:29:26 +0200 Subject: [PATCH] Update fzf scripts --- .bin/dmenu-trans | 2 +- .bin/fzf-book | 5 +++-- .bin/fzf-fontnames | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.bin/dmenu-trans b/.bin/dmenu-trans index c944174..6ce20ea 100755 --- a/.bin/dmenu-trans +++ b/.bin/dmenu-trans @@ -4,6 +4,6 @@ options="nl:en\nen:nl\nnl:fr\nfr:nl\nen:fr\nfr:en\nnl:de\nde:nl" selected=$(echo -e "$options" | dmenu -p "s?:t?" -i -l 0) -notify-send --app-name= -t 3000 "$(trans $selected -b "$(dmenu -p $selected &)" \ +notify-send --app-name= -t 3000 "$(trans "$selected" -b "$(dmenu -p "$selected" &)" \ | tr -d '\n' \ | xclip -sel clip -f)" diff --git a/.bin/fzf-book b/.bin/fzf-book index b6cfdde..be78542 100755 --- a/.bin/fzf-book +++ b/.bin/fzf-book @@ -4,7 +4,8 @@ # Generate menu of book filenames and save paths # Preview window contains metadata -selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1 --preview 'pdfinfo {}' --preview-window=right:70%:wrap)" +# selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1 --preview 'pdfinfo {}' --preview-window=right:70%:wrap)" +selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1)" # Open and redirect output to /dev/null -zathura "$selected" 2> /dev/null & +zathura "$selected" --fork diff --git a/.bin/fzf-fontnames b/.bin/fzf-fontnames index bb21288..e19e3a0 100755 --- a/.bin/fzf-fontnames +++ b/.bin/fzf-fontnames @@ -11,11 +11,12 @@ update() { font_list=$(fc-list -f "%{fullname}\n") - echo "$font_list" | while read -r line ; do + echo "$font_list" | while read line ; do + first="$(echo "$line" | cut -d',' -f1)" last="$(echo "$line" | cut -d',' -f2)" - if "$(contains_dash "$first")"; then + if $(contains_dash "$first"); then echo "$last" >> "$fn" else echo "$first" >> "$fn" @@ -25,5 +26,5 @@ update() { case "$1" in --update) update;; - *) sort "$fn" | uniq | awk 'NF' | fzf;; + *) cat "$fn" | sort | uniq | awk 'NF' | fzf;; esac