summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-08-03 20:32:29 +0200
committerxengineering <me@xengineering.eu>2022-08-03 20:32:29 +0200
commit1ed5ec19de392a0b8791e24306b43e9772377ad6 (patch)
treef1ed7957dc291235b1199293f1ea9a951a8d6ee7
parent46289c9ca45d23cbbb573515685a15fc17908bad (diff)
downloadscripts-1ed5ec19de392a0b8791e24306b43e9772377ad6.tar
scripts-1ed5ec19de392a0b8791e24306b43e9772377ad6.tar.zst
scripts-1ed5ec19de392a0b8791e24306b43e9772377ad6.zip
Make url.sh compatible with different menus
-rwxr-xr-xurl.sh18
1 files changed, 13 insertions, 5 deletions
diff --git a/url.sh b/url.sh
index 8a5e054..c9f189e 100755
--- a/url.sh
+++ b/url.sh
@@ -13,14 +13,22 @@ then
exit 1
fi
-# check dependency and warn user if necessary
-if ! command -v bemenu > /dev/null 2>&1
+# select a menu program or panic
+if command -v bemenu > /dev/null 2>&1
then
- echo 'You have to install bemenu.'
+ menu='bemenu'
+elif command -v dmenu > /dev/null 2>&1
+then
+ menu='dmenu'
+elif command -v sxmo_dmenu.sh > /dev/null 2>&1
+then
+ menu='sxmo_dmenu.sh'
+else
+ echo 'You have to install bemenu, sxmo_dmenu.sh or dmenu!'
exit 1
fi
-# check dependency and warn user if necessary
+# check firefox dependency and warn user if necessary
if ! command -v firefox > /dev/null 2>&1
then
echo 'You have to install firefox.'
@@ -29,7 +37,7 @@ fi
# let user select the URL
closer="close menu"
-line="$(sed "$ a ${closer}" < "${data_abs}" | bemenu -l 10)"
+line="$(sed "$ a ${closer}" < "${data_abs}" | ${menu} -l 10)"
selection="$(echo "${line}" | awk -F '\t' '{print $1}')"
# exit or open URL in browser