Creating Config File for URLView
Setting up a personal configuration firle for URLView
The URLview tool looks for configuration files in two locations, a system wide configuration file in /etc/urview/system.urlview
, and a per user configuration file in ~/.urlview
. I am going to be setting up a configuration file which applies my prefered settings, and this is what I have so far:
Create the file
$ touch ~/.urlview
Add Settings to ~/.urlview
$ vim ~/.urlview
#Identify URLs to extract
REGEXP (((http|https|ftp|gopher)|mailto):(//)?[^ <>"\t]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)[^ .,;\t\n\r<">\):]?[^, <>"\t]*[^ .,;\t\n\r<">\):]
#What to do with URL
#COMMAND w3m %s
COMMAND ~/scripts/webview
WRAP yes
QUITONLLAUNCH
Webview is a script for handling various URL types with special actions.
At this point in time little more than somthing borrowed from lukemith.xyz. Script called from urlview, and browser can be changed to whatever I prefer at the time by setting the BROWSER environment variable.
#!/bin/bash
# Feed script a url
# If an image, it will view in feh.
# If a video or a gif, it will view in mpv
# If music file or pdf it will download.
# Otherwise opens link in browser.
ext="${1##*.}"
mpvFiles="mkv mp4 gif"
fehFiles="png jpg jpeg jpe"
wgetFiles="mp3 flac opus mp3?source=feed pdf shn ogg"
if echo $fehFiles |grep -w $ext > /dev/null; then
nohup feh "$1" > /dev/null &
elif echo $mpvFiles |grep -w $ext > /dev/null; then
nohup mpv --loop --quiet "$1" > /dev/null &
elif echo $wgetFiles |grep -w $ext > /dev/null; then
nohup wget "$1" > /dev/null &
else
nohup $BROWSER "$1" > /dev/null &
fi