summaryrefslogtreecommitdiff
path: root/.local/bin/web/yth
diff options
context:
space:
mode:
authorVikas Kushwaha <dev@vikas.rocks>2025-06-13 08:37:31 +0530
committerVikas Kushwaha <dev@vikas.rocks>2025-06-13 08:37:31 +0530
commit28ea0e3cbe1c0f980a05d6fb13a428bcab2ea1c5 (patch)
treeb44f5301c4f60b1dae51a91e72b614996ee074ce /.local/bin/web/yth
parent311a468de08231c3dd2327473b79066a25e67462 (diff)
neovim updatesHEADmaster
Diffstat (limited to '.local/bin/web/yth')
-rwxr-xr-x.local/bin/web/yth19
1 files changed, 19 insertions, 0 deletions
diff --git a/.local/bin/web/yth b/.local/bin/web/yth
new file mode 100755
index 0000000..26cbe91
--- /dev/null
+++ b/.local/bin/web/yth
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+[ -n "$YT_HISTFILE" ] ||
+ export YT_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/yt_history.tsv"
+
+menu() {
+ case "$1" in
+ dmenu) tac "$YT_HISTFILE" | dmenu -l 30 ;;
+ *)
+ bat --color=always --language=tsv --style=plain "$YT_HISTFILE" |
+ fzf --ansi --tac \
+ --delimiter '\t' --with-nth 2,3 \
+ --header-first --header "YT History" \
+ --preview="echo {1}" --preview-window="up,1" \
+ --bind 'ctrl-y:execute-silent(printf "%s\n" {1} | xsel --clipboard)' ;;
+ esac
+}
+
+ menu "$@" | sed -E "s/\t.*\t.*$//"