-
-
Save joepie91/36d6ca313d910c72338b73ede4693436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open_generic() | |
{ | |
if is_file_url_or_path "$1"; then | |
local file="$(file_url_to_path "$1")" | |
check_input_file "$file" | |
if has_display; then | |
filetype=`xdg-mime query filetype "$file" | sed "s/;.*//"` | |
open_generic_xdg_mime "$file" "$filetype" | |
fi | |
if type -P run-mailcap 2>/dev/null 1>&2; then | |
run-mailcap --action=view "$file" | |
if [ $? -eq 0 ]; then | |
exit_success | |
fi | |
fi | |
if has_display && mimeopen -v 2>/dev/null 1>&2; then | |
mimeopen -L -n "$file" | |
if [ $? -eq 0 ]; then | |
exit_success | |
fi | |
fi | |
fi | |
if has_display; then | |
open_generic_xdg_x_scheme_handler "$1" | |
fi | |
if [ -n "$BROWSER" ]; then | |
open_envvar "$1" | |
fi | |
# if BROWSER variable is not set, check some well known browsers instead | |
if [ x"$BROWSER" = x"" ]; then | |
BROWSER=www-browser:links2:elinks:links:lynx:w3m | |
if has_display; then | |
BROWSER=x-www-browser:firefox:iceweasel:seamonkey:mozilla:epiphany:konqueror:chromium:chromium-browser:google-chrome:$BROWSER | |
fi | |
fi | |
open_envvar "$1" | |
exit_failure_operation_impossible "no method available for opening '$1'" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment