|
1 | 1 | #!/usr/bin/env bash |
2 | | -# nbrowser v0.3 |
| 2 | +# nbrowser v0.4 |
3 | 3 | # author : odnar-dev <https://github.com/odnar-dev> |
4 | 4 | # source : https://github.com/MyOS-ArchLinux/nbrowser |
5 | 5 | # license: GPLv3 <https://gnu.org/licenses/gpl-3.0.html> |
@@ -50,7 +50,13 @@ _choose(){ |
50 | 50 | rofi -dmenu -i -p 'Select Item ' -theme-str 'window {width: 95%;}' -l 10 -no-click-to-exit -filter "${@:-}" |
51 | 51 | } |
52 | 52 |
|
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 |
54 | 60 | ## keep the first place to special action |
55 | 61 | browser_count=1 |
56 | 62 |
|
@@ -84,7 +90,7 @@ for prog in badwolf qutebrowser ephemeral ; do |
84 | 90 | fi |
85 | 91 | done |
86 | 92 |
|
87 | | -## custom config |
| 93 | +# custom config |
88 | 94 | [[ -f "${NBROWSER_CONFIG_DIR}/config" ]] && source "${NBROWSER_CONFIG_DIR}/config" |
89 | 95 |
|
90 | 96 | if ! has _clean_url ;then |
@@ -264,11 +270,14 @@ main(){ |
264 | 270 | http://*|https://*) |
265 | 271 | url_handler "$@" |
266 | 272 | ;; |
267 | | - browser://http://*|browser://https://*) |
| 273 | + browser://*) |
268 | 274 | url_handler "${1:10}" |
269 | 275 | ;; |
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}" |
272 | 281 | ;; |
273 | 282 |
|
274 | 283 | # my own shortcuts |
@@ -322,12 +331,11 @@ main(){ |
322 | 331 | # handle local pdf |
323 | 332 | [ -z "$NBROWSER_PDF_VIEWER" ] || installed_browsers[0]="PDF Reader : ${NBROWSER_PDF_VIEWER}" |
324 | 333 | ;; |
325 | | - *.html) |
326 | | - # handle local html |
| 334 | + *) |
| 335 | + # handle other local files |
327 | 336 | [ -z "$NBROWSER_HTML_EDITOR" ] || installed_browsers[0]="Text Editor : ${NBROWSER_HTML_EDITOR}" |
328 | 337 | esac |
329 | 338 | open_in_browser "$*" |
330 | | - |
331 | 339 | elif [ -f "${NBROWSER_CONFIG_DIR}/engines/${NBROWSER_DEFAULT_SEARCH}" ] ; then |
332 | 340 | source "${NBROWSER_CONFIG_DIR}/engines/${NBROWSER_DEFAULT_SEARCH}" |
333 | 341 | has nbrowser_search || _pemx "couldn't find nbrowser_search() function in ${NBROWSER_CONFIG_DIR}/engines/${NBROWSER_DEFAULT_SEARCH}" |
|
0 commit comments