aboutsummaryrefslogtreecommitdiff
path: root/1337x
diff options
context:
space:
mode:
Diffstat (limited to '1337x')
-rwxr-xr-x1337x11
1 files changed, 7 insertions, 4 deletions
diff --git a/1337x b/1337x
index 772c48d..67596c9 100755
--- a/1337x
+++ b/1337x
@@ -2,6 +2,7 @@
url_1337x="https://1337x.to"
proxy_1337x="https://1337x.torrentbay.to"
+menu="dmenu"
die()
{
@@ -58,23 +59,25 @@ main()
out=
query=
- dep_check "dmenu"
-
+ [ -z "$DISPLAY" ] &&
+ menu="bemenu"
if [ "$#" -gt 0 ] && [ "$1" = "-o" ]
then
out=true
shift
fi
+ dep_check "$menu"
+
curl -Is "$url_1337x" > /dev/null ||
url_1337x="$proxy_1337x"
- query="${*:-$(printf "" | dmenu -p " ")}"
+ query="${*:-$(printf "" | "$menu" -p " ")}"
[ -z "$query" ] &&
die "please enter a query"
fetch="$(search_1337x "$query")"
- select="$(echo "$fetch" | sed -e's/^.*\///g' | tr '-' ' ' | dmenu -l 25 -p " " | tr ' ' '-')"
+ select="$(echo "$fetch" | sed -e's/^.*\///g' | tr '-' ' ' | "$menu" -l 25 -p " " | tr ' ' '-')"
magnet="$(magnet_1337x "$(echo "$fetch" | grep "$select")")"
[ -z "$magnet" ] &&