aboutsummaryrefslogtreecommitdiff
path: root/conf.d/05browser.fish
diff options
context:
space:
mode:
Diffstat (limited to 'conf.d/05browser.fish')
-rw-r--r--conf.d/05browser.fish62
1 files changed, 47 insertions, 15 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