-
-
Notifications
You must be signed in to change notification settings - Fork 7
Config
nbrowser
uses a simple shell-based config file, which is located in $HOME/.config/nbrowser/config
.
if the file does not exist, just create it
NBROWSER_CONFIG_DIR path to the nbrowser config folder. (default: "${XDG_CONFIG_HOME:-$HOME/.config}/nbrowser")
NBROWSER_DEFAULT_SEARCH Default search engine to use. (default: duckduckgo)
NBROWSER_PDF_VIEWER Pdf Viewer to use when opening pdf files.
NBROWSER_HTML_EDITOR TEXT Editor to use when opening html files.
NBROWSER_PLAYER Player to use when playing a video. (default: mpv, vlc)
NBROWSER_DOWNLOADER Downloader to use when downloading a video. (default: yt-dlp, youtube-dl)
COPY_TO_CLIPBOARD_OPTION Option to show Copy To Clipboard. (default: true)
bangs
and nbrowser
share the same shell environment, so you can add variables that needed by specific bang to the config file like APIKEYS
...
you can add additional browsers by adding something like this to your config file:
browser_count=$((browser_count+1))
installed_browsers[$browser_count]="Browser Name : path/to/browser -args"
the $browser_count
variable is used to keep track of how many browsers in the list,so you don't accidentally overwrite the list
so every time you want to add a browser you need to add browser_count=$((browser_count+1))
before it like this
browser_count=$((browser_count+1))
installed_browsers[$browser_count]="Browser1 Name : path/to/browser1 -args"
browser_count=$((browser_count+1))
installed_browsers[$browser_count]="Browser2 Name : path/to/browser2 -args"
browser_count=$((browser_count+1))
installed_browsers[$browser_count]="Browser3 Name : path/to/browser3 -args"
and this is an example of how to add a firefox profile to the list
browser_count=$((browser_count+1))
installed_browsers[$browser_count]="Firefox ProfileName : $(which firefox) -P profilename"
# pro tips:
- $browser_count variable actually start form 2,
so you can add a browser to the top without overwriting any item in the list
installed_browsers[1]="Default Browser : path/to/browser -args"
- you can also use installed_browsers[0] by I suggest to keep it to special action like opening an html file or a pdf
- when adding a browser, before and after the colon (:) those are not spaces but tabs (\t), one tab before colon and one after
there is two ways to add search engines to nbrowser
the sample one is to add a variable to the ENGINES
array in your config file that is used to construct an URL
this is a sample example of duckduckgo search engine that can be called by typing ?ddg search query
ENGINES["ddg"]="http://duckduckgo.com/?q="
the other one see here
# pro tips
if you are lazy like me , you can add all duckduckgo shortcuts by using engines.json file
wget https://duckduckgo.com/bang.js -O $HOME/.config/nbrowser/engines.json
`has` : to check for installed dependencies. (has "arg" && echo yes)
`_pemx` : show an error msg and exit. (_pemx "msg")
`_notify` : show an msg. (_notify "msg")
`_choose` : show a menu and print the selected line. (echo "arg" | _choose)
`_clean_url` : remove tracking parameters from url (_clean_url "url")
`_copy_to_clipboard` : copy to clipboard (_copy_to_clipboard "text")
`open_video_with` : show menu to open video with. (open_video_with "url")
`open_picture_with` : show menu to open picture with. (open_picture_with "url")
`open_in_browser` : show menu to open url in browser. (open_in_browser "url")
`url_handler` : clean url then open with. (url_handler "url")
`_gemini_handler` : handle gemini protocol. (_gemini_handler "url")
i made it possible to overwrite 3 functions: _copy_to_clipboard
and _clean_url
, _gemini_handler
the first one as the name indicate is used to copy text to the clipboard, the version that is included in the script use xclip
as backend, but you may want to use something else.
the seconde function is _clean_url
which try to remove tracking elements from URL, it is very basic, so you may want to improve it or replace it with something better (using ClearURLs rules)
or if you wan't to completely disable it add this to your config file
_clean_url(){
echo "$*"
}
the third one is _gemini_handler
which handle gemini protocol, by default it just add a proxy to the start of the url, but you can change that to use a local client.