diff options
| -rw-r--r-- | conf.d/05browser.fish | 62 | ||||
| -rw-r--r-- | conf.d/05gopher.fish | 13 |
2 files changed, 47 insertions, 28 deletions
diff --git a/conf.d/05browser.fish b/conf.d/05browser.fish index 4266374..c4c4b2d 100644 --- a/conf.d/05browser.fish +++ b/conf.d/05browser.fish @@ -1,30 +1,62 @@ if status is-interactive; and not fish_is_root_user -if test -z "$HOMEPAGE" - set -x HOMEPAGE "https://html.duckduckgo.com" -end + if test -z "$WEBSEARCH" + set -x WEBSEARCH 'https://html.duckduckgo.com' + end + + # Console browsers to look for by order of preference + set -f browsers 'elinks' 'links' 'lynx' 'w3m' + set -f found_browser (find_prog $browsers) + + if test -n "$found_browser" + + # If $BROWSER is unset, set it + if test -z "$BROWSER" + set -x BROWSER $found_browser + end + + end + + if not test -z "$WAYLAND_DISPLAY"; and not test -z "$DISPLAY" + + # Graphical browsers to look for by order of preference + set -f xbrowsers 'librewolf' 'firefox' + set -f found_xbrowser (find_prog $xbrowsers) -# Console browser to look for by order of preference -set -f browsers 'links' 'w3m' 'elinks' 'lynx' + if test -n "$found_xbrowser" + if test -z "$BROWSER" + set -x BROWSER $found_xbrowser + end + end + + end -# Find a suitable console web browser -set -f found_browser (find_prog $browsers) + alias webbrowser "$BROWSER" -if test -n "$found_browser" + function www --description "Browser the WWW" + if test -z $argv + webbrowser &>/dev/null + return + end - # If $BROWSER is unset, set it - if test -z "$BROWSER" - set -x BROWSER $found_browser + webbrowser $argv &>/dev/null end - function www --description "Browse the WWW" + function wwwsearch --description "Search on the WWW" if test -z $argv - $BROWSER $HOMEPAGE + webbrowser $WEBSEARCH &>/dev/null return end - $BROWSER $argv + webbrowser "$WEBSEARCH/$argv" &>/dev/null + end + + # Console gopher browser to look for by order of preference + set -f gbrowsers 'ncgopher' + set -f found_gbrowser (find_prog $gbrowsers) + + if test -n "$found_gbrowser" + alias gopher "$found_gbrowser" end -end end diff --git a/conf.d/05gopher.fish b/conf.d/05gopher.fish deleted file mode 100644 index d1526d6..0000000 --- a/conf.d/05gopher.fish +++ /dev/null @@ -1,13 +0,0 @@ -if status is-interactive; and not fish_is_root_user - -# Console gopher browser to look for by order of preference -set -f browsers 'ncgopher' - -# Find a suitable console web browser -set -f found_browser (find_prog $browsers) - -if test -n "$found_browser" - alias gopher "$found_browser" -end - -end |
