[PATCH sxmo-utils] youtube: keep search history
Export this patch
resolves #50
---
scripts/appscripts/sxmo_youtube.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/scripts/appscripts/sxmo_youtube.sh b/scripts/appscripts/sxmo_youtube.sh
index 89b2edb..f756164 100755
--- a/scripts/appscripts/sxmo_youtube.sh
+++ b/scripts/appscripts/sxmo_youtube.sh
@@ -1,12 +1,17 @@
#!/usr/bin/env sh
+HISTORY_FILE="$XDG_CONFIG_HOME"/sxmo/youtubehistory.tsv
+
menu() {
pidof "$KEYBOARD" || "$KEYBOARD" &
+ HISTORY="$(tac "$HISTORY_FILE" | nl | sort -uk 2 | sort -k 1 | cut -f 2)"
Can you elaborate on the purpose of this sorting? Just using tac alone
seems like the simple solution here?
+
SEARCHTERMS="$(
- echo "Close Menu" |
+ printf %b "Close Menu\n$HISTORY" |
dmenu -p "Yt Search" -c -l 10 -fn Terminus-20
)"
pkill "$KEYBOARD"
[ "Close Menu" = "$SEARCHTERMS" ] && exit 0
+ printf %b "$SEARCHTERMS\n" >> "$HISTORY_FILE"
IDIOTRESULTS="$(youtube-cli "$SEARCHTERMS")"
FMTRESULTS="$(
--
2.28.0