From 03aa215fd6bf9476f2d7c57508e7f0d7b4b37bf4 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Fri, 1 Jan 2021 18:48:52 +0100 Subject: Better readability. --- surfraw.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'surfraw.sh') diff --git a/surfraw.sh b/surfraw.sh index 26ae66d..86b4512 100755 --- a/surfraw.sh +++ b/surfraw.sh @@ -3,9 +3,16 @@ # Do stuff using surfraw. Take back internet browsing from evil. search=$(echo "" | dmenu -p "Search:") -[ "$search" ] || exit 0 +[ -n "$search" ] || exit 0 dunstify "Searching $search" -target="$(ddgr --json "$search" | grep -E '"title": |"url": ' | sed '/"title": / N;s/\n//g' | awk '-F ["]' '{print $3 "[" $5 "]" }' | sed 's/"//g;s/,\s*\[/ \[/' | dmenu -i -l 10 -p "Target:" | awk '-F [[]' '{print $2}' | sed 's/]\s*$//')" +target="$(ddgr --json "$search" | + grep -E '"title": |"url": ' | + sed '/"title": / N;s/\n//g' | + awk '-F ["]' '{print $3 "[" $5 "]" }' | + sed 's/"//g;s/,\s*\[/ \[/' | + dmenu -i -l 10 -p "Target:" | + awk '-F [[]' '{print $2}' | + sed 's/]\s*$//')" dunstify "Trying to play result of $target" dunstify "Url: $target" mpv "$target" || qutebrowser "$target" || dunstify "URL not valid." -- cgit v1.2.1