diff --git a/src/main.sh b/src/main.sh index 7ded7a1..0cbdd03 100755 --- a/src/main.sh +++ b/src/main.sh @@ -73,9 +73,8 @@ FZF_DEFAULT_THREAD_LINE="{1} {3} ({4})" if [ "${1:-}" = "--show-thread" ]; then shift thread="$1" - res=$(__notmuch_thread "$thread" | fzf \ + res=$(__notmuch_thread "$thread" | $FZF \ --raw \ - --ansi \ --reverse \ --multi \ --delimiter="$(printf '\t')" \ @@ -106,9 +105,8 @@ CMD_EDIT_QUERY="edit-query" while true; do nmquery="${nmquery:-tag:inbox}" [ "$(tail -1 "$NMFHIST")" = "$nmquery" ] || echo "$nmquery" >> "$NMFHIST" - cmd=$(__notmuch_search "$nmquery" | fzf \ + cmd=$(__notmuch_search "$nmquery" | $FZF \ --header="Query: $nmquery" \ - --ansi \ --tiebreak=index \ --reverse \ --multi \ @@ -131,32 +129,33 @@ while true; do [ -n "$cmd" ] || exit 0 case "$cmd" in $CMD_SEARCH_TAG*) - tag=$(__notmuch_list_tags | fzf \ - --ansi \ - --cycle \ + tag=$(__notmuch_list_tags | $FZF \ + --color="border:$ANSICOLORTAGS" \ + --color="label:$ANSICOLORTAGS" \ + --tac \ --bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \ --margin='20%' \ --bind='enter:accept-or-print-query' \ --border=double \ - --border-label='Select tag' || true) + --border-label=" Select tag " || true) [ -n "$tag" ] || continue [ "$cmd" = "$CMD_SEARCH_TAG$APPEND" ] && nmquery="$nmquery and tag:$tag" || nmquery="tag:$tag" ;; $CMD_SEARCH_ADDRESS*) case "$cmd" in *$ADDRESS_FROM*) - label_text='Select sender' + label_text=" Select sender " field='from' ;; *) - label_text='Select recipient' + label_text=" Select recipient " field='to' ;; esac - address=$(__notmuch_list_address | fzf \ - --ansi \ + address=$(__notmuch_list_address | $FZF \ + --color="border:$ANSICOLORFROM" \ + --color="label:$ANSICOLORFROM" \ --tiebreak=index \ - --cycle \ --bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \ --margin='20%' \ --bind='enter:accept-or-print-query' \ @@ -173,8 +172,9 @@ while true; do esac ;; $CMD_EDIT_QUERY*) - nmquery=$(fzf \ - --ansi \ + nmquery=$($FZF \ + --color="border:$ANSICOLORSUBJ" \ + --color="label:$ANSICOLORSUBJ" \ --tac \ --bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \ --margin='20%' \ @@ -184,7 +184,7 @@ while true; do --prompt="Query: " \ --bind='focus:replace-query' \ --border=double \ - --border-label='Query history' < "$NMFHIST" | head -1 || true) + --border-label=' Query history ' < "$NMFHIST" | head -1 || true) ;; *) ;; diff --git a/src/sh/theme.sh b/src/sh/theme.sh index 47aee9c..1a3fd17 100644 --- a/src/sh/theme.sh +++ b/src/sh/theme.sh @@ -1,12 +1,18 @@ # Default theme if [ ! "${THEME_LOADED:-}" ]; then - COLDATE="$(printf '\033[38;5;195m')" - COLCNTS="$(printf '\033[38;5;244m')" - COLFROM="$(printf '\033[38;5;208m')" - COLSUBJ="$(printf '\033[38;5;179m\033[3m')" - COLTAGS="$(printf '\033[38;5;106m\033[2m')" + ANSICOLORDATE="${ANSICOLORDATE:-195}" + ANSICOLORCNTS="${ANSICOLORCNTS:-244}" + ANSICOLORFROM="${ANSICOLORFROM:-208}" + ANSICOLORSUBJ="${ANSICOLORSUBJ:-179}" + ANSICOLORTAGS="${ANSICOLORTAGS:-106}" + COLDATE="$(printf '\033[38;5;%sm' "$ANSICOLORDATE")" + COLCNTS="$(printf '\033[38;5;%sm' "$ANSICOLORCNTS")" + COLFROM="$(printf '\033[38;5;%sm' "$ANSICOLORFROM")" + COLSUBJ="$(printf '\033[38;5;%sm\033[3m' "$ANSICOLORSUBJ")" + COLTAGS="$(printf '\033[38;5;%sm\033[2m' "$ANSICOLORTAGS")" COLRESET="$(printf '\033[0m')" + export ANSICOLORDATE ANSICOLORCNTS ANSICOLORFROM ANSICOLORSUBJ ANSICOLORTAGS export COLDATE COLCNTS COLFROM COLSUBJ COLTAGS COLRESET export THEME_LOADED=1 diff --git a/src/sh/tools.sh b/src/sh/tools.sh index 118877b..d4847a5 100644 --- a/src/sh/tools.sh +++ b/src/sh/tools.sh @@ -1,6 +1,6 @@ if [ ! "${TOOLS_LOADED:-}" ]; then if command -v "fzf" >/dev/null; then - FZF="fzf --black --ansi --cycle --tiebreak=chunk,index" + FZF="fzf --black --ansi --cycle --info=inline-right" else err "Did not find the command-line fuzzy finder fzf." exit 1