diff options
Diffstat (limited to 'url.sh')
-rwxr-xr-x | url.sh | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -14,21 +14,28 @@ then fi # check dependency and warn user if necessary -if ! which bemenu > /dev/null 2>&1 +if ! command -v bemenu > /dev/null 2>&1 then echo 'You have to install bemenu.' exit 1 fi # check dependency and warn user if necessary -if ! which firefox > /dev/null 2>&1 +if ! command -v firefox > /dev/null 2>&1 then echo 'You have to install firefox.' exit 1 fi # let user select the URL -line="$(bemenu -l 10 < "${data_abs}")" -url="$(echo "${line}" | awk -F '\t' '{print $1}')" +closer="close menu" +line="$(sed "$ a ${closer}" < "${data_abs}" | bemenu -l 10)" +selection="$(echo "${line}" | awk -F '\t' '{print $1}')" -firefox "${url}" +# exit or open URL in browser +if [ "${selection}" = "${closer}" ] +then + exit 0 +else + firefox "${selection}" +fi |