-
Hey! I was trying to revert the reverse option on fzf and created a custom interface with the same code as the default one but without the option. I named it normal-fzf, placed it at ~/.config/ytfzf/interfaces/normal-fzf and also made it executable. Here it is: #!/usr/bin/env sh
interface_normal_fzf () {
command_exists "fzf" || die 3 "fzf not installed, cannot use the default menu\n"
# if it doesn't exist, this menu has not opened yet, no need to revert the actions of the last keypress
[ -f "$keypress_file" ] && handle_post_keypress
[ $show_thumbnails -eq 1 ] && { interface_thumbnails "$@"; return; }
if command_exists "tput"; then
TTY_COLS=$(tput cols 2> /dev/null)
else
TTY_COLS=${COLUMNS:-80}
command_exists "tput" || print_warning "command \"tput\" not found, defaulting to terminal width of $TTY_COLS columns\n"
fi
# shellcheck disable=SC2015
command_exists "column" && use_column=1 || { print_warning "command \"column\" not found, the menu may look very bad\n" && use_column=0; }
video_json_file=$1
selected_id_file=$2
title_len=$((TTY_COLS/2))
channel_len=$((TTY_COLS/5))
dur_len=7
view_len=10
date_len=100
unset IFS
# shellcheck disable=2015
jq -r '.[]|"\(.title)\t|\(.channel)\t|\(.duration)\t|\(.views)\t|\(.date)\t|\(.url)"' < "$video_json_file" |
sort_video_data_fn |
while IFS=$tab_space read -r title channel duration views date url
do
video_info_text
done |
{ [ $use_column -eq 1 ] && column -t -s "$tab_space" || cat; } |
fzf -m --tabstop=1 --expect="$shortcut_binds" | set_keypress |
trim_url > "$selected_id_file"
} When I use the "-i normal-fzf" option it works as expected, but when I set in my config file it doesn't work. Here's my config: pages_to_scrape=5
ytdl_pref="((bestvideo[height<=?1080][fps<=?60][vcodec^=vp9]/bestvideo[height<=?1080][fps<=?60])+(bestaudio[acodec=opus]/bestaudio[acodec=vorbis]/bestaudio[acodec=aac]/bestaudio))/best"
log_level=1
thumbnail_viewer=chafa
interface=normal-fzf I was reading the documentation and saw that ytfzf has a function called load_interface(), I would like to know if this can help and how can I use it. Also, when I also use "--show-thumbnails", it doesn't seems to respect the -i argument. I would like to know how to also implement it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yep, just use You are also correct in that when you use thumbnails your menu doesnt work, however it is respecting the You are using You could create another function in the same The contents of said function could be the same as |
Beta Was this translation helpful? Give feedback.
Yep, just use
load_interface normal-fzf
instead of setting theinterface
variable directly.You are also correct in that when you use thumbnails your menu doesnt work, however it is respecting the
-i
argument, and using your menu.You are using
interface_thumbnails
if thumbnails are enabled.You could create another function in the same
normal-fzf
file called likeinterface_thumbnails_normal_fzf
or something and use that instead.The contents of said function could be the same as
interface_thumbnails
but without--cycle
.