diff --git a/scripts/appscripts/sxmo_reddit.sh b/scripts/appscripts/sxmo_reddit.sh index a49cae2..2fe7798 100755 --- a/scripts/appscripts/sxmo_reddit.sh +++ b/scripts/appscripts/sxmo_reddit.sh @@ -4,10 +4,11 @@ menu() { pidof svkbd-sxmo || svkbd-sxmo & SUBREDDIT="$( - printf %b "$(echo "$SXMO_SUBREDDITS" | tr " " '\n')" | + printf %b "Close Menu\n$(echo "$SXMO_SUBREDDITS" | tr " " '\n')" | dmenu -p "Subreddit:" -c -l 10 -fn Terminus-20 )" pkill svkbd-sxmo + [ "Close Menu" = "$SUBREDDIT" ] && exit 0 REDDITRESULTS="$( reddit-cli "$SUBREDDIT" | @@ -16,16 +17,16 @@ menu() { tr -d '\n' | sed 's/===/\n/g' | sed 's/^\t//g' | - sort -rk3,3 | + sort -t$'\t' -rnk4 | awk -F'\t' '{ printf "↑%4s", $3; print " " $4 " " $1 " " $2 }' )" RESULT="$( - echo "$REDDITRESULTS" | + printf %b "Close Menu\n$REDDITRESULTS" | dmenu -c -l 10 -fn Terminus-20 )" - [ "CLOSE_MENU" = "$RESULT" ] && exit 0 + [ "Close Menu" = "$RESULT" ] && exit 0 URL=$(echo "$RESULT" | awk -F " " '{print $NF}') $BROWSER "$URL" diff --git a/scripts/appscripts/sxmo_websearch.sh b/scripts/appscripts/sxmo_websearch.sh index 14cc94c..4604d67 100755 --- a/scripts/appscripts/sxmo_websearch.sh +++ b/scripts/appscripts/sxmo_websearch.sh @@ -4,6 +4,8 @@ SEARCHQUERY="$( echo "Close Menu" | dmenu -t -p "Search Query:" -c -fn "Terminus-20" -l 20 )" pkill svkbd-sxmo +[ "Close Menu" = "$SEARCHQUERY" ] && exit 0 + echo "$SEARCHQUERY" | grep . || exit 0 $BROWSER "https://duckduckgo.com/?q=${SEARCHQUERY}" diff --git a/scripts/appscripts/sxmo_youtube.sh b/scripts/appscripts/sxmo_youtube.sh index 520142b..0927816 100755 --- a/scripts/appscripts/sxmo_youtube.sh +++ b/scripts/appscripts/sxmo_youtube.sh @@ -2,23 +2,28 @@ menu() { pidof svkbd-sxmo || svkbd-sxmo & SEARCHTERMS="$( - echo "Search term" | + echo "Close Menu\n" | dmenu -p "Yt Search" -c -l 10 -fn Terminus-20 )" pkill svkbd-sxmo + [ "CLOSE_MENU" = "$SEARCHTERMS" ] && exit 0 IDIOTRESULTS="$(youtube-cli "$SEARCHTERMS")" - RESULT="$( + FMTRESULTS="$( echo "$IDIOTRESULTS" | grep -Ev '^(Channelid|Atom feed|Channel title|Published|Viewcount|Userid):' | sed -E 's/^(URL|Duration):\s+/\t/g' | tr -d '\n' | sed 's/===/\n/g' | gawk -F'\t' '{ print $3 " " $1 " " $2}' | - dmenu -c -l 10 -fn Terminus-20 )" + URL="$( + printf %b "Close Menu\n$FMTRESULTS" | + dmenu -c -l 10 -fn Terminus-20 + )" [ "CLOSE_MENU" = "$RESULT" ] && exit 0 + URL=$(echo "$RESULT" | awk -F " " '{print $NF}') }