2023-07-11 22:12:30 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
XDG_CACHE_HOME=${XDG_CACHE_HOME:-}
|
|
|
|
if [ -n "$XDG_CACHE_HOME" ] ; then
|
2023-08-27 19:08:08 +05:30
|
|
|
HISTORY_FILE="$XDG_CACHE_HOME/ytfzf/search_hist"
|
2023-07-11 22:12:30 +05:30
|
|
|
else
|
2023-08-27 19:08:08 +05:30
|
|
|
HISTORY_FILE="$HOME/.cache/ytfzf/search_hist"
|
2023-07-11 22:12:30 +05:30
|
|
|
fi
|
|
|
|
if [ ! -e "$HISTORY_FILE" ] ; then
|
|
|
|
touch "$HISTORY_FILE"
|
|
|
|
fi
|
2024-05-11 21:06:32 +05:30
|
|
|
HISTORY="$(awk -F' ' '{$1="";$2="";$3="";print $0}' "$HISTORY_FILE" | sed 's/^\s*//g' | uniq)"
|
2023-08-27 19:08:08 +05:30
|
|
|
SEARCH_TERM="$(echo "$HISTORY" | rofi -dmenu -p "Search Youtube:")"
|
2023-07-11 22:12:30 +05:30
|
|
|
kitty --class=ytfzf --title "YouTube Search: ${SEARCH_TERM}" -- ytfzf -f -tT kitty --async-thumbnails "${SEARCH_TERM}"
|
|
|
|
|