Said Nick Wilson on Wed, Feb 20, 2002 at 03:14:14PM +0100: > I regularly use urlview and lynx with mutt but am frustrated because > I've not been able to work out how to avoid having to manually type in > the URL when I want to view something in a graphical browser. Hummph!
Attached are my ~/.urlview and ~/bin/url_handler.sh files. I think I got them from the global settings and just modified them as necessary (this is a Debian system). You will note in the browser specification that a graphical browser (konqueror) is specified first, then a text one (lynx). If it can't handle a graphical browser (due to an unforwarded remote SSH session or similar), then it will fall back to the text one. -- [!] Justin R. Miller <[EMAIL PROTECTED]> PGP 0xC9C40C31 -=- http://codesorcery.net http://www.cnn.com/2002/US/02/19/gen.strategic.influence/index.html
# regular expression to use to match URLs REGEXP (((http|https|ftp|gopher)|mailto):(//)?[^ <>"\t]*|www\.[-a-z0-9.]+)[^ .,;\t<">\):] # command to invoke for selected URL COMMAND $HOME/bin/url_handler.sh
#! /bin/bash # Copyright (c) 1998 Martin Schulze <[EMAIL PROTECTED]> # Slightly modified by Luis Francisco Gonzalez <[EMAIL PROTECTED]> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ########################################################################### # Configurable section ########################################################################### # # Any entry in the lists of programs that urlview handler will try out will # be made of /path/to/program + ':' + TAG where TAG is one of # PW: XWindows program intended to live on after urlview's caller exits. # XW: XWindows program # XT: Launch with an xterm if possible or as VT if not # VT: Launch in the same terminal # The lists of programs to be executed are https_prgs="/usr/bin/konqueror:PW /usr/bin/lynx:VT" http_prgs="/usr/bin/konqueror:PW /usr/bin/lynx:VT" mailto_prgs="/usr/bin/mutt:VT /usr/bin/mail:VT" ftp_prgs="/usr/bin/ncftp:VT /usr/bin/lynx:VT" # Program used as an xterm (if it doesn't support -T you'll need to change # the command line in getprg) XTERM=/usr/bin/x-terminal-emulator ########################################################################### # Change bellow this at your own risk ########################################################################### function getprg() { local ele tag prog for ele in $* do tag=${ele##*:} prog=${ele%%:*} if [ -x $prog ]; then case $tag in PW) [ -n "$DISPLAY" ] && echo "P:$prog" && return 0 ;; XW) [ -n "$DISPLAY" ] && echo "X:$prog" && return 0 ;; XT) [ -n "$DISPLAY" ] && [ -x "$XTERM" ] && \ echo "X:$XTERM -e $prog" && return 0 echo "$prog" && return 0 ;; VT) echo "$prog" && return 0 ;; esac fi done } url=$1; shift type=${url%%:*} if [ "$url" = "$type" ]; then type=${url%%.*} case $type in www|web) type=http ;; esac url=$type://$url fi case $type in https) prg=`getprg $https_prgs` ;; http) prg=`getprg $http_prgs` ;; ftp) prg=`getprg $ftp_prgs` ;; mailto) prg=`getprg $mailto_prgs` url=${url#mailto:} ;; gopher) prg=`getprg $gopher_prgs` ;; *) echo "Unknown URL type. Please report URL and viewer to" echo "[EMAIL PROTECTED]" echo -n "Press enter to continue.."; read x exit ;; esac if [ -n "$prg" ]; then if [ "${prg%:*}" = "P" ]; then nohup ${prg#*:} $url 2>/dev/null 1>/dev/null & elif [ "${prg%:*}" = "X" ]; then ${prg#*:} $url 2>/dev/null & else $prg $url fi fi
msg24596/pgp00000.pgp
Description: PGP signature