diff options
author | xengineering <me@xengineering.eu> | 2022-08-03 20:24:31 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2022-08-03 20:24:31 +0200 |
commit | 46289c9ca45d23cbbb573515685a15fc17908bad (patch) | |
tree | afa4c72aebfde4897ee5875aaabb8321073b3350 | |
parent | 49f3bfce56f7ba1e8447ce6cf4229f8f2cbb2e19 (diff) | |
download | scripts-46289c9ca45d23cbbb573515685a15fc17908bad.tar scripts-46289c9ca45d23cbbb573515685a15fc17908bad.tar.zst scripts-46289c9ca45d23cbbb573515685a15fc17908bad.zip |
Add 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 |