diff --git a/sx-open b/sx-open index 59b41cc..75704db 100755 --- a/sx-open +++ b/sx-open @@ -93,6 +93,14 @@ mime() { done } +scheme() { + declare r handler=$1; shift + + for s in "$@"; do + uri_handlers+=( "$handler" "^$s:" ) + done +} + is_uri() [[ $1 =~ ^[a-zA-Z][a-zA-Z0-9\+\.\-]+:.+ ]] main() { diff --git a/sx-open.cfg b/sx-open.cfg index 4d27fe0..e8cafb4 100644 --- a/sx-open.cfg +++ b/sx-open.cfg @@ -1,12 +1,17 @@ #!syntax bash # Configuration file for sx-open # Note that as sx-open checks the regexes in order, they should be placed in order from specific to less so. -# Format: type cmd regex -# Examples: +# scheme [ ...] +#scheme browser http https +#scheme steam steam -#uri browser '^https?:' +# Or you can specify a regex for the entire uri: +# uri [ ...] #uri steam '^steam:' +#uri browser '^(https?|ftp):' +# Mime types for filesystem targets: +# mime [ ...] #mime sxiv '^image/' #mime libreoffice '^application/msword$'