Know when run from terminal or keybinding.
This commit is contained in:
parent
4cd2b1f8e4
commit
4fa645ea5e
15
pirokit
15
pirokit
@ -30,18 +30,25 @@ launcher() {
|
|||||||
|
|
||||||
baseurl="https://www.1377x.to/"
|
baseurl="https://www.1377x.to/"
|
||||||
|
|
||||||
|
prompt=""
|
||||||
|
|
||||||
|
# check wherer script is run from a terminal or keybinding/dmenu
|
||||||
|
if [ -t 0 ]; then
|
||||||
prompt="fzf"
|
prompt="fzf"
|
||||||
|
else
|
||||||
|
prompt="dmenu"
|
||||||
|
fi
|
||||||
|
|
||||||
#get query from dmenu
|
#get query from dmenu
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"--dmenu")
|
|
||||||
prompt="dmenu"
|
|
||||||
query=$(printf '%s' "" | launcher $prompt "Search Torrent: " | sed 's/ /+/g')
|
|
||||||
;;
|
|
||||||
"")
|
"")
|
||||||
|
if [ "$prompt" = "dmenu" ]; then
|
||||||
|
query=$(printf '%s' "" | launcher $prompt "Search Torrent: " | sed 's/ /+/g')
|
||||||
|
else
|
||||||
printf '%s' "Search Torrent: "
|
printf '%s' "Search Torrent: "
|
||||||
read -r query
|
read -r query
|
||||||
query=$(printf '%s\n' "$query" | sed 's/ /+/g')
|
query=$(printf '%s\n' "$query" | sed 's/ /+/g')
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
query=$(printf '%s\n' "$1" | sed 's/ /+/g')
|
query=$(printf '%s\n' "$1" | sed 's/ /+/g')
|
||||||
|
Loading…
Reference in New Issue
Block a user