Make close menu entry in scripts more functional

master
Miles Alan 5 years ago
parent f4aea53ad1
commit 34cd1fd5bb
  1. 9
      scripts/appscripts/sxmo_reddit.sh
  2. 2
      scripts/appscripts/sxmo_websearch.sh
  3. 11
      scripts/appscripts/sxmo_youtube.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"

@ -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}"

@ -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}')
}

Loading…
Cancel
Save