Skip to content

Commit a408840

Browse files
authored
Update nbrowser
1 parent 552376c commit a408840

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

nbrowser

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# nbrowser v0.3
2+
# nbrowser v0.4
33
# author : odnar-dev <https://github.com/odnar-dev>
44
# source : https://github.com/MyOS-ArchLinux/nbrowser
55
# license: GPLv3 <https://gnu.org/licenses/gpl-3.0.html>
@@ -50,7 +50,13 @@ _choose(){
5050
rofi -dmenu -i -p 'Select Item ' -theme-str 'window {width: 95%;}' -l 10 -no-click-to-exit -filter "${@:-}"
5151
}
5252

53-
# Check for installed browsers
53+
# check if necessary programs are installed
54+
if ! has 'rofi'; then
55+
notify-send "nbrowser: you need to install rofi!"
56+
exit 1
57+
fi
58+
59+
# check for installed browsers
5460
## keep the first place to special action
5561
browser_count=1
5662

@@ -84,7 +90,7 @@ for prog in badwolf qutebrowser ephemeral ; do
8490
fi
8591
done
8692

87-
## custom config
93+
# custom config
8894
[[ -f "${NBROWSER_CONFIG_DIR}/config" ]] && source "${NBROWSER_CONFIG_DIR}/config"
8995

9096
if ! has _clean_url ;then
@@ -264,11 +270,14 @@ main(){
264270
http://*|https://*)
265271
url_handler "$@"
266272
;;
267-
browser://http://*|browser://https://*)
273+
browser://*)
268274
url_handler "${1:10}"
269275
;;
270-
freetube://http://*|freetube://https://*)
271-
url_handler "${1:11}"
276+
freetube://*)
277+
open_video_with "${1:11}"
278+
;;
279+
play://*)
280+
open_video_with "${1:7}"
272281
;;
273282

274283
# my own shortcuts
@@ -322,12 +331,11 @@ main(){
322331
# handle local pdf
323332
[ -z "$NBROWSER_PDF_VIEWER" ] || installed_browsers[0]="PDF Reader : ${NBROWSER_PDF_VIEWER}"
324333
;;
325-
*.html)
326-
# handle local html
334+
*)
335+
# handle other local files
327336
[ -z "$NBROWSER_HTML_EDITOR" ] || installed_browsers[0]="Text Editor : ${NBROWSER_HTML_EDITOR}"
328337
esac
329338
open_in_browser "$*"
330-
331339
elif [ -f "${NBROWSER_CONFIG_DIR}/engines/${NBROWSER_DEFAULT_SEARCH}" ] ; then
332340
source "${NBROWSER_CONFIG_DIR}/engines/${NBROWSER_DEFAULT_SEARCH}"
333341
has nbrowser_search || _pemx "couldn't find nbrowser_search() function in ${NBROWSER_CONFIG_DIR}/engines/${NBROWSER_DEFAULT_SEARCH}"

0 commit comments

Comments
 (0)