2024-05-17 12:38:17 +02:00
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2024-05-30 09:32:00 +02:00
|
|
|
|
# Populated by fuz-cache script through xprofile at startup
|
|
|
|
|
CACHE_DIR="/tmp/fuz_cache"
|
|
|
|
|
|
|
|
|
|
# Define color escape sequences
|
|
|
|
|
c_blue='[1;34m'
|
|
|
|
|
c_gray='[1;90m'
|
|
|
|
|
c_norm='[0m'
|
|
|
|
|
h_padding=$(printf '%*s' 23 ' ')
|
|
|
|
|
h_gap=" ${c_gray}::"
|
2024-05-17 12:38:17 +02:00
|
|
|
|
|
2024-05-30 09:32:00 +02:00
|
|
|
|
# Define the header using the escape sequences
|
|
|
|
|
HEADER="${h_padding}\
|
|
|
|
|
${c_blue}Prefix${c_gray}:${c_norm}Alt${h_gap}\
|
|
|
|
|
${c_blue}1${c_gray}:${c_norm}All/Folders/Git${h_gap}\
|
|
|
|
|
${c_blue}2${c_gray}:${c_norm}Documents${h_gap}\
|
|
|
|
|
${c_blue}3${c_gray}:${c_norm}Images${h_gap}\
|
|
|
|
|
${c_blue}4${c_gray}:${c_norm}Videos"
|
2024-05-25 17:48:42 +02:00
|
|
|
|
|
2024-05-30 09:32:00 +02:00
|
|
|
|
# --bind "alt-1:transform:[[ ! \$FZF_PROMPT =~ All ]] &&
|
|
|
|
|
# echo 'change-prompt( All )+reload(cat $CACHE_DIR/all)' ||
|
|
|
|
|
# echo 'change-prompt( Folders )+reload(cat $CACHE_DIR/folders)'" \
|
|
|
|
|
fzf_main_func() {
|
|
|
|
|
cat $CACHE_DIR/all | fzf --ansi --prompt " All " \
|
|
|
|
|
--bind "alt-1:transform:(
|
|
|
|
|
([[ \$FZF_PROMPT =~ All ]] && echo 'change-prompt( Folders )+reload(cat $CACHE_DIR/folders)') ||
|
|
|
|
|
([[ \$FZF_PROMPT =~ Folders ]] && echo 'change-prompt( Git )+reload(cat $CACHE_DIR/git)') ||
|
|
|
|
|
echo 'change-prompt( All )+reload(cat $CACHE_DIR/all)')" \
|
|
|
|
|
--bind "alt-2:change-prompt( Documents )+reload(cat $CACHE_DIR/documents)" \
|
|
|
|
|
--bind "alt-3:change-prompt( Images )+reload(cat $CACHE_DIR/images)" \
|
|
|
|
|
--bind "alt-4:change-prompt( Videos )+reload(cat $CACHE_DIR/videos)" \
|
|
|
|
|
--header "$HEADER" \
|
|
|
|
|
--height=100% --pointer=" " --ellipsis= --header-first --scheme=path --algo=v2 --color="16" \
|
|
|
|
|
--preview-window "bottom,60%,border-top" --border=none --margin=5%,10%,5%,10% --info=inline-right \
|
|
|
|
|
--preview "fuz-preview {}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo -ne '\e[3 q' # Use underline shape cursor on startup.
|
|
|
|
|
dwmc setlayoutex 2
|
2024-05-25 17:48:42 +02:00
|
|
|
|
|
2024-05-30 09:32:00 +02:00
|
|
|
|
selection=$(fzf_main_func)
|
2024-05-17 12:38:17 +02:00
|
|
|
|
|
2024-05-30 09:32:00 +02:00
|
|
|
|
if [ -n "$selection" ]; then
|
|
|
|
|
fuz-opener "$selection"
|
|
|
|
|
fi
|
2024-05-18 10:41:08 +02:00
|
|
|
|
|
2024-05-30 09:32:00 +02:00
|
|
|
|
# Reset layout to tile before exiting
|
2024-05-21 10:59:16 +02:00
|
|
|
|
dwmc setlayoutex 0
|